mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Send apple pay payment source
This commit is contained in:
parent
55b9f49eba
commit
0e815c819d
1 changed files with 26 additions and 0 deletions
|
@ -11,6 +11,7 @@ namespace WooCommerce\PayPalCommerce\Applepay;
|
|||
|
||||
use WC_Payment_Gateway;
|
||||
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\ExperienceContextBuilder;
|
||||
use WooCommerce\PayPalCommerce\Applepay\Assets\ApplePayButton;
|
||||
use WooCommerce\PayPalCommerce\Applepay\Assets\AppleProductStatus;
|
||||
use WooCommerce\PayPalCommerce\Applepay\Assets\PropertiesDictionary;
|
||||
|
@ -198,6 +199,31 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule
|
|||
}
|
||||
);
|
||||
|
||||
add_filter(
|
||||
'ppcp_create_order_request_body_data',
|
||||
static function ( array $data, string $payment_method, array $request ) use ( $c ) : array {
|
||||
|
||||
if ( $payment_method !== ApplePayGateway::ID ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$experience_context_builder = $c->get( 'wcgateway.builder.experience-context' );
|
||||
assert( $experience_context_builder instanceof ExperienceContextBuilder );
|
||||
|
||||
$data['payment_source'] = array(
|
||||
'apple_pay' => array(
|
||||
'experience_context' => $experience_context_builder
|
||||
->with_endpoint_return_urls()
|
||||
->build()->to_array(),
|
||||
),
|
||||
);
|
||||
|
||||
return $data;
|
||||
},
|
||||
10,
|
||||
3
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue