mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #1840 from woocommerce/PCP-2049-place-order-redirect
Allow redirect to PayPal with "Place order" button if smart buttons failed to load (2049)
This commit is contained in:
commit
d1b087b90e
21 changed files with 504 additions and 206 deletions
|
@ -97,7 +97,9 @@ return array(
|
|||
$payment_token_repository,
|
||||
$logger,
|
||||
$api_shop_country,
|
||||
$container->get( 'api.endpoint.order' )
|
||||
$container->get( 'api.endpoint.order' ),
|
||||
$container->get( 'api.factory.paypal-checkout-url' ),
|
||||
$container->get( 'wcgateway.place-order-button-text' )
|
||||
);
|
||||
},
|
||||
'wcgateway.credit-card-gateway' => static function ( ContainerInterface $container ): CreditCardGateway {
|
||||
|
@ -141,7 +143,9 @@ return array(
|
|||
$container->get( 'wcgateway.settings.allow_card_button_gateway.default' ),
|
||||
$container->get( 'onboarding.environment' ),
|
||||
$container->get( 'vaulting.repository.payment-token' ),
|
||||
$container->get( 'woocommerce.logger.woocommerce' )
|
||||
$container->get( 'woocommerce.logger.woocommerce' ),
|
||||
$container->get( 'api.factory.paypal-checkout-url' ),
|
||||
$container->get( 'wcgateway.place-order-button-text' )
|
||||
);
|
||||
},
|
||||
'wcgateway.disabler' => static function ( ContainerInterface $container ): DisableGateways {
|
||||
|
@ -352,7 +356,10 @@ return array(
|
|||
$logger,
|
||||
$environment,
|
||||
$subscription_helper,
|
||||
$order_helper
|
||||
$order_helper,
|
||||
$container->get( 'api.factory.purchase-unit' ),
|
||||
$container->get( 'api.factory.payer' ),
|
||||
$container->get( 'api.factory.shipping-preference' )
|
||||
);
|
||||
},
|
||||
'wcgateway.processor.refunds' => static function ( ContainerInterface $container ): RefundProcessor {
|
||||
|
@ -1158,6 +1165,25 @@ return array(
|
|||
);
|
||||
},
|
||||
|
||||
'wcgateway.use-place-order-button' => function ( ContainerInterface $container ) : bool {
|
||||
/**
|
||||
* Whether to use the standard "Place order" button with redirect to PayPal instead of the PayPal smart buttons.
|
||||
*/
|
||||
return apply_filters(
|
||||
'woocommerce_paypal_payments_use_place_order_button',
|
||||
false
|
||||
);
|
||||
},
|
||||
'wcgateway.place-order-button-text' => function ( ContainerInterface $container ) : string {
|
||||
/**
|
||||
* The text for the standard "Place order" button, when the "Place order" button mode is enabled.
|
||||
*/
|
||||
return apply_filters(
|
||||
'woocommerce_paypal_payments_place_order_button_text',
|
||||
__( 'Pay with PayPal', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
},
|
||||
|
||||
'wcgateway.helper.vaulting-scope' => static function ( ContainerInterface $container ): bool {
|
||||
try {
|
||||
$token = $container->get( 'api.bearer' )->bearer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue