mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Add failure registry to API module.
Add product status failure handling to GooglePay.
This commit is contained in:
parent
904beafa1f
commit
1581f34a44
8 changed files with 177 additions and 30 deletions
|
@ -40,6 +40,17 @@ class GooglepayModule implements ModuleInterface {
|
|||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
|
||||
// Clears product status when appropriate.
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_clear_apm_product_status',
|
||||
function( Settings $settings = null ) use ( $c ): void {
|
||||
$apm_status = $c->get( 'googlepay.helpers.apm-product-status' );
|
||||
assert( $apm_status instanceof ApmProductStatus );
|
||||
|
||||
$apm_status->clear( $settings );
|
||||
}
|
||||
);
|
||||
|
||||
// Check if the module is applicable, correct country, currency, ... etc.
|
||||
if ( ! $c->get( 'googlepay.eligible' ) ) {
|
||||
return;
|
||||
|
@ -113,22 +124,6 @@ class GooglepayModule implements ModuleInterface {
|
|||
return $settings;
|
||||
}
|
||||
);
|
||||
|
||||
// Clears product status when appropriate.
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_clear_apm_product_status',
|
||||
function( Settings $settings = null ) use ( $c ): void {
|
||||
$apm_status = $c->get( 'googlepay.helpers.apm-product-status' );
|
||||
assert( $apm_status instanceof ApmProductStatus );
|
||||
|
||||
if ( ! $settings instanceof Settings ) {
|
||||
$settings = null;
|
||||
}
|
||||
|
||||
$apm_status->clear( $settings );
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue