Skip to content

Commit 1cf0258

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #18372: Resolve typo despatch event (by @neeta-wagento) - #18863: [Backport] #17744 Adding logic to get default billing address used on Cart and Checkout (by @gelanivishal) - #18870: [Backport] ISSUE-5021 - fixed place order for custom shipping methods with under� (by @gelanivishal) - #18872: [Backport] Allow set billing information via API with existing address (by @gelanivishal) Fixed GitHub Issues: - #18355: Typo in dispatched event name (reported by @MTheProgrammer) has been fixed in #18372 by @neeta-wagento in 2.2-develop branch Related commits: 1. 5937495 2. e878105 3. 6178035 4. 2647a89 - #17744: Virtual-only quotes use default shipping address for estimation instead of default billing address (reported by @navarr) has been fixed in #18863 by @gelanivishal in 2.2-develop branch Related commits: 1. b57ae01 2. f7a8160 3. f3f9cff 4. 3836bd2 5. d88d133 6. 7116fed - #5021: "Please specify a shipping method" Exception (reported by @vphat28) has been fixed in #18870 by @gelanivishal in 2.2-develop branch Related commits: 1. 70cebbd - #17485: Adding billing information via mine API expects costumer id (reported by @wittyvishwas) has been fixed in #18872 by @gelanivishal in 2.2-develop branch Related commits: 1. fdf855c
2 parents cfba0e1 + ecaa4c2 commit 1cf0258

File tree

8 files changed

+50
-9
lines changed

8 files changed

+50
-9
lines changed

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,20 @@ public function getSearchableAttributes($backendType = null)
316316
/** @var \Magento\Eav\Model\Entity\Attribute[] $attributes */
317317
$attributes = $productAttributes->getItems();
318318

319+
/**
320+
* @deprecated Event argument catelogsearch_searchable_attributes_load_after.
321+
* @see catalogsearch_searchable_attributes_load_after instead.
322+
*/
319323
$this->eventManager->dispatch(
320324
'catelogsearch_searchable_attributes_load_after',
321325
['engine' => $this->engine, 'attributes' => $attributes]
322326
);
323327

328+
$this->eventManager->dispatch(
329+
'catalogsearch_searchable_attributes_load_after',
330+
['engine' => $this->engine, 'attributes' => $attributes]
331+
);
332+
324333
$entity = $this->eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY)->getEntity();
325334

326335
foreach ($attributes as $attribute) {

app/code/Magento/Checkout/Model/PaymentInformationManagement.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ public function savePaymentInformation(
114114
$quote->setDataChanges(true);
115115
$shippingAddress = $quote->getShippingAddress();
116116
if ($shippingAddress && $shippingAddress->getShippingMethod()) {
117-
$shippingDataArray = explode('_', $shippingAddress->getShippingMethod());
118-
$shippingCarrier = array_shift($shippingDataArray);
119-
$shippingAddress->setLimitCarrier($shippingCarrier);
117+
$shippingRate = $shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod());
118+
$shippingAddress->setLimitCarrier($shippingRate->getCarrier());
120119
}
121120
}
122121
$this->paymentMethodManagement->set($cartId, $paymentMethod);

app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,11 @@ private function getMockForAssignBillingAddress($cartId, $billingAddressMock)
168168
$billingAddressId = 1;
169169
$quoteMock = $this->createMock(\Magento\Quote\Model\Quote::class);
170170
$quoteBillingAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class);
171+
$shippingRate = $this->createPartialMock(\Magento\Quote\Model\Quote\Address\Rate::class, []);
172+
$shippingRate->setCarrier('flatrate');
171173
$quoteShippingAddress = $this->createPartialMock(
172174
\Magento\Quote\Model\Quote\Address::class,
173-
['setLimitCarrier', 'getShippingMethod']
175+
['setLimitCarrier', 'getShippingMethod', 'getShippingRateByCode']
174176
);
175177
$this->cartRepositoryMock->expects($this->any())->method('getActive')->with($cartId)->willReturn($quoteMock);
176178
$quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($quoteBillingAddress);
@@ -179,6 +181,7 @@ private function getMockForAssignBillingAddress($cartId, $billingAddressMock)
179181
$quoteMock->expects($this->once())->method('removeAddress')->with($billingAddressId);
180182
$quoteMock->expects($this->once())->method('setBillingAddress')->with($billingAddressMock);
181183
$quoteMock->expects($this->once())->method('setDataChanges')->willReturnSelf();
184+
$quoteShippingAddress->expects($this->any())->method('getShippingRateByCode')->willReturn($shippingRate);
182185
$quoteShippingAddress->expects($this->any())->method('getShippingMethod')->willReturn('flatrate_flatrate');
183186
$quoteShippingAddress->expects($this->once())->method('setLimitCarrier')->with('flatrate')->willReturnSelf();
184187
}

app/code/Magento/Checkout/view/frontend/web/js/model/checkout-data-resolver.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,31 @@ define([
218218
* Apply resolved billing address to quote
219219
*/
220220
applyBillingAddress: function () {
221-
var shippingAddress;
221+
var shippingAddress,
222+
isBillingAddressInitialized;
222223

223224
if (quote.billingAddress()) {
224225
selectBillingAddress(quote.billingAddress());
225226

226227
return;
227228
}
229+
230+
if (quote.isVirtual()) {
231+
isBillingAddressInitialized = addressList.some(function (addrs) {
232+
if (addrs.isDefaultBilling()) {
233+
selectBillingAddress(addrs);
234+
235+
return true;
236+
}
237+
238+
return false;
239+
});
240+
}
241+
228242
shippingAddress = quote.shippingAddress();
229243

230-
if (shippingAddress &&
244+
if (!isBillingAddressInitialized &&
245+
shippingAddress &&
231246
shippingAddress.canUseForBilling() &&
232247
(shippingAddress.isDefaultShipping() || !quote.isVirtual())
233248
) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres
7676
{
7777
/** @var \Magento\Quote\Model\Quote $quote */
7878
$quote = $this->quoteRepository->getActive($cartId);
79+
$address->setCustomerId($quote->getCustomerId());
7980
$quote->removeAddress($quote->getBillingAddress()->getId());
8081
$quote->setBillingAddress($address);
8182
try {

dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ define([
1919
billingAddress: ko.observable(),
2020
shippingAddress: ko.observable(),
2121
paymentMethod: ko.observable(),
22-
totals: ko.observable({})
22+
totals: ko.observable({}),
23+
24+
/** Stub */
25+
isVirtual: function () {
26+
return false;
27+
}
2328
},
2429
'Magento_Braintree/js/view/payment/validator-handler': jasmine.createSpyObj(
2530
'validator-handler',

dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/paypal.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ define([
2424
paymentMethod: ko.observable(),
2525
totals: ko.observable({
2626
'base_grand_total': 0
27-
})
27+
}),
28+
29+
/** Stub */
30+
isVirtual: function () {
31+
return false;
32+
}
2833
},
2934
'Magento_Braintree/js/view/payment/adapter': {
3035
config: {},

dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ define([
2828
billingAddress: ko.observable(),
2929
shippingAddress: ko.observable(),
3030
paymentMethod: ko.observable(),
31-
totals: ko.observable({})
31+
totals: ko.observable({}),
3232

33+
/** Stub */
34+
isVirtual: function () {
35+
return false;
36+
}
3337
},
3438
'Magento_Checkout/js/action/set-payment-information': setPaymentMock,
3539
'Magento_Checkout/js/model/payment/additional-validators': {

0 commit comments

Comments
 (0)