Skip to content

Commit f8f827c

Browse files
committed
MC-31387: Paypal issue with region on 2.3.4
1 parent 1da64c2 commit f8f827c

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

patches.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@
238238
},
239239
"Fix for multi-site configuration issue": {
240240
"2.2.4": "MAGETWO-92926__fix_for_multi-site_configuration_issue__2.2.4.patch"
241+
},
242+
"Fix PayPal issue with region": {
243+
"2.3.4": "MC-31387__fix_paypal_issue_with_region__2.3.4.patch"
241244
}
242245
},
243246
"monolog/monolog": {
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
diff -Nuar a/vendor/magento/module-paypal/Model/Api/Nvp.php b/vendor/magento/module-paypal/Model/Api/Nvp.php
2+
--- a/vendor/magento/module-paypal/Model/Api/Nvp.php
3+
+++ b/vendor/magento/module-paypal/Model/Api/Nvp.php
4+
@@ -1512,17 +1512,17 @@
5+
}
6+
// attempt to fetch region_id from directory
7+
if ($address->getCountryId() && $address->getRegion()) {
8+
- $regions = $this->_countryFactory->create()->loadByCode(
9+
- $address->getCountryId()
10+
- )->getRegionCollection()->addRegionCodeOrNameFilter(
11+
- $address->getRegion()
12+
- )->setPageSize(
13+
- 1
14+
- );
15+
+ $regions = $this->_countryFactory->create()
16+
+ ->getRegionCollection()
17+
+ ->addCountryFilter($address->getCountryId())
18+
+ ->addRegionCodeOrNameFilter($address->getRegion())
19+
+ ->setPageSize(1);
20+
$regionItems = $regions->getItems();
21+
- $region = array_shift($regionItems);
22+
- $address->setRegionId($region->getId());
23+
- $address->setExportedKeys(array_merge($address->getExportedKeys(), ['region_id']));
24+
+ if (count($regionItems)) {
25+
+ $region = array_shift($regionItems);
26+
+ $address->setRegionId($region->getId());
27+
+ $address->setExportedKeys(array_merge($address->getExportedKeys(), ['region_id']));
28+
+ }
29+
}
30+
}
31+
32+
@@ -1624,7 +1624,7 @@
33+
case 'year':
34+
return 'Year';
35+
default:
36+
- break;
37+
+ return '';
38+
}
39+
}
40+
41+
@@ -1653,7 +1653,7 @@
42+
case 'active':
43+
return 'Active';
44+
default:
45+
- break;
46+
+ return '';
47+
}
48+
}
49+
50+
@@ -1694,7 +1694,7 @@
51+
case 'Voided':
52+
return \Magento\Paypal\Model\Info::PAYMENTSTATUS_VOIDED;
53+
default:
54+
- break;
55+
+ return null;
56+
}
57+
}
58+
59+
@@ -1712,7 +1712,7 @@
60+
case \Magento\Paypal\Model\Pro::PAYMENT_REVIEW_DENY:
61+
return 'Deny';
62+
default:
63+
- break;
64+
+ return null;
65+
}
66+
}
67+

0 commit comments

Comments
 (0)