mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +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() {
|
switchBetweenPayPalandOrderButton() {
|
||||||
jQuery('#saved-credit-card').val(jQuery('#saved-credit-card option:first').val());
|
jQuery('#saved-credit-card').val(jQuery('#saved-credit-card option:first').val());
|
||||||
|
|
||||||
const currentPaymentMethod = jQuery(
|
const currentPaymentMethod = this.currentPaymentMethod();
|
||||||
'input[name="payment_method"]:checked').val();
|
|
||||||
|
|
||||||
if (currentPaymentMethod !== 'ppcp-gateway' && currentPaymentMethod !== 'ppcp-credit-card-gateway') {
|
if (currentPaymentMethod !== 'ppcp-gateway' && currentPaymentMethod !== 'ppcp-credit-card-gateway') {
|
||||||
this.renderer.hideButtons(this.gateway.button.wrapper);
|
this.renderer.hideButtons(this.gateway.button.wrapper);
|
||||||
|
@ -93,8 +92,7 @@ class CheckoutBootstap {
|
||||||
}
|
}
|
||||||
|
|
||||||
displayPlaceOrderButtonForSavedCreditCards() {
|
displayPlaceOrderButtonForSavedCreditCards() {
|
||||||
const currentPaymentMethod = jQuery(
|
const currentPaymentMethod = this.currentPaymentMethod();
|
||||||
'input[name="payment_method"]:checked').val();
|
|
||||||
if (currentPaymentMethod !== 'ppcp-credit-card-gateway') {
|
if (currentPaymentMethod !== 'ppcp-credit-card-gateway') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -139,6 +137,10 @@ class CheckoutBootstap {
|
||||||
jQuery('#ppcp-credit-card-vault').attr("disabled", false)
|
jQuery('#ppcp-credit-card-vault').attr("disabled", false)
|
||||||
this.renderer.enableCreditCardFields()
|
this.renderer.enableCreditCardFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentPaymentMethod() {
|
||||||
|
return jQuery('input[name="payment_method"]:checked').val();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CheckoutBootstap
|
export default CheckoutBootstap
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue