mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-10 04:59:07 +08:00
👔 Register APM gateways in WC-REST calls
This commit is contained in:
parent
b093abe4d2
commit
fa12276026
1 changed files with 14 additions and 1 deletions
|
@ -224,7 +224,20 @@ class LocalAlternativePaymentMethodsModule implements ServiceModule, ExtendingMo
|
||||||
// Merchant onboarding must be completed.
|
// Merchant onboarding must be completed.
|
||||||
$is_connected = $container->get( 'settings.flag.is-connected' );
|
$is_connected = $container->get( 'settings.flag.is-connected' );
|
||||||
if ( ! $is_connected ) {
|
if ( ! $is_connected ) {
|
||||||
return false;
|
/**
|
||||||
|
* When the merchant is _not_ connected yet, we still need to
|
||||||
|
* register the APM gateways in one case:
|
||||||
|
*
|
||||||
|
* During the authentication process (which happens via a REST call)
|
||||||
|
* the gateways need to be present, so they can be correctly
|
||||||
|
* pre-configured for new merchants.
|
||||||
|
*
|
||||||
|
* TODO is there a cleaner solution for this?
|
||||||
|
*/
|
||||||
|
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||||
|
$request_uri = wp_unslash( $_SERVER['REQUEST_URI'] ?? '' );
|
||||||
|
|
||||||
|
return str_contains( $request_uri, '/wp-json/wc/' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// The general plugin functionality must be enabled.
|
// The general plugin functionality must be enabled.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue