Merge pull request #309 from levivm/develop
fixed payment when user has already a card
This commit is contained in:
commit
f4997f041c
2 changed files with 11 additions and 6 deletions
|
@ -1,10 +1,7 @@
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
var stripe = Stripe(window.stripeKey);
|
|
||||||
var elements = stripe.elements({locale: window.current_lan});
|
|
||||||
var card = elements.create('card', options={hidePostalCode: true});
|
|
||||||
card.mount('#card-element');
|
|
||||||
|
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
beforeSend: function(xhr, settings) {
|
beforeSend: function(xhr, settings) {
|
||||||
|
@ -32,6 +29,12 @@ $( document ).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
var hasCreditcard = window.hasCreditcard || false;
|
var hasCreditcard = window.hasCreditcard || false;
|
||||||
|
if (!hasCreditcard){
|
||||||
|
var stripe = Stripe(window.stripeKey);
|
||||||
|
var elements = stripe.elements({locale: window.current_lan});
|
||||||
|
var card = elements.create('card', options={hidePostalCode: true});
|
||||||
|
card.mount('#card-element');
|
||||||
|
}
|
||||||
console.log("has creditcard", hasCreditcard);
|
console.log("has creditcard", hasCreditcard);
|
||||||
// hasCreditcard= true;
|
// hasCreditcard= true;
|
||||||
|
|
||||||
|
|
|
@ -57,9 +57,11 @@
|
||||||
<h5 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h5>
|
<h5 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h5>
|
||||||
<input type="hidden" name="credit_card_needed" value="false"/>
|
<input type="hidden" name="credit_card_needed" value="false"/>
|
||||||
</form>
|
</form>
|
||||||
<button id="payment_button_with_creditcard" class="btn btn-success btn-lg btn-block" type="submit">
|
<div class="col-xs-6">
|
||||||
|
<button id="payment_button_with_creditcard" class="btn btn-success btn-sm btn-block" type="submit">
|
||||||
{% trans "Submit Payment" %}
|
{% trans "Submit Payment" %}
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue