Skip to content

Commit 0605d53

Browse files
MC-34360: [Paypal Express Checkout] Can't place an order if the currency is euro
- fix SmartButtonConfigTest
1 parent dd91179 commit 0605d53

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Magento\Paypal\Model\Config;
1313
use Magento\Paypal\Model\ConfigFactory;
1414
use Magento\Paypal\Model\SmartButtonConfig;
15+
use Magento\Store\Model\Store;
16+
use Magento\Store\Model\StoreManagerInterface;
1517
use PHPUnit\Framework\MockObject\MockObject;
1618
use PHPUnit\Framework\TestCase;
1719

@@ -56,10 +58,22 @@ protected function setUp(): void
5658
->setMethods(['create'])
5759
->getMock();
5860
$configFactoryMock->expects($this->once())->method('create')->willReturn($this->configMock);
61+
62+
/** @var Store|MockObject $storeMock */
63+
$storeMock = $this->createMock(Store::class);
64+
$storeMock->method('getCurrentCurrencyCode')
65+
->willReturn('USD');
66+
67+
/** @var StoreManagerInterface|MockObject $storeManagerMock */
68+
$storeManagerMock = $this->getMockForAbstractClass(StoreManagerInterface::class);
69+
$storeManagerMock->method('getStore')
70+
->willReturn($storeMock);
71+
5972
$this->model = new SmartButtonConfig(
6073
$this->localeResolverMock,
6174
$configFactoryMock,
6275
$scopeConfigMock,
76+
$storeManagerMock,
6377
$this->getDefaultStyles(),
6478
$this->getDisallowedFundingMap(),
6579
$this->getUnsupportedPaymentMethods()

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function generateExpectedPaypalSdkUrl(array $params) : String
4646
'merchant-id' => 'merchant',
4747
'locale' => 'es_MX',
4848
'intent' => 'authorize',
49+
'currency' => 'USD',
4950
'disable-funding' => implode(
5051
',',
5152
['credit', 'venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
@@ -84,6 +85,7 @@ function generateExpectedPaypalSdkUrl(array $params) : String
8485
'merchant-id' => 'merchant',
8586
'locale' => 'en_BR',
8687
'intent' => 'authorize',
88+
'currency' => 'USD',
8789
'disable-funding' => implode(
8890
',',
8991
['venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
@@ -121,6 +123,7 @@ function generateExpectedPaypalSdkUrl(array $params) : String
121123
'merchant-id' => 'merchant',
122124
'locale' => 'en_US',
123125
'intent' => 'authorize',
126+
'currency' => 'USD',
124127
'disable-funding' => implode(
125128
',',
126129
['venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
@@ -158,6 +161,7 @@ function generateExpectedPaypalSdkUrl(array $params) : String
158161
'merchant-id' => 'merchant',
159162
'locale' => 'en_US',
160163
'intent' => 'authorize',
164+
'currency' => 'USD',
161165
'disable-funding' => implode(
162166
',',
163167
['credit','venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
@@ -196,6 +200,7 @@ function generateExpectedPaypalSdkUrl(array $params) : String
196200
'merchant-id' => 'merchant',
197201
'locale' => 'en_BR',
198202
'intent' => 'authorize',
203+
'currency' => 'USD',
199204
'disable-funding' => implode(
200205
',',
201206
['card','venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']

0 commit comments

Comments
 (0)