mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Prevent plugin use for send only countries
This commit is contained in:
parent
53af77897f
commit
ce5749791e
6 changed files with 291 additions and 9 deletions
|
@ -29,6 +29,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Endpoint\CaptureCardPayment;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Endpoint\RefreshFeatureStatusEndpoint;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CartCheckoutDetector;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\FeesUpdater;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Notice\SendOnlyCountryNotice;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\WcTasks\Factory\SimpleRedirectTaskFactory;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\WcTasks\Factory\SimpleRedirectTaskFactoryInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\WcTasks\Registrar\TaskRegistrar;
|
||||
|
@ -374,6 +375,113 @@ return array(
|
|||
$container->get( 'wcgateway.settings.status' )
|
||||
);
|
||||
},
|
||||
'wcgateway.store-country' => static function(): string {
|
||||
$location = wc_get_base_location();
|
||||
return $location['country'];
|
||||
},
|
||||
'wcgateway.send-only-message' => static function() {
|
||||
return __( "<strong>Important</strong>: Your current WooCommerce store location is in a \"send-only\" country, according to PayPal's policies. Sellers in these countries are unable to receive payments via PayPal. Since receiving payments is essential for using the PayPal Payments extension, you will not be able to connect your PayPal account while operating from a \"send-only\" country. To activate PayPal, please update your WooCommerce store location to a supported region and connect a PayPal account eligible for receiving payments.", 'woocommerce-paypal-payments' );
|
||||
},
|
||||
'wcgateway.send-only-countries' => static function() {
|
||||
return array(
|
||||
'AO',
|
||||
'AI',
|
||||
'AM',
|
||||
'AW',
|
||||
'AZ',
|
||||
'BY',
|
||||
'BJ',
|
||||
'BT',
|
||||
'BO',
|
||||
'VG',
|
||||
'BN',
|
||||
'BF',
|
||||
'BI',
|
||||
'CI',
|
||||
'KH',
|
||||
'CM',
|
||||
'CV',
|
||||
'TD',
|
||||
'KM',
|
||||
'CG',
|
||||
'CK',
|
||||
'DJ',
|
||||
'ER',
|
||||
'ET',
|
||||
'FK',
|
||||
'GA',
|
||||
'GM',
|
||||
'GN',
|
||||
'GW',
|
||||
'GY',
|
||||
'KI',
|
||||
'KG',
|
||||
'LA',
|
||||
'MK',
|
||||
'MG',
|
||||
'MV',
|
||||
'ML',
|
||||
'MH',
|
||||
'MR',
|
||||
'YT',
|
||||
'FM',
|
||||
'MN',
|
||||
'ME',
|
||||
'MS',
|
||||
'NA',
|
||||
'NR',
|
||||
'NP',
|
||||
'NE',
|
||||
'NG',
|
||||
'NU',
|
||||
'NF',
|
||||
'PG',
|
||||
'PY',
|
||||
'PN',
|
||||
'RW',
|
||||
'ST',
|
||||
'WS',
|
||||
'SL',
|
||||
'SB',
|
||||
'SO',
|
||||
'SH',
|
||||
'PM',
|
||||
'VC',
|
||||
'SR',
|
||||
'SJ',
|
||||
'TJ',
|
||||
'TZ',
|
||||
'TG',
|
||||
'TO',
|
||||
'TN',
|
||||
'TM',
|
||||
'TV',
|
||||
'UG',
|
||||
'UA',
|
||||
'VA',
|
||||
'WF',
|
||||
'YE',
|
||||
'ZM',
|
||||
'ZW',
|
||||
);
|
||||
},
|
||||
'wcgateway.is-send-only-country' => static function( ContainerInterface $container ) {
|
||||
$store_country = $container->get( 'wcgateway.store-country' );
|
||||
$send_only_countries = $container->get( 'wcgateway.send-only-countries' );
|
||||
return in_array( $store_country, $send_only_countries, true );
|
||||
},
|
||||
'wcgateway.notice.send-only-country' => static function ( ContainerInterface $container ) {
|
||||
$onboarding_state = $container->get( 'onboarding.state' );
|
||||
assert( $onboarding_state instanceof State );
|
||||
return new SendOnlyCountryNotice(
|
||||
$container->get( 'wcgateway.send-only-message' ),
|
||||
$container->get( 'wcgateway.is-send-only-country' ),
|
||||
$container->get( 'wcgateway.is-ppcp-settings-page' ),
|
||||
$container->get( 'wcgateway.is-wc-gateways-list-page' ),
|
||||
$onboarding_state->current_state()
|
||||
);
|
||||
},
|
||||
|
||||
'wcgateway.notice.authorize-order-action' =>
|
||||
static function ( ContainerInterface $container ): AuthorizeOrderActionNotice {
|
||||
return new AuthorizeOrderActionNotice();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue