mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
send the country param only in sandbox environments
This commit is contained in:
parent
9dc95c0e28
commit
fe414b00dc
2 changed files with 17 additions and 3 deletions
|
@ -68,6 +68,7 @@ return array(
|
|||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
$subscription_helper = $container->get( 'subscription.helper' );
|
||||
$messages_apply = $container->get( 'button.helper.messages-apply' );
|
||||
$environment = $container->get( 'onboarding.environment' );
|
||||
return new SmartButton(
|
||||
$container->get( 'button.url' ),
|
||||
$container->get( 'session.handler' ),
|
||||
|
@ -79,7 +80,8 @@ return array(
|
|||
$request_data,
|
||||
$dcc_applies,
|
||||
$subscription_helper,
|
||||
$messages_apply
|
||||
$messages_apply,
|
||||
$environment
|
||||
);
|
||||
},
|
||||
'button.url' => static function ( $container ): string {
|
||||
|
|
|
@ -19,6 +19,7 @@ use WooCommerce\PayPalCommerce\Button\Endpoint\CreateOrderEndpoint;
|
|||
use WooCommerce\PayPalCommerce\Button\Endpoint\DataClientIdEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
|
||||
use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
@ -105,6 +106,13 @@ class SmartButton implements SmartButtonInterface {
|
|||
*/
|
||||
private $messages_apply;
|
||||
|
||||
/**
|
||||
* The environment object.
|
||||
*
|
||||
* @var Environment
|
||||
*/
|
||||
private $environment;
|
||||
|
||||
/**
|
||||
* SmartButton constructor.
|
||||
*
|
||||
|
@ -119,6 +127,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
* @param DccApplies $dcc_applies The DCC applies helper.
|
||||
* @param SubscriptionHelper $subscription_helper The subscription helper.
|
||||
* @param MessagesApply $messages_apply The Messages apply helper.
|
||||
* @param Environment $environment The environment object.
|
||||
*/
|
||||
public function __construct(
|
||||
string $module_url,
|
||||
|
@ -131,7 +140,8 @@ class SmartButton implements SmartButtonInterface {
|
|||
RequestData $request_data,
|
||||
DccApplies $dcc_applies,
|
||||
SubscriptionHelper $subscription_helper,
|
||||
MessagesApply $messages_apply
|
||||
MessagesApply $messages_apply,
|
||||
Environment $environment
|
||||
) {
|
||||
|
||||
$this->module_url = $module_url;
|
||||
|
@ -145,6 +155,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
$this->dcc_applies = $dcc_applies;
|
||||
$this->subscription_helper = $subscription_helper;
|
||||
$this->messages_apply = $messages_apply;
|
||||
$this->environment = $environment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -702,7 +713,8 @@ class SmartButton implements SmartButtonInterface {
|
|||
$this->settings->get( 'intent' ) : 'capture',
|
||||
);
|
||||
if (
|
||||
defined( 'WP_DEBUG' ) && \WP_DEBUG && is_user_logged_in()
|
||||
$this->environment->current_environment_is( Environment::SANDBOX )
|
||||
&& defined( 'WP_DEBUG' ) && \WP_DEBUG && is_user_logged_in()
|
||||
&& WC()->customer && WC()->customer->get_billing_country()
|
||||
) {
|
||||
$params['buyer-country'] = WC()->customer->get_billing_country();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue