fixed payment when user has already a card

This commit is contained in:
Levi 2017-06-04 17:41:48 -05:00
parent c38b36a8a5
commit 484ab5f1c6
2 changed files with 11 additions and 6 deletions

View file

@ -1,10 +1,7 @@
$( 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({
beforeSend: function(xhr, settings) {
@ -32,6 +29,12 @@ $( document ).ready(function() {
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);
// hasCreditcard= true;

View file

@ -57,9 +57,11 @@
<h5 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h5>
<input type="hidden" name="credit_card_needed" value="false"/>
</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" %}
</button>
</button>
</div>
{% else %}