mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Ensure payment method before saving payment token
This commit is contained in:
parent
19236d24c1
commit
489675c921
1 changed files with 9 additions and 0 deletions
|
@ -29,6 +29,7 @@ use WC_Subscription;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
|
@ -80,6 +81,14 @@ class SubscriptionModule implements ModuleInterface {
|
|||
add_action(
|
||||
'woocommerce_subscription_payment_complete',
|
||||
function ( $subscription ) use ( $c ) {
|
||||
if (
|
||||
$subscription->get_payment_method() !== PayPalGateway::ID
|
||||
|| $subscription->get_payment_method() !== CreditCardGateway::ID
|
||||
|| $subscription->get_payment_method() !== CardButtonGateway::ID
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$paypal_subscription_id = $subscription->get_meta( 'ppcp_subscription' ) ?? '';
|
||||
if ( $paypal_subscription_id ) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue