Skip to content

Commit f15dec4

Browse files
committed
Merge branch 'ACQE-7178-1' into ACQE-6592
2 parents ed088be + 8ac529d commit f15dec4

File tree

27 files changed

+759
-173
lines changed

27 files changed

+759
-173
lines changed

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -42,5 +42,6 @@
4242
<element name="fptAmount" type="text" selector="//*[@id='cart-totals']//tr[@class='totals']//td[@class='amount']/span"/>
4343
<element name="canadaTaxAmount" type="text" selector="//span[@data-th='Canada-GST-5%']"/>
4444
<element name="canadaPstTaxAmount" type="text" selector="//span[@data-th='Canada-GST-PST-5%']"/>
45+
<element name="shippingMethods" type="text" selector="//label[text()='{{deliveryMethod}}']" parameterized="true"/>
4546
</section>
4647
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminEnableDHLAPWithoutAccountAndCountryConfigurationActionGroup" extends="AdminEnableDHLConfigurationActionGroup">
12+
<annotations>
13+
<description>Admin Enable DHL shipping method with AP without account number and specific country</description>
14+
</annotations>
15+
<remove keyForRemoval="DHLAccount"/>
16+
<remove keyForRemoval="DHLSpecificCountries"/>
17+
<remove keyForRemoval="DHLSelectSpecificCountry"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Customer/Model/EmailNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -297,14 +297,14 @@ private function sendEmailTemplate(
297297
$storeId
298298
);
299299

300+
$this->emulation->startEnvironmentEmulation($storeId, \Magento\Framework\App\Area::AREA_FRONTEND);
300301
$transport = $this->transportBuilder->setTemplateIdentifier($templateId)
301302
->setTemplateOptions(['area' => 'frontend', 'store' => $storeId])
302303
->setTemplateVars($templateParams)
303304
->setFrom($from)
304305
->addTo($email, $this->customerViewHelper->getCustomerName($customer))
305306
->getTransport();
306307

307-
$this->emulation->startEnvironmentEmulation($storeId, \Magento\Framework\App\Area::AREA_FRONTEND);
308308
$transport->sendMessage();
309309
$this->emulation->stopEnvironmentEmulation();
310310
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontRegisteredCustomerUsesDHLAPOnlineShippingCarrierOnCheckoutTest">
12+
<annotations>
13+
<stories value="DHL Shipping Carrier On Checkout"/>
14+
<title value="Customer Uses DHL AP Online Shipping Carrier On Checkout"/>
15+
<description value="Testcase verifies On storefront customer successfully place an order using DHL(AP) shipping carrier"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-5026"/>
18+
<group value="pr_exclude"/>
19+
<group value="3rd_party_integration"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<createData entity="Customer_US_UK_DE" stepKey="createCustomer"/>
24+
<actionGroup ref="AdminSetShippingOriginConfigForStateFieldActionGroup" stepKey="setShippingOriginConfiguration">
25+
<argument name="country" value="Singapore"/>
26+
<argument name="postcode" value="408898"/>
27+
</actionGroup>
28+
<actionGroup ref="AdminNavigateToCurrencySetupPageActionGroup" stepKey="goToCurrencySetupPage"/>
29+
<!--Open currency options and select singapore dollar as allowed currency-->
30+
<conditionalClick selector="{{AdminConfigSection.currencyOptionsTab}}" dependentSelector="{{AdminConfigSection.defaultCurrencySelect}}" visible="false" stepKey="openCurrencyOptionsTab"/>
31+
<selectOption selector="{{AdminConfigSection.allowedCurrencies}}" parameterArray="['Singapore Dollar', 'US Dollar']" stepKey="selectAllowedCurrency"/>
32+
<actionGroup ref="SaveStoreConfigurationActionGroup" stepKey="saveStoreConfiguration"/>
33+
<!-- go to currency rate page and fill currency rate -->
34+
<actionGroup ref="AdminOpenCurrencyRatesPageActionGroup" stepKey="naviagteToCurrencyRatesPage"/>
35+
<actionGroup ref="AdminSetCurrencyRatesActionGroup" stepKey="setCurrencyRates">
36+
<argument name="firstCurrency" value="USD"/>
37+
<argument name="secondCurrency" value="SGD"/>
38+
<argument name="rate" value="1.35"/>
39+
</actionGroup>
40+
<!--Create simple product-->
41+
<createData entity="SimpleProduct" stepKey="createSimpleProduct"/>
42+
<!-- Create configurable product with two options -->
43+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"/>
44+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
45+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption">
46+
<requiredEntity createDataKey="createConfigProductAttribute"/>
47+
</createData>
48+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
49+
<requiredEntity createDataKey="createConfigProductAttribute"/>
50+
</createData>
51+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption">
52+
<requiredEntity createDataKey="createConfigProductAttribute"/>
53+
</getData>
54+
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct">
55+
<requiredEntity createDataKey="createConfigProductAttribute"/>
56+
<requiredEntity createDataKey="getConfigAttributeOption"/>
57+
</createData>
58+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
59+
<requiredEntity createDataKey="createConfigProduct"/>
60+
<requiredEntity createDataKey="createConfigProductAttribute"/>
61+
<requiredEntity createDataKey="getConfigAttributeOption"/>
62+
</createData>
63+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChildOne">
64+
<requiredEntity createDataKey="createConfigProduct"/>
65+
<requiredEntity createDataKey="createConfigChildProduct"/>
66+
</createData>
67+
<!--Create Bundle product with multi select option-->
68+
<createData entity="BundleProductPriceViewRange" stepKey="createBundleProduct"/>
69+
<createData entity="MultipleSelectOption" stepKey="createBundleOption1_1">
70+
<requiredEntity createDataKey="createBundleProduct"/>
71+
<field key="required">True</field>
72+
</createData>
73+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
74+
<requiredEntity createDataKey="createBundleProduct"/>
75+
<requiredEntity createDataKey="createBundleOption1_1"/>
76+
<requiredEntity createDataKey="createSimpleProduct"/>
77+
</createData>
78+
<actionGroup ref="AdminEnableDHLAPWithoutAccountAndCountryConfigurationActionGroup" stepKey="enableDHL"/>
79+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
80+
<argument name="indices" value=""/>
81+
</actionGroup>
82+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
83+
<argument name="tags" value="config full_page"/>
84+
</actionGroup>
85+
</before>
86+
<after>
87+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer" />
88+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
89+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
90+
<deleteData createDataKey="createConfigChildProduct" stepKey="deleteConfigChildProduct"/>
91+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
92+
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
93+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
94+
<!-- Reset shipping origin -->
95+
<actionGroup ref="AdminResetShippingOriginConfigurationActionGroup" stepKey="resetCaliforniaShippingOrigin"/>
96+
<actionGroup ref="AdminDisableDHLConfigurationActionGroup" stepKey="resetDhlConfig"/>
97+
<!-- unselect sgd as a allowed currency -->
98+
<actionGroup ref="AdminNavigateToCurrencySetupPageActionGroup" stepKey="againGoToCurrencySetupPage"/>
99+
<!--Open currency options and select singapore dollar as allowed currency-->
100+
<conditionalClick selector="{{AdminConfigSection.currencyOptionsTab}}" dependentSelector="{{AdminConfigSection.defaultCurrencySelect}}" visible="false" stepKey="openCurrencyOptions"/>
101+
<selectOption selector="{{AdminConfigSection.allowedCurrencies}}" parameterArray="['US Dollar']" stepKey="UnselectAllowedCurrency"/>
102+
<actionGroup ref="SaveStoreConfigurationActionGroup" stepKey="saveConfiguration"/>
103+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
104+
</after>
105+
<!--Login to storefront from customer-->
106+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
107+
<argument name="Customer" value="$$createCustomer$$"/>
108+
</actionGroup>
109+
<!-- Add bundle product to cart -->
110+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openBundleProductPage">
111+
<argument name="productUrl" value="$$createBundleProduct.custom_attributes[url_key]$$" />
112+
</actionGroup>
113+
<actionGroup ref="StorefrontAddBundleProductFromProductToCartActionGroup" stepKey="addBundleProductToCart">
114+
<argument name="productName" value="$createBundleProduct.name$"/>
115+
</actionGroup>
116+
<!-- Add simple product to cart -->
117+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart">
118+
<argument name="product" value="$$createSimpleProduct$$"/>
119+
</actionGroup>
120+
<!-- Add Configurable Product to cart -->
121+
<actionGroup ref="StorefrontAddConfigurableProductToTheCartActionGroup" stepKey="addConfigurableProductToCart">
122+
<argument name="urlKey" value="$$createConfigProduct.custom_attributes[url_key]$$" />
123+
<argument name="productAttribute" value="$$createConfigProductAttribute.default_value$$"/>
124+
<argument name="productOption" value="$$getConfigAttributeOption.value$$"/>
125+
<argument name="qty" value="1"/>
126+
</actionGroup>
127+
<!-- Go to Shopping Cart -->
128+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCheckoutCartIndexPage"/>
129+
<conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.estimateShippingAndTaxSummary}}" visible="false" stepKey="openEstimateShippingAndTaxSection"/>
130+
<actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields">
131+
<argument name="address" value="DE_Address_Berlin_Not_Default_Address"/>
132+
</actionGroup>
133+
<waitForElement selector="{{CheckoutCartSummarySection.shippingMethods('Express worldwide')}}" stepKey="verifyExpressWorldWideIsAvailable"/>
134+
<waitForElement selector="{{CheckoutCartSummarySection.shippingMethods('Express easy')}}" stepKey="verifyExpressEasyIsAvailable"/>
135+
<waitForElement selector="{{CheckoutCartSummarySection.shippingMethods('Express 12:00')}}" stepKey="verifyExpress12IsAvailable"/>
136+
<waitForElement selector="{{CheckoutCartSummarySection.shippingMethods('Medical express')}}" stepKey="verifyMedicalExpressIsAvailable"/>
137+
<click selector="{{CheckoutCartSummarySection.shippingMethods('Express worldwide')}}" stepKey="selectExpressWorldWide"/>
138+
<actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="goToCheckout"/>
139+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickOnNextButton"/>
140+
<!-- Checkout select Check/Money Order payment -->
141+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
142+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
143+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
144+
<!--navigate to orders grid-->
145+
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToAdminSalesOrders"/>
146+
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById">
147+
<argument name="orderId" value="{$grabOrderNumber}"/>
148+
</actionGroup>
149+
<waitForText selector="{{AdminOrdersGridSection.firstRow}}" userInput="$grabOrderNumber" stepKey="seeOrderIdInGrid"/>
150+
</test>
151+
</tests>

