mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Refactor Venmo and ApplePay payment tokens.
This commit is contained in:
parent
b3b6693aa2
commit
0d4fbc4c0b
10 changed files with 234 additions and 70 deletions
|
@ -22,9 +22,11 @@ use WooCommerce\PayPalCommerce\ApiClient\Factory\PayerFactory;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\ShippingPreferenceFactory;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenApplePay;
|
||||
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenPayPal;
|
||||
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenVenmo;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
|
@ -209,20 +211,20 @@ class RenewalHandler {
|
|||
);
|
||||
|
||||
if ( $token instanceof PaymentTokenPayPal ) {
|
||||
$payment_source_name = $token->get_payment_source();
|
||||
$name = 'paypal';
|
||||
}
|
||||
|
||||
if ( $payment_source_name ) {
|
||||
$name = $payment_source_name;
|
||||
}
|
||||
if ( $token instanceof PaymentTokenVenmo ) {
|
||||
$name = 'venmo';
|
||||
}
|
||||
|
||||
// Add required stored_credentials for apple_pay.
|
||||
if ( $payment_source_name === 'apple_pay' ) {
|
||||
$properties['stored_credential'] = array(
|
||||
'payment_initiator' => 'MERCHANT',
|
||||
'payment_type' => 'RECURRING',
|
||||
'usage' => 'SUBSEQUENT',
|
||||
);
|
||||
}
|
||||
if ( $token instanceof PaymentTokenApplePay ) {
|
||||
$name = 'apple_pay';
|
||||
$properties['stored_credential'] = array(
|
||||
'payment_initiator' => 'MERCHANT',
|
||||
'payment_type' => 'RECURRING',
|
||||
'usage' => 'SUBSEQUENT',
|
||||
);
|
||||
}
|
||||
|
||||
$payment_source = new PaymentSource(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue