Skip to content

Commit 62ef4b8

Browse files
merge magento/2.4.0-develop into magento-engcom/async-opetation-status-issue
2 parents f96ee42 + ad516cc commit 62ef4b8

9 files changed

+55
-14
lines changed

app/code/Magento/Downloadable/Model/Sample/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function __construct(
7676
* Init data for builder
7777
*
7878
* @param array $data
79-
* @return $this;
79+
* @return $this
8080
* @since 100.1.0
8181
*/
8282
public function setData(array $data)

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\App\Config\ScopeConfigInterface;
1212
use Magento\Framework\Locale\ResolverInterface;
1313
use Magento\Store\Model\ScopeInterface;
14-
use Magento\Paypal\Model\Config as PayPalConfig;
14+
use Magento\Store\Model\StoreManagerInterface;
1515

1616
/**
1717
* Provides configuration values for PayPal in-context checkout
@@ -50,6 +50,11 @@ class SmartButtonConfig
5050
*/
5151
private $unsupportedPaymentMethods;
5252

53+
/**
54+
* @var StoreManagerInterface
55+
*/
56+
private $storeManager;
57+
5358
/**
5459
* Base url for Paypal SDK
5560
*/
@@ -59,6 +64,7 @@ class SmartButtonConfig
5964
* @param ResolverInterface $localeResolver
6065
* @param ConfigFactory $configFactory
6166
* @param ScopeConfigInterface $scopeConfig
67+
* @param StoreManagerInterface $storeManager
6268
* @param array $defaultStyles
6369
* @param array $disallowedFundingMap
6470
* @param array $unsupportedPaymentMethods
@@ -67,6 +73,7 @@ public function __construct(
6773
ResolverInterface $localeResolver,
6874
ConfigFactory $configFactory,
6975
ScopeConfigInterface $scopeConfig,
76+
StoreManagerInterface $storeManager,
7077
$defaultStyles = [],
7178
$disallowedFundingMap = [],
7279
$unsupportedPaymentMethods = []
@@ -75,6 +82,7 @@ public function __construct(
7582
$this->config = $configFactory->create();
7683
$this->config->setMethod(Config::METHOD_EXPRESS);
7784
$this->scopeConfig = $scopeConfig;
85+
$this->storeManager = $storeManager;
7886
$this->defaultStyles = $defaultStyles;
7987
$this->disallowedFundingMap = $disallowedFundingMap;
8088
$this->unsupportedPaymentMethods = $unsupportedPaymentMethods;
@@ -123,6 +131,7 @@ private function generatePaypalSdkUrl(string $page): string
123131
'merchant-id' => $this->config->getValue('merchant_id'),
124132
'locale' => $this->localeResolver->getLocale(),
125133
'intent' => $this->getIntent(),
134+
'currency' => $this->storeManager->getStore()->getBaseCurrencyCode(),
126135
];
127136
if ($disallowedFunding) {
128137
$params['disable-funding'] = $disallowedFunding;

app/code/Magento/Paypal/Test/Mftf/Suite/InContextPaypalSuite.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
1313
<!--Config PayPal Express Checkout-->
1414
<actionGroup ref="ConfigPayPalExpressCheckoutActionGroup" stepKey="ConfigPayPalExpressCheckout"/>
15-
<!-- Configure PayPal Express Checkout -->
1615
<magentoCLI command="cache:clean" arguments="config full_page" stepKey="cleanFullPageCache"/>
1716
</before>
1817
<after>

app/code/Magento/Paypal/Test/Mftf/Test/StorefrontPaypalSmartButtonInCheckoutPageTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MC-13690"/>
1919
<group value="paypalExpress"/>
20-
<skip>
21-
<issueId value="MC-33951"/>
22-
</skip>
2320
</annotations>
2421
<before>
2522
<!-- Login -->

app/code/Magento/Paypal/Test/Mftf/Test/StorefrontPaypalSmartButtonWithAUDCurrencyTest.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
</skip>
2323
</annotations>
2424
<before>
25-
25+
<!--Set price scope global-->
26+
<magentoCLI command="config:set {{CatalogPriceScopeGlobalConfigData.path}} {{CatalogPriceScopeGlobalConfigData.value}}" stepKey="setCatalogPriceScopeWebsite"/>
27+
<!--Remove Currency options for Website-->
28+
<remove keyForRemoval="setCurrencyBaseEURWebsites"/>
29+
<remove keyForRemoval="setAllowedCurrencyWebsitesForEURandUSD"/>
30+
<remove keyForRemoval="setCurrencyDefaultEURWebsites"/>
2631
<!--Enable Advanced Setting-->
2732
<magentoCLI command="config:set {{StorefrontPaypalEnableSkipOrderReviewStepConfigData.path}} {{StorefrontPaypalEnableSkipOrderReviewStepConfigData.value}}" stepKey="enableSkipOrderReview"/>
2833
<!--Set merchant country-->
@@ -31,10 +36,6 @@
3136
<magentoCLI command="config:set {{SetCurrencyAUDBaseConfig.path}} {{SetCurrencyAUDBaseConfig.value}}" stepKey="setCurrencyBaseEUR"/>
3237
<magentoCLI command="config:set {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}},{{SetAllowedCurrenciesConfigForAUD.value}}" stepKey="setAllowedCurrencyEURandUSD"/>
3338
<magentoCLI command="config:set {{SetDefaultCurrencyAUDConfig.path}} {{SetDefaultCurrencyAUDConfig.value}}" stepKey="setCurrencyDefaultEUR"/>
34-
<!--Set Currency options for Website-->
35-
<magentoCLI command="config:set --scope={{SetCurrencyUSDBaseConfig.scope}} --scope-code={{SetCurrencyUSDBaseConfig.scope_code}} {{SetCurrencyUSDBaseConfig.path}} {{SetCurrencyUSDBaseConfig.value}}" stepKey="setCurrencyBaseEURWebsites"/>
36-
<magentoCLI command="config:set --scope={{SetAllowedCurrenciesConfigForUSD.scope}} --scope-code={{SetAllowedCurrenciesConfigForUSD.scope_code}} {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}},{{SetAllowedCurrenciesConfigForAUD.value}}" stepKey="setAllowedCurrencyWebsitesForEURandUSD"/>
37-
<magentoCLI command="config:set --scope={{SetDefaultCurrencyAUDConfig.scope}} --scope-code={{SetDefaultCurrencyAUDConfig.scope_code}} {{SetDefaultCurrencyAUDConfig.path}} {{SetDefaultCurrencyAUDConfig.value}}" stepKey="setCurrencyDefaultEURWebsites"/>
3839
</before>
3940
<after>
4041
<magentoCLI command="config:set {{StorefrontPaypalDisableSkipOrderReviewStepConfigData.path}} {{StorefrontPaypalDisableSkipOrderReviewStepConfigData.value}}" stepKey="disableSkipOrderReview"/>

app/code/Magento/Paypal/Test/Mftf/Test/StorefrontPaypalSmartButtonWithEuroCurrencyTest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
</skip>
2323
</annotations>
2424
<before>
25+
<!--Set price scope global-->
26+
<magentoCLI command="config:set {{CatalogPriceScopeGlobalConfigData.path}} {{CatalogPriceScopeGlobalConfigData.value}}" stepKey="setCatalogPriceScopeWebsite"/>
27+
<!--Remove Currency options for Website-->
28+
<remove keyForRemoval="setCurrencyBaseEURWebsites"/>
29+
<remove keyForRemoval="setAllowedCurrencyWebsitesForEURandUSD"/>
30+
<remove keyForRemoval="setCurrencyDefaultEURWebsites"/>
2531
<!--Set merchant country-->
2632
<magentoCLI command="config:set {{MerchantUnitedKingdom.path}} {{MerchantUnitedKingdom.value}}" stepKey="setMerchantCountryUK"/>
2733
<!--Enable Advanced Setting-->

app/code/Magento/Paypal/Test/Mftf/Test/StorefrontPaypalSmartButtonWithFranceMerchantCountryTest.xml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,28 @@
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MC-33274"/>
1919
<group value="paypalExpress"/>
20-
<skip>
21-
<issueId value="MC-33951"/>
22-
</skip>
2320
</annotations>
2421
<before>
22+
<!--Set price scope global-->
23+
<magentoCLI command="config:set {{CatalogPriceScopeGlobalConfigData.path}} {{CatalogPriceScopeGlobalConfigData.value}}" stepKey="setCatalogPriceScopeWebsite"/>
2524
<!--Set merchant country-->
2625
<magentoCLI command="config:set {{MerchantFrance.path}} {{MerchantFrance.value}}" stepKey="setMerchantCountryUK"/>
2726
<!--Enable Advanced Setting-->
2827
<magentoCLI command="config:set {{StorefrontPaypalEnableSkipOrderReviewStepConfigData.path}} {{StorefrontPaypalEnableSkipOrderReviewStepConfigData.value}}" stepKey="enableSkipOrderReview"/>
2928
<createData entity="FreeShippinMethodConfig" stepKey="enableFreeShipping"/>
29+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
3030
</before>
3131
<after>
3232
<magentoCLI command="config:set {{StorefrontPaypalDisableSkipOrderReviewStepConfigData.path}} {{StorefrontPaypalDisableSkipOrderReviewStepConfigData.value}}" stepKey="disableSkipOrderReview"/>
3333
<!--Set default merchant country-->
3434
<magentoCLI command="config:set {{MerchantUnitedStates.path}} {{MerchantUnitedStates.value}}" stepKey="setMerchantCountryDefault"/>
3535
<createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/>
3636
</after>
37+
<!-- Switch to USD-US Dollar-->
38+
<actionGroup ref="StorefrontSwitchCurrencyActionGroup" after="waitForProductPagePageLoad" stepKey="switchCurrency">
39+
<argument name="currency" value="USD"/>
40+
</actionGroup>
41+
3742
<!-- click on PayPal payment radio button -->
3843
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" after="guestCheckoutFillingShippingSection" stepKey="waitForPlaceOrderButton"/>
3944
<click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="guestSelectCheckMoneyOrderPayment"/>
@@ -52,5 +57,10 @@
5257
<actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" after="LoginToPayPal" stepKey="submitPayment"/>
5358

5459
<waitForElement after="submitPayment" selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="waitForOrderNumber"/>
60+
<see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="USD / EUR rate" stepKey="seeEURandUSDRate"/>
61+
<assertEquals stepKey="assertSelectedCategories">
62+
<actualResult type="variable">grabRate</actualResult>
63+
<expectedResult type="array">[USD / EUR rate:]</expectedResult>
64+
</assertEquals>
5565
</test>
5666
</tests>

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('getBaseCurrencyCode')
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)