app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -423,6 +423,17 @@ public static function getAllOptionsDataProvider()
423423
['value' => '16', 'label' => 'black'],
424424
['value' => '17', 'label' => 'white']
425425
]
426+
],
427+
[
428+
true,
429+
true,
430+
[['value' => '16', 'label' => 'default sv black'], ['value' => '17', 'label' => 'default sv white']],
431+
[['value' => '16', 'label' => 'black'], ['value' => '17', 'label' => 'white']],
432+
[
433+
['label' => ' ', 'value' => ''],
434+
['value' => '16', 'label' => 'black'],
435+
['value' => '17', 'label' => 'white']
436+
]
426437
]
427438
];
428439
}

app/code/Magento/Quote/Model/CustomerManagement.php

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -10,6 +10,7 @@
1010
use Magento\Customer\Api\AccountManagementInterface as AccountManagement;
1111
use Magento\Customer\Api\AddressRepositoryInterface as CustomerAddressRepository;
1212
use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository;
13+
use Magento\Customer\Api\Data\AddressInterfaceFactory;
1314
use Magento\Customer\Model\AddressFactory;
1415
use Magento\Framework\App\ObjectManager;
1516
use Magento\Framework\Validator\Exception as ValidatorException;
@@ -46,24 +47,32 @@ class CustomerManagement
4647
*/
4748
private $addressFactory;
4849

50+
/**
51+
* @var AddressInterfaceFactory
52+
*/
53+
private $customerAddressFactory;
54+
4955
/**
5056
* CustomerManagement constructor.
5157
* @param CustomerRepository $customerRepository
5258
* @param CustomerAddressRepository $customerAddressRepository
5359
* @param AccountManagement $accountManagement
60+
* @param AddressInterfaceFactory $customerAddressFactory
5461
* @param ValidatorFactory|null $validatorFactory
5562
* @param AddressFactory|null $addressFactory
5663
*/
5764
public function __construct(
5865
CustomerRepository $customerRepository,
5966
CustomerAddressRepository $customerAddressRepository,
6067
AccountManagement $accountManagement,
68+
AddressInterfaceFactory $customerAddressFactory,
6169
ValidatorFactory $validatorFactory = null,
6270
AddressFactory $addressFactory = null
6371
) {
6472
$this->customerRepository = $customerRepository;
6573
$this->customerAddressRepository = $customerAddressRepository;
6674
$this->accountManagement = $accountManagement;
75+
$this->customerAddressFactory = $customerAddressFactory;
6776
$this->validatorFactory = $validatorFactory ?: ObjectManager::getInstance()
6877
->get(ValidatorFactory::class);
6978
$this->addressFactory = $addressFactory ?: ObjectManager::getInstance()
@@ -150,18 +159,29 @@ public function validateAddresses(QuoteEntity $quote)
150159
$quote->getShippingAddress()->getCustomerAddressId()
151160
);
152161
}
153-
if (!empty($addresses)) {
154-
foreach ($addresses as $address) {
155-
$validator = $this->validatorFactory->createValidator('customer_address', 'save');
156-
$addressModel = $this->addressFactory->create();
157-
$addressModel->updateData($address);
158-
if (!$validator->isValid($addressModel)) {
159-
throw new ValidatorException(
160-
null,
161-
null,
162-
$validator->getMessages()
163-
);
164-
}
162+
if (empty($addresses) && $quote->getCustomerIsGuest()) {
163+
$billingAddress = $quote->getBillingAddress();
164+
$customerAddress = $this->customerAddressFactory->create();
165+
$customerAddress->setFirstname($billingAddress->getFirstname());
166+
$customerAddress->setLastname($billingAddress->getLastname());
167+
$customerAddress->setStreet($billingAddress->getStreet());
168+
$customerAddress->setCity($billingAddress->getCity());
169+
$customerAddress->setPostcode($billingAddress->getPostcode());
170+
$customerAddress->setTelephone($billingAddress->getTelephone());
171+
$customerAddress->setCountryId($billingAddress->getCountryId());
172+
$customerAddress->setCustomAttributes($billingAddress->getCustomAttributes());
173+
$addresses[] = $customerAddress;
174+
}
175+
foreach ($addresses as $address) {
176+
$validator = $this->validatorFactory->createValidator('customer_address', 'save');
177+
$addressModel = $this->addressFactory->create();
178+
$addressModel->updateData($address);
179+
if (!$validator->isValid($addressModel)) {
180+
throw new ValidatorException(
181+
null,
182+
null,
183+
$validator->getMessages()
184+
);
165185
}
166186
}
167187
}

app/code/Magento/Quote/Model/QuoteManagement.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -565,10 +565,10 @@ protected function submitQuote(QuoteEntity $quote, $orderData = [])
565565
if (!$quote->getCustomerIsGuest()) {
566566
if ($quote->getCustomerId()) {
567567
$this->_prepareCustomerQuote($quote);
568-
$this->customerManagement->validateAddresses($quote);
569568
}
570569
$this->customerManagement->populateCustomerInfo($quote);
571570
}
571+
$this->customerManagement->validateAddresses($quote);
572572
$addresses = [];
573573
$quote->reserveOrderId();
574574
if ($quote->isVirtual()) {

0 commit comments

Comments
 (0)