Skip to content

Commit a1fa332

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents dd164c9 + 74ebef8 commit a1fa332

File tree

9 files changed

+174
-82
lines changed

9 files changed

+174
-82
lines changed

app/code/Magento/Paypal/Controller/Express/AbstractExpress/ShippingOptionsCallback.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@
66
*/
77
namespace Magento\Paypal\Controller\Express\AbstractExpress;
88

9-
class ShippingOptionsCallback extends \Magento\Paypal\Controller\Express\AbstractExpress
9+
use Magento\Framework\App\CsrfAwareActionInterface;
10+
use Magento\Paypal\Controller\Express\AbstractExpress;
11+
use Magento\Framework\App\Request\InvalidRequestException;
12+
use Magento\Framework\App\RequestInterface;
13+
14+
/**
15+
* Returns shipping rates by server-to-server request from PayPal.
16+
*
17+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18+
*/
19+
class ShippingOptionsCallback extends AbstractExpress implements CsrfAwareActionInterface
1020
{
1121
/**
1222
* @var \Magento\Quote\Api\CartRepositoryInterface
@@ -65,4 +75,21 @@ public function execute()
6575
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
6676
}
6777
}
78+
79+
/**
80+
* @inheritDoc
81+
*/
82+
public function createCsrfValidationException(
83+
RequestInterface $request
84+
): ?InvalidRequestException {
85+
return null;
86+
}
87+
88+
/**
89+
* @inheritDoc
90+
*/
91+
public function validateForCsrf(RequestInterface $request): ?bool
92+
{
93+
return true;
94+
}
6895
}

app/code/Magento/Paypal/Model/Express/Checkout.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,7 @@ protected static function cmpShippingOptions(DataObject $option1, DataObject $op
10761076
*/
10771077
protected function _matchShippingMethodCode(Address $address, $selectedCode)
10781078
{
1079+
$address->collectShippingRates();
10791080
$options = $this->_prepareShippingOptions($address, false);
10801081
foreach ($options as $option) {
10811082
if ($selectedCode === $option['code'] // the proper case as outlined in documentation

app/code/Magento/SalesRule/Model/Validator.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ protected function _getRules(Address $address = null)
182182
}
183183

184184
/**
185+
* Address id getter.
186+
*
185187
* @param Address $address
186188
* @return string
187189
*/
@@ -327,21 +329,7 @@ public function processShippingAmount(Address $address)
327329
$baseDiscountAmount = $rule->getDiscountAmount();
328330
break;
329331
case \Magento\SalesRule\Model\Rule::CART_FIXED_ACTION:
330-
$cartRules = $address->getCartFixedRules();
331-
if (!isset($cartRules[$rule->getId()])) {
332-
$cartRules[$rule->getId()] = $rule->getDiscountAmount();
333-
}
334-
if ($cartRules[$rule->getId()] > 0) {
335-
$quoteAmount = $this->priceCurrency->convert($cartRules[$rule->getId()], $quote->getStore());
336-
$discountAmount = min($shippingAmount - $address->getShippingDiscountAmount(), $quoteAmount);
337-
$baseDiscountAmount = min(
338-
$baseShippingAmount - $address->getBaseShippingDiscountAmount(),
339-
$cartRules[$rule->getId()]
340-
);
341-
$cartRules[$rule->getId()] -= $baseDiscountAmount;
342-
}
343-
344-
$address->setCartFixedRules($cartRules);
332+
// Shouldn't be proceed according to MAGETWO-96403
345333
break;
346334
}
347335

@@ -519,6 +507,8 @@ public function sortItemsByPriority($items, Address $address = null)
519507
}
520508

521509
/**
510+
* Rule total items getter.
511+
*
522512
* @param int $key
523513
* @return array
524514
* @throws \Magento\Framework\Exception\LocalizedException
@@ -533,6 +523,8 @@ public function getRuleItemTotalsInfo($key)
533523
}
534524

535525
/**
526+
* Decrease rule items count.
527+
*
536528
* @param int $key
537529
* @return $this
538530
*/

0 commit comments

Comments
 (0)