Skip to content

Commit f30f777

Browse files
committed
buyer country Changes applied for all paypal sdk methods
1 parent 72e9570 commit f30f777

File tree

7 files changed

+32
-3
lines changed

7 files changed

+32
-3
lines changed

app/code/Magento/Paypal/Model/Config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,7 @@ protected function _mapWppFieldset($fieldName)
15861586
case 'api_signature':
15871587
case 'api_cert':
15881588
case 'sandbox_flag':
1589+
case 'buyer_country':
15891590
case 'use_proxy':
15901591
case 'proxy_host':
15911592
case 'proxy_port':
@@ -1626,6 +1627,7 @@ protected function _mapWpukFieldset($fieldName)
16261627
case 'vendor':
16271628
case 'pwd':
16281629
case 'sandbox_flag':
1630+
case 'buyer_country':
16291631
case 'use_proxy':
16301632
case 'proxy_host':
16311633
case 'proxy_port':

app/code/Magento/Paypal/Model/SdkUrl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function getUrl(): string
103103
'client-id' => $this->getClientId(),
104104
'locale' => $this->localeResolver->getLocale(),
105105
'currency' => $this->storeManager->getStore()->getBaseCurrencyCode(),
106+
'buyer-country' => $this->getBuyerCountry(),
106107
];
107108

108109
if ($this->areMessagesEnabled()) {
@@ -114,7 +115,6 @@ public function getUrl(): string
114115
$params['intent'] = $this->getIntent();
115116
$params['merchant-id'] = $this->config->getValue('merchant_id');
116117
$params['disable-funding'] = $this->getDisallowedFunding();
117-
$params['buyer-country'] = $this->getBuyerCountry();
118118
$params = array_replace($params, $this->queryParams);
119119
}
120120
$params['components'] = implode(',', $components);

app/code/Magento/Paypal/Test/Unit/Model/SdkUrlTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public function testGetConfig(
104104
['merchant_id', null, 'merchant'],
105105
['sandbox_client_id', null, 'sb'],
106106
['sandbox_flag', null, true],
107-
['disable_funding_options', null, $disallowedFunding],
108107
['buyer_country', null, $isBuyerCountryEnabled ? 'US' : ''],
108+
['disable_funding_options', null, $disallowedFunding],
109109
['paymentAction', null, $intent],
110110
['in_context', null, true],
111111
[

app/code/Magento/Paypal/Test/Unit/Model/_files/expected_url_config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ function generateExpectedPaypalSdkUrl(array $params) : String
172172
'client-id' => 'sb',
173173
'locale' => 'en_BR',
174174
'currency' => 'USD',
175+
'buyer-country' => 'US',
175176
'commit' => 'false',
176177
'intent' => 'authorize',
177178
'merchant-id' => 'merchant',
178179
'disable-funding' => implode(
179180
',',
180181
['credit', 'sepa', 'venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
181182
),
182-
'buyer-country' => 'US',
183183
'components' => implode(',', ['messages', 'buttons'])
184184
]
185185
)

app/code/Magento/Paypal/etc/adminhtml/system/payflow_advanced.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@
5555
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
5656
<attribute type="shared">1</attribute>
5757
</field>
58+
<field id="buyer_country" translate="label" type="select" sortOrder="65" showInDefault="1" showInWebsite="1">
59+
<label>Buyer Country</label>
60+
<config_path>payment/payflow_advanced/buyer_country</config_path>
61+
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
62+
<attribute type="shared">1</attribute>
63+
<depends>
64+
<field id="sandbox_flag">1</field>
65+
</depends>
66+
</field>
5867
<field id="use_proxy" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1">
5968
<label>Use Proxy</label>
6069
<config_path>payment/payflow_advanced/use_proxy</config_path>

app/code/Magento/Paypal/etc/adminhtml/system/payflow_link.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@
5656
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
5757
<attribute type="shared">1</attribute>
5858
</field>
59+
<field id="buyer_country" translate="label" type="select" sortOrder="55" showInDefault="1" showInWebsite="1">
60+
<label>Buyer Country</label>
61+
<config_path>payment/payflow_link/buyer_country</config_path>
62+
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
63+
<attribute type="shared">1</attribute>
64+
<depends>
65+
<field id="sandbox_flag">1</field>
66+
</depends>
67+
</field>
5968
<field id="use_proxy" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1">
6069
<label>Use Proxy</label>
6170
<config_path>payment/payflow_link/use_proxy</config_path>

app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@
5151
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
5252
<attribute type="shared">1</attribute>
5353
</field>
54+
<field id="buyer_country" translate="label" type="select" sortOrder="65" showInDefault="1" showInWebsite="1">
55+
<label>Buyer Country</label>
56+
<config_path>payment/payflowpro/buyer_country</config_path>
57+
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
58+
<attribute type="shared">1</attribute>
59+
<depends>
60+
<field id="sandbox_flag">1</field>
61+
</depends>
62+
</field>
5463
<field id="use_proxy" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1">
5564
<label>Use Proxy</label>
5665
<config_path>payment/payflowpro/use_proxy</config_path>

0 commit comments

Comments
 (0)