Skip to content

Commit fe99499

Browse files
authored
Merge pull request #9566 from magento-gl/spartans_pr_02022025_AC-13828-v1
[Spartans] BugFix Delivery
2 parents 6ebafe5 + 301d10e commit fe99499

File tree

3 files changed

+34
-21
lines changed

3 files changed

+34
-21
lines changed

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -607,25 +607,6 @@ class Config extends AbstractConfig
607607
*/
608608
protected $cspNonceProvider;
609609

610-
/**
611-
* Payment methods to skip address validation
612-
*/
613-
public const PAYMENT_METHODS_SKIP_ADDRESS_VALIDATION = [
614-
self::METHOD_EXPRESS,
615-
self::METHOD_WPS_EXPRESS,
616-
self::METHOD_WPS_BML,
617-
self::METHOD_WPP_BML,
618-
self::METHOD_WPP_DIRECT,
619-
self::METHOD_PAYMENT_PRO,
620-
self::METHOD_WPP_PE_EXPRESS,
621-
self::METHOD_WPP_PE_BML,
622-
self::METHOD_PAYFLOWPRO,
623-
self::METHOD_PAYFLOWLINK,
624-
self::METHOD_PAYFLOWADVANCED,
625-
self::METHOD_HOSTEDPRO,
626-
self::METHOD_BILLING_AGREEMENT
627-
];
628-
629610
/**
630611
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
631612
* @param \Magento\Directory\Helper\Data $directoryHelper

app/code/Magento/Paypal/Plugin/CustomerManagementPlugin.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,26 @@
99

1010
use Magento\Quote\Model\CustomerManagement;
1111
use Magento\Quote\Model\Quote as QuoteEntity;
12-
use Magento\Paypal\Model\Config as PaymentMethodConfig;
1312

1413
/**
1514
* Skip billing address validation for PayPal payment method
1615
*/
1716
class CustomerManagementPlugin
1817
{
18+
/**
19+
* @var array
20+
*/
21+
private $paymentMethodSkipAddressValidation;
22+
23+
/**
24+
* PaymentMethodSkipAddressValidation constructor.
25+
* @param array $paymentMethodSkipAddressValidation
26+
*/
27+
public function __construct($paymentMethodSkipAddressValidation = [])
28+
{
29+
$this->paymentMethodSkipAddressValidation = $paymentMethodSkipAddressValidation;
30+
}
31+
1932
/**
2033
* Around plugin for the validateAddresses method
2134
*
@@ -28,7 +41,7 @@ class CustomerManagementPlugin
2841
public function aroundValidateAddresses(CustomerManagement $subject, \Closure $proceed, QuoteEntity $quote)
2942
{
3043
if ($quote->getCustomerIsGuest() &&
31-
in_array($quote->getPayment()->getMethod(), PaymentMethodConfig::PAYMENT_METHODS_SKIP_ADDRESS_VALIDATION)) {
44+
in_array($quote->getPayment()->getMethod(), $this->paymentMethodSkipAddressValidation)) {
3245
return;
3346
}
3447
$proceed($quote);

app/code/Magento/Paypal/etc/di.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,23 @@
272272
<type name="Magento\Quote\Model\CustomerManagement">
273273
<plugin name="paypal_payment_skip_addresses_validate" type="Magento\Paypal\Plugin\CustomerManagementPlugin"/>
274274
</type>
275+
<type name="Magento\Paypal\Plugin\CustomerManagementPlugin">
276+
<arguments>
277+
<argument name="paymentMethodSkipAddressValidation" xsi:type="array">
278+
<item name="paypal_express" xsi:type="string">paypal_express</item>
279+
<item name="wps_express" xsi:type="string">wps_express</item>
280+
<item name="wps_express_bml" xsi:type="string">wps_express_bml</item>
281+
<item name="paypal_express_bml" xsi:type="string">paypal_express_bml</item>
282+
<item name="paypal_direct" xsi:type="string">paypal_direct</item>
283+
<item name="paypal_payment_pro" xsi:type="string">paypal_payment_pro</item>
284+
<item name="payflow_express" xsi:type="string">payflow_express</item>
285+
<item name="payflow_express_bml" xsi:type="string">payflow_express_bml</item>
286+
<item name="payflowpro" xsi:type="string">payflowpro</item>
287+
<item name="payflow_link" xsi:type="string">payflow_link</item>
288+
<item name="payflow_advanced" xsi:type="string">payflow_advanced</item>
289+
<item name="hosted_pro" xsi:type="string">hosted_pro</item>
290+
<item name="paypal_billing_agreement" xsi:type="string">paypal_billing_agreement</item>
291+
</argument>
292+
</arguments>
293+
</type>
275294
</config>

0 commit comments

Comments
 (0)