mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +08:00
Merge pull request #1595 from woocommerce/PCP-1906-capture-on-status-change-improvements
Apply Capture On Status Change only when order contains PayPal payment method (1906)
This commit is contained in:
commit
b4f8478920
3 changed files with 20 additions and 1 deletions
|
@ -33,6 +33,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Checkout\DisableGateways;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Endpoint\ReturnUrlEndpoint;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\GatewayRepository;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCProductStatus;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\PayUponInvoiceProductStatus;
|
||||
|
@ -356,6 +357,14 @@ class WCGatewayModule implements ModuleInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
$gateway_repository = $c->get( 'wcgateway.gateway-repository' );
|
||||
assert( $gateway_repository instanceof GatewayRepository );
|
||||
|
||||
// Only allow to proceed if the payment method is one of our Gateways.
|
||||
if ( ! $gateway_repository->exists( $wc_order->get_payment_method() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$intent = strtoupper( (string) $wc_order->get_meta( PayPalGateway::INTENT_META_KEY ) );
|
||||
$captured = wc_string_to_bool( $wc_order->get_meta( AuthorizedPaymentsProcessor::CAPTURED_META_KEY ) );
|
||||
if ( $intent !== 'AUTHORIZE' || $captured ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue