mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fix place order button display for saved credit cards
This commit is contained in:
parent
7a0d9fbed1
commit
61aa53c188
1 changed files with 33 additions and 25 deletions
|
@ -14,28 +14,22 @@ class CheckoutBootstap {
|
||||||
this.render();
|
this.render();
|
||||||
|
|
||||||
jQuery(document.body).on('updated_checkout', () => {
|
jQuery(document.body).on('updated_checkout', () => {
|
||||||
this.render();
|
this.render()
|
||||||
|
|
||||||
jQuery('#saved-credit-card').on('change', () => {
|
|
||||||
if(jQuery('#saved-credit-card').val() !== '') {
|
|
||||||
this.renderer.hideButtons(this.gateway.button.wrapper);
|
|
||||||
this.renderer.hideButtons(this.gateway.messages.wrapper);
|
|
||||||
this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);
|
|
||||||
jQuery('#place_order').show();
|
|
||||||
} else {
|
|
||||||
jQuery('#place_order').hide();
|
|
||||||
this.renderer.hideButtons(this.gateway.button.wrapper);
|
|
||||||
this.renderer.hideButtons(this.gateway.messages.wrapper);
|
|
||||||
this.renderer.showButtons(this.gateway.hosted_fields.wrapper);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery(document.body).
|
jQuery(document.body).
|
||||||
on('updated_checkout payment_method_selected', () => {
|
on('updated_checkout payment_method_selected', () => {
|
||||||
this.switchBetweenPayPalandOrderButton();
|
this.switchBetweenPayPalandOrderButton()
|
||||||
});
|
this.displayPlaceOrderButtonForSavedCreditCards()
|
||||||
this.switchBetweenPayPalandOrderButton();
|
|
||||||
|
})
|
||||||
|
|
||||||
|
jQuery('#saved-credit-card').on('change', () => {
|
||||||
|
this.displayPlaceOrderButtonForSavedCreditCards()
|
||||||
|
})
|
||||||
|
|
||||||
|
this.switchBetweenPayPalandOrderButton()
|
||||||
|
this.displayPlaceOrderButtonForSavedCreditCards()
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldRender() {
|
shouldRender() {
|
||||||
|
@ -83,16 +77,30 @@ class CheckoutBootstap {
|
||||||
if (currentPaymentMethod === 'ppcp-gateway') {
|
if (currentPaymentMethod === 'ppcp-gateway') {
|
||||||
this.renderer.showButtons(this.gateway.button.wrapper);
|
this.renderer.showButtons(this.gateway.button.wrapper);
|
||||||
this.renderer.showButtons(this.gateway.messages.wrapper);
|
this.renderer.showButtons(this.gateway.messages.wrapper);
|
||||||
this.messages.render();
|
this.messages.render()
|
||||||
this.renderer.hideButtons(this.gateway.hosted_fields.wrapper);
|
this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)
|
||||||
}
|
}
|
||||||
if (currentPaymentMethod === 'ppcp-credit-card-gateway') {
|
if (currentPaymentMethod === 'ppcp-credit-card-gateway') {
|
||||||
this.renderer.hideButtons(this.gateway.button.wrapper);
|
this.renderer.hideButtons(this.gateway.button.wrapper)
|
||||||
this.renderer.hideButtons(this.gateway.messages.wrapper);
|
this.renderer.hideButtons(this.gateway.messages.wrapper)
|
||||||
this.renderer.showButtons(this.gateway.hosted_fields.wrapper);
|
this.renderer.showButtons(this.gateway.hosted_fields.wrapper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayPlaceOrderButtonForSavedCreditCards() {
|
||||||
|
if (jQuery('#saved-credit-card').length && jQuery('#saved-credit-card').val() !== '') {
|
||||||
|
this.renderer.hideButtons(this.gateway.button.wrapper)
|
||||||
|
this.renderer.hideButtons(this.gateway.messages.wrapper)
|
||||||
|
this.renderer.hideButtons(this.gateway.hosted_fields.wrapper)
|
||||||
|
jQuery('#place_order').show()
|
||||||
|
} else {
|
||||||
|
jQuery('#place_order').hide()
|
||||||
|
this.renderer.hideButtons(this.gateway.button.wrapper)
|
||||||
|
this.renderer.hideButtons(this.gateway.messages.wrapper)
|
||||||
|
this.renderer.showButtons(this.gateway.hosted_fields.wrapper)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CheckoutBootstap;
|
export default CheckoutBootstap
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue