Skip to content

Commit

Permalink
Merge pull request #9566 from magento-gl/spartans_pr_02022025_AC-1382…
Browse files Browse the repository at this point in the history
…8-v1

[Spartans] BugFix Delivery
  • Loading branch information
sidolov authored Feb 3, 2025
2 parents 6ebafe5 + 301d10e commit fe99499
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 21 deletions.
19 changes: 0 additions & 19 deletions app/code/Magento/Paypal/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,25 +607,6 @@ class Config extends AbstractConfig
*/
protected $cspNonceProvider;

/**
* Payment methods to skip address validation
*/
public const PAYMENT_METHODS_SKIP_ADDRESS_VALIDATION = [
self::METHOD_EXPRESS,
self::METHOD_WPS_EXPRESS,
self::METHOD_WPS_BML,
self::METHOD_WPP_BML,
self::METHOD_WPP_DIRECT,
self::METHOD_PAYMENT_PRO,
self::METHOD_WPP_PE_EXPRESS,
self::METHOD_WPP_PE_BML,
self::METHOD_PAYFLOWPRO,
self::METHOD_PAYFLOWLINK,
self::METHOD_PAYFLOWADVANCED,
self::METHOD_HOSTEDPRO,
self::METHOD_BILLING_AGREEMENT
];

/**
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Directory\Helper\Data $directoryHelper
Expand Down
17 changes: 15 additions & 2 deletions app/code/Magento/Paypal/Plugin/CustomerManagementPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,26 @@

use Magento\Quote\Model\CustomerManagement;
use Magento\Quote\Model\Quote as QuoteEntity;
use Magento\Paypal\Model\Config as PaymentMethodConfig;

/**
* Skip billing address validation for PayPal payment method
*/
class CustomerManagementPlugin
{
/**
* @var array
*/
private $paymentMethodSkipAddressValidation;

/**
* PaymentMethodSkipAddressValidation constructor.
* @param array $paymentMethodSkipAddressValidation
*/
public function __construct($paymentMethodSkipAddressValidation = [])
{
$this->paymentMethodSkipAddressValidation = $paymentMethodSkipAddressValidation;
}

/**
* Around plugin for the validateAddresses method
*
Expand All @@ -28,7 +41,7 @@ class CustomerManagementPlugin
public function aroundValidateAddresses(CustomerManagement $subject, \Closure $proceed, QuoteEntity $quote)
{
if ($quote->getCustomerIsGuest() &&
in_array($quote->getPayment()->getMethod(), PaymentMethodConfig::PAYMENT_METHODS_SKIP_ADDRESS_VALIDATION)) {
in_array($quote->getPayment()->getMethod(), $this->paymentMethodSkipAddressValidation)) {
return;
}
$proceed($quote);
Expand Down
19 changes: 19 additions & 0 deletions app/code/Magento/Paypal/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,23 @@
<type name="Magento\Quote\Model\CustomerManagement">
<plugin name="paypal_payment_skip_addresses_validate" type="Magento\Paypal\Plugin\CustomerManagementPlugin"/>
</type>
<type name="Magento\Paypal\Plugin\CustomerManagementPlugin">
<arguments>
<argument name="paymentMethodSkipAddressValidation" xsi:type="array">
<item name="paypal_express" xsi:type="string">paypal_express</item>
<item name="wps_express" xsi:type="string">wps_express</item>
<item name="wps_express_bml" xsi:type="string">wps_express_bml</item>
<item name="paypal_express_bml" xsi:type="string">paypal_express_bml</item>
<item name="paypal_direct" xsi:type="string">paypal_direct</item>
<item name="paypal_payment_pro" xsi:type="string">paypal_payment_pro</item>
<item name="payflow_express" xsi:type="string">payflow_express</item>
<item name="payflow_express_bml" xsi:type="string">payflow_express_bml</item>
<item name="payflowpro" xsi:type="string">payflowpro</item>
<item name="payflow_link" xsi:type="string">payflow_link</item>
<item name="payflow_advanced" xsi:type="string">payflow_advanced</item>
<item name="hosted_pro" xsi:type="string">hosted_pro</item>
<item name="paypal_billing_agreement" xsi:type="string">paypal_billing_agreement</item>
</argument>
</arguments>
</type>
</config>

0 comments on commit fe99499

Please sign in to comment.