mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Extract currentPaymentMethod
This commit is contained in:
parent
51517f1196
commit
9624c85a6c
1 changed files with 6 additions and 4 deletions
|
@ -67,8 +67,7 @@ class CheckoutBootstap {
|
|||
switchBetweenPayPalandOrderButton() {
|
||||
jQuery('#saved-credit-card').val(jQuery('#saved-credit-card option:first').val());
|
||||
|
||||
const currentPaymentMethod = jQuery(
|
||||
'input[name="payment_method"]:checked').val();
|
||||
const currentPaymentMethod = this.currentPaymentMethod();
|
||||
|
||||
if (currentPaymentMethod !== 'ppcp-gateway' && currentPaymentMethod !== 'ppcp-credit-card-gateway') {
|
||||
this.renderer.hideButtons(this.gateway.button.wrapper);
|
||||
|
@ -93,8 +92,7 @@ class CheckoutBootstap {
|
|||
}
|
||||
|
||||
displayPlaceOrderButtonForSavedCreditCards() {
|
||||
const currentPaymentMethod = jQuery(
|
||||
'input[name="payment_method"]:checked').val();
|
||||
const currentPaymentMethod = this.currentPaymentMethod();
|
||||
if (currentPaymentMethod !== 'ppcp-credit-card-gateway') {
|
||||
return;
|
||||
}
|
||||
|
@ -139,6 +137,10 @@ class CheckoutBootstap {
|
|||
jQuery('#ppcp-credit-card-vault').attr("disabled", false)
|
||||
this.renderer.enableCreditCardFields()
|
||||
}
|
||||
|
||||
currentPaymentMethod() {
|
||||
return jQuery('input[name="payment_method"]:checked').val();
|
||||
}
|
||||
}
|
||||
|
||||
export default CheckoutBootstap
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue