Skip to content

Commit

Permalink
ENGCOM-3315: [Backport] ISSUE-5021 - fixed place order for custom shi…
Browse files Browse the repository at this point in the history
…pping methods with under… #18870
  • Loading branch information
Stanislav Idolov authored Oct 31, 2018
2 parents 0ddb881 + df0e0be commit a2db268
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ public function savePaymentInformation(
$quote->setDataChanges(true);
$shippingAddress = $quote->getShippingAddress();
if ($shippingAddress && $shippingAddress->getShippingMethod()) {
$shippingDataArray = explode('_', $shippingAddress->getShippingMethod());
$shippingCarrier = array_shift($shippingDataArray);
$shippingAddress->setLimitCarrier($shippingCarrier);
$shippingRate = $shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod());
$shippingAddress->setLimitCarrier($shippingRate->getCarrier());
}
}
$this->paymentMethodManagement->set($cartId, $paymentMethod);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ private function getMockForAssignBillingAddress($cartId, $billingAddressMock)
$billingAddressId = 1;
$quoteMock = $this->createMock(\Magento\Quote\Model\Quote::class);
$quoteBillingAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class);
$shippingRate = $this->createPartialMock(\Magento\Quote\Model\Quote\Address\Rate::class, []);
$shippingRate->setCarrier('flatrate');
$quoteShippingAddress = $this->createPartialMock(
\Magento\Quote\Model\Quote\Address::class,
['setLimitCarrier', 'getShippingMethod']
['setLimitCarrier', 'getShippingMethod', 'getShippingRateByCode']
);
$this->cartRepositoryMock->expects($this->any())->method('getActive')->with($cartId)->willReturn($quoteMock);
$quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($quoteBillingAddress);
Expand All @@ -179,6 +181,7 @@ private function getMockForAssignBillingAddress($cartId, $billingAddressMock)
$quoteMock->expects($this->once())->method('removeAddress')->with($billingAddressId);
$quoteMock->expects($this->once())->method('setBillingAddress')->with($billingAddressMock);
$quoteMock->expects($this->once())->method('setDataChanges')->willReturnSelf();
$quoteShippingAddress->expects($this->any())->method('getShippingRateByCode')->willReturn($shippingRate);
$quoteShippingAddress->expects($this->any())->method('getShippingMethod')->willReturn('flatrate_flatrate');
$quoteShippingAddress->expects($this->once())->method('setLimitCarrier')->with('flatrate')->willReturnSelf();
}
Expand Down

0 comments on commit a2db268

Please sign in to comment.