diff --git a/patches.json b/patches.json index a64fce0..37af3ae 100644 --- a/patches.json +++ b/patches.json @@ -238,6 +238,9 @@ }, "Fix for multi-site configuration issue": { "2.2.4": "MAGETWO-92926__fix_for_multi-site_configuration_issue__2.2.4.patch" + }, + "Fix PayPal issue with region": { + "2.3.4": "MC-31387__fix_paypal_issue_with_region__2.3.4.patch" } }, "monolog/monolog": { diff --git a/patches/MC-31387__fix_paypal_issue_with_region__2.3.4.patch b/patches/MC-31387__fix_paypal_issue_with_region__2.3.4.patch new file mode 100644 index 0000000..2e7849c --- /dev/null +++ b/patches/MC-31387__fix_paypal_issue_with_region__2.3.4.patch @@ -0,0 +1,67 @@ +diff -Nuar a/vendor/magento/module-paypal/Model/Api/Nvp.php b/vendor/magento/module-paypal/Model/Api/Nvp.php +--- a/vendor/magento/module-paypal/Model/Api/Nvp.php ++++ b/vendor/magento/module-paypal/Model/Api/Nvp.php +@@ -1512,17 +1512,17 @@ + } + // attempt to fetch region_id from directory + if ($address->getCountryId() && $address->getRegion()) { +- $regions = $this->_countryFactory->create()->loadByCode( +- $address->getCountryId() +- )->getRegionCollection()->addRegionCodeOrNameFilter( +- $address->getRegion() +- )->setPageSize( +- 1 +- ); ++ $regions = $this->_countryFactory->create() ++ ->getRegionCollection() ++ ->addCountryFilter($address->getCountryId()) ++ ->addRegionCodeOrNameFilter($address->getRegion()) ++ ->setPageSize(1); + $regionItems = $regions->getItems(); +- $region = array_shift($regionItems); +- $address->setRegionId($region->getId()); +- $address->setExportedKeys(array_merge($address->getExportedKeys(), ['region_id'])); ++ if (count($regionItems)) { ++ $region = array_shift($regionItems); ++ $address->setRegionId($region->getId()); ++ $address->setExportedKeys(array_merge($address->getExportedKeys(), ['region_id'])); ++ } + } + } + +@@ -1624,7 +1624,7 @@ + case 'year': + return 'Year'; + default: +- break; ++ return ''; + } + } + +@@ -1653,7 +1653,7 @@ + case 'active': + return 'Active'; + default: +- break; ++ return ''; + } + } + +@@ -1694,7 +1694,7 @@ + case 'Voided': + return \Magento\Paypal\Model\Info::PAYMENTSTATUS_VOIDED; + default: +- break; ++ return null; + } + } + +@@ -1712,7 +1712,7 @@ + case \Magento\Paypal\Model\Pro::PAYMENT_REVIEW_DENY: + return 'Deny'; + default: +- break; ++ return null; + } + } +