Skip to content

Commit a592797

Browse files
1.1.63 Release (#194)
* 1.1.63 Release - bumped version in composer.json - updated patches-info.json - added new patches for the 1.1.63 Release * 1.1.63 Release - updated patches-info.json - added new patches for the 1.1.63 Release * add newly released versions: 2.4.8, 2.4.7-p5, 2.4.6-p10, 2.4.5-p12, 2.4.4-p13 * 1.1.62 Release - Removed ACP2E-3652 - Updated constraints for ACSD-58054 * 1.1.63 Release - updated versions for ACSD-48234 - updated patches-info.json * 1.1.62 Release - Renamed ACPE-3651 according to Jira - Added metadata for ACSD-65195 * 1.1.63 Release - Updated patches-info.json * 1.1.63 Release - Removed ACP2E-3769 patch * 1.1.63 Release - Removed ACP2E-3651 patch * 1.1.63 Release - Updated constraints for ACSD-58054 * 1.1.63 Release - Updated patches-info.json --------- Co-authored-by: Oleksandr Gorbivskyi <gorbivsk@adobe.com>
1 parent 24a3edd commit a592797

File tree

10 files changed

+5301
-6
lines changed

10 files changed

+5301
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/quality-patches",
33
"description": "Provides quality patches for AdobeCommerce & Magento OpenSource",
44
"type": "magento2-component",
5-
"version": "1.1.62",
5+
"version": "1.1.63",
66
"license": "proprietary",
77
"repositories": {
88
"repo": {

patches-info.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

patches/commerce/ACSD-64627_1.5.0.patch

Lines changed: 2091 additions & 0 deletions
Large diffs are not rendered by default.

patches/commerce/ACSD-65084_1.5.1.patch

Lines changed: 2141 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
diff --git a/vendor/magento/module-company-graph-ql/Model/Company/PrepareCompanyData.php b/vendor/magento/module-company-graph-ql/Model/Company/PrepareCompanyData.php
2+
index 0b7630e9fe6b..b369bf6af119 100644
3+
--- a/vendor/magento/module-company-graph-ql/Model/Company/PrepareCompanyData.php
4+
+++ b/vendor/magento/module-company-graph-ql/Model/Company/PrepareCompanyData.php
5+
@@ -1,13 +1,28 @@
6+
<?php
7+
-/**
8+
- * Copyright © Magento, Inc. All rights reserved.
9+
- * See COPYING.txt for license details.
10+
+/************************************************************************
11+
+ *
12+
+ * ADOBE CONFIDENTIAL
13+
+ * ___________________
14+
+ *
15+
+ * Copyright 2020 Adobe
16+
+ * All Rights Reserved.
17+
+ *
18+
+ * NOTICE: All information contained herein is, and remains
19+
+ * the property of Adobe and its suppliers, if any. The intellectual
20+
+ * and technical concepts contained herein are proprietary to Adobe
21+
+ * and its suppliers and are protected by all applicable intellectual
22+
+ * property laws, including trade secret and copyright laws.
23+
+ * Dissemination of this information or reproduction of this material
24+
+ * is strictly forbidden unless prior written permission is obtained
25+
+ * from Adobe.
26+
+ * ************************************************************************
27+
*/
28+
declare(strict_types=1);
29+
30+
namespace Magento\CompanyGraphQl\Model\Company;
31+
32+
use Magento\CompanyGraphQl\Model\Company\Address\RegionLoader;
33+
+use Magento\Directory\Helper\Data;
34+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
35+
36+
/**
37+
@@ -22,9 +37,11 @@ class PrepareCompanyData
38+
39+
/**
40+
* @param RegionLoader $loadRegion
41+
+ * @param Data $directoryData
42+
*/
43+
public function __construct(
44+
- RegionLoader $loadRegion
45+
+ RegionLoader $loadRegion,
46+
+ private Data $directoryData
47+
) {
48+
$this->loadRegion = $loadRegion;
49+
}
50+
@@ -37,43 +54,106 @@ public function __construct(
51+
* @throws GraphQlInputException
52+
*/
53+
public function execute(array $companyData): array
54+
+ {
55+
+ $companyData = $this->mergeCompanyAdminData($companyData);
56+
+ $companyData = $this->mergeLegalAddressData($companyData);
57+
+
58+
+ return $companyData;
59+
+ }
60+
+
61+
+ /**
62+
+ * Merge company admin data into company data.
63+
+ *
64+
+ * @param array $companyData
65+
+ * @return array
66+
+ */
67+
+ private function mergeCompanyAdminData(array $companyData): array
68+
{
69+
if (!empty($companyData['company_admin'])) {
70+
- $companyData = array_merge($companyData, $companyData['company_admin']);
71+
+ return array_merge($companyData, $companyData['company_admin']);
72+
}
73+
+ return $companyData;
74+
+ }
75+
76+
- if (!empty($companyData['legal_address'])) {
77+
- $addressData = $companyData['legal_address'];
78+
- unset($companyData['legal_address']);
79+
- $companyData = array_merge($companyData, $addressData);
80+
-
81+
- if (!empty($companyData['region'])) {
82+
- $regionData = $addressData['region'];
83+
- unset($companyData['region']);
84+
- $companyData = array_merge($companyData, $regionData);
85+
- if (!isset($regionData['region_id'])) {
86+
- $region = $this->loadRegion->execute(
87+
- $addressData['country_id'] ?? null,
88+
- $regionData['region_id'] ?? null,
89+
- $regionData['region_code'] ?? null,
90+
- $regionData['region'] ?? null
91+
- );
92+
- if ($region && $region->getRegionId()) {
93+
- $companyData['region_id'] = $region->getRegionId();
94+
- } else {
95+
- throw new GraphQlInputException(
96+
- __(
97+
- 'Invalid value of "%1" provided for the %2 field.',
98+
- isset($regionData['region_code']) ? $regionData['region_code'] : $regionData['region'],
99+
- isset($regionData['region_code']) ? 'region_code' : 'region'
100+
- )
101+
- );
102+
- }
103+
- }
104+
-
105+
- }
106+
+ /**
107+
+ * Merge legal address data into company data.
108+
+ *
109+
+ * @param array $companyData
110+
+ * @return array
111+
+ * @throws GraphQlInputException
112+
+ */
113+
+ private function mergeLegalAddressData(array $companyData): array
114+
+ {
115+
+ if (empty($companyData['legal_address'])) {
116+
+ return $companyData;
117+
}
118+
119+
- return $companyData;
120+
+ $addressData = $companyData['legal_address'];
121+
+ unset($companyData['legal_address']);
122+
+ $companyData = array_merge($companyData, $addressData);
123+
+
124+
+ return $this->handleRegionData($companyData, $addressData);
125+
+ }
126+
+
127+
+ /**
128+
+ * Handle region data.
129+
+ *
130+
+ * @param array $companyData
131+
+ * @param array $addressData
132+
+ * @return array
133+
+ * @throws GraphQlInputException
134+
+ */
135+
+ private function handleRegionData(array $companyData, array $addressData): array
136+
+ {
137+
+ if (empty($addressData['region'])) {
138+
+ $companyData['region'] = '';
139+
+ return $companyData;
140+
+ }
141+
+
142+
+ $regionData = $addressData['region'];
143+
+ unset($companyData['region']);
144+
+ $companyData = array_merge($companyData, $regionData);
145+
+
146+
+ return $this->processRegionValidation($companyData, $addressData, $regionData);
147+
+ }
148+
+
149+
+ /**
150+
+ * Process region validation.
151+
+ *
152+
+ * @param array $companyData
153+
+ * @param array $addressData
154+
+ * @param array $regionData
155+
+ * @return array
156+
+ * @throws GraphQlInputException
157+
+ */
158+
+ private function processRegionValidation(array $companyData, array $addressData, array $regionData): array
159+
+ {
160+
+ if (!$this->directoryData->isRegionRequired($addressData['country_id'])) {
161+
+ return $companyData;
162+
+ }
163+
+
164+
+ if (isset($regionData['region_id'])) {
165+
+ return $companyData;
166+
+ }
167+
+
168+
+ $region = $this->loadRegion->execute(
169+
+ $addressData['country_id'] ?? null,
170+
+ $regionData['region_id'] ?? null,
171+
+ $regionData['region_code'] ?? null,
172+
+ $regionData['region'] ?? null
173+
+ );
174+
+
175+
+ if ($region && $region->getRegionId()) {
176+
+ $companyData['region_id'] = $region->getRegionId();
177+
+ return $companyData;
178+
+ }
179+
+
180+
+ throw new GraphQlInputException(
181+
+ __(
182+
+ 'Invalid value of "%1" provided for the %2 field.',
183+
+ $regionData['region_code'] ?? $regionData['region'],
184+
+ isset($regionData['region_code']) ? 'region_code' : 'region'
185+
+ )
186+
+ );
187+
}
188+
}
189+
diff --git a/vendor/magento/module-company-graph-ql/Model/Resolver/Company/LegalAddress.php b/vendor/magento/module-company-graph-ql/Model/Resolver/Company/LegalAddress.php
190+
index d3d8d24355b0..3d19a2a36f1d 100644
191+
--- a/vendor/magento/module-company-graph-ql/Model/Resolver/Company/LegalAddress.php
192+
+++ b/vendor/magento/module-company-graph-ql/Model/Resolver/Company/LegalAddress.php
193+
@@ -8,8 +8,10 @@
194+
namespace Magento\CompanyGraphQl\Model\Resolver\Company;
195+
196+
use Magento\CompanyGraphQl\Model\Company\ResolverAccess;
197+
+use Magento\Directory\Helper\Data;
198+
use Magento\Directory\Model\RegionFactory;
199+
use Magento\Directory\Model\ResourceModel\Region;
200+
+use Magento\Framework\App\ObjectManager;
201+
use Magento\Framework\Exception\LocalizedException;
202+
use Magento\Framework\GraphQl\Config\Element\Field;
203+
use Magento\Framework\GraphQl\Query\ResolverInterface;
204+
@@ -45,17 +47,20 @@ class LegalAddress implements ResolverInterface
205+
* @param RegionFactory $regionFactory
206+
* @param ResolverAccess $resolverAccess
207+
* @param array $allowedResources
208+
+ * @param Data|null $directoryData
209+
*/
210+
public function __construct(
211+
Region $regionResource,
212+
RegionFactory $regionFactory,
213+
ResolverAccess $resolverAccess,
214+
- array $allowedResources = []
215+
+ array $allowedResources = [],
216+
+ private ?Data $directoryData = null
217+
) {
218+
$this->regionResource = $regionResource;
219+
$this->regionFactory = $regionFactory;
220+
$this->resolverAccess = $resolverAccess;
221+
$this->allowedResources = $allowedResources;
222+
+ $this->directoryData = $directoryData ?? ObjectManager::getInstance()->get(Data::class);
223+
}
224+
225+
/**
226+
@@ -77,8 +82,13 @@ public function resolve(
227+
}
228+
229+
$company = $value['model'];
230+
+
231+
$region = $this->regionFactory->create();
232+
- $this->regionResource->load($region, $company->getRegionId());
233+
+ if ($this->directoryData->isRegionRequired($company->getCountryId())) {
234+
+ $this->regionResource->load($region, $company->getRegionId());
235+
+ } elseif ($company->getRegion()) {
236+
+ $region->setName($company->getRegion());
237+
+ }
238+
239+
return [
240+
'street' => $company->getStreet(),

0 commit comments

Comments
 (0)