Skip to content

Commit c86aa7a

Browse files
committed
Hot fixes for the 1.1.1 release
1 parent 382ae06 commit c86aa7a

File tree

5 files changed

+57
-42
lines changed

5 files changed

+57
-42
lines changed

app/code/Meta/BusinessExtension/Model/System/Config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,9 +809,9 @@ public function isServerTestModeEnabled(int $scopeId = null, string $scope = nul
809809
*
810810
* @param int|null $scopeId
811811
* @param string|null $scope
812-
* @return string
812+
* @return string|null
813813
*/
814-
public function getServerTestCode(int $scopeId = null, string $scope = null): string
814+
public function getServerTestCode(int $scopeId = null, string $scope = null): ?string
815815
{
816816
return $this->getConfig(
817817
self::XML_PATH_FACEBOOK_CONVERSION_MANAGEMENT_SERVER_TEST_CODE,

app/code/Meta/Catalog/Setup/Patch/Data/AddCatalogSwitch.php

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class AddCatalogSwitch implements DataPatchInterface
1212
{
13-
private const CORE_CONFIG_TABLE = "core_config_data";
13+
private const CORE_CONFIG_TABLE = 'core_config_data';
1414
/**
1515
* @var ModuleDataSetupInterface
1616
*/
@@ -21,6 +21,8 @@ class AddCatalogSwitch implements DataPatchInterface
2121
private SystemConfig $systemConfig;
2222

2323
/**
24+
* Class constructor
25+
*
2426
* @param ModuleDataSetupInterface $moduleDataSetup
2527
* @param SystemConfig $systemConfig
2628
*/
@@ -32,16 +34,27 @@ public function __construct(
3234
$this->systemConfig = $systemConfig;
3335
}
3436

37+
/**
38+
* @inheritdoc
39+
*/
3540
public static function getDependencies()
3641
{
3742
return [];
3843
}
3944

45+
/**
46+
* @inheritdoc
47+
*/
4048
public function getAliases()
4149
{
4250
return [];
4351
}
4452

53+
/**
54+
* Apply patch
55+
*
56+
* @return void
57+
*/
4558
public function apply(): void
4659
{
4760
$connection = $this->moduleDataSetup->getConnection();
@@ -63,7 +76,7 @@ public function apply(): void
6376
/**
6477
* Updates Store catalog integration
6578
*
66-
* @param $storeId
79+
* @param int $storeId
6780
* @return void
6881
*/
6982
private function updateStoreCatalogIntegration($storeId): void
@@ -73,79 +86,79 @@ private function updateStoreCatalogIntegration($storeId): void
7386

7487
$isDailyFeedSyncEnabled = $this->fetchValue(
7588
$storeId,
76-
"facebook/catalog_management/daily_product_feed"
89+
'facebook/catalog_management/daily_product_feed'
7790
);
7891
$isCatalogSyncEnabled = $this->fetchValue(
7992
$storeId,
80-
"facebook/catalog_management/enable_catalog_sync"
93+
'facebook/catalog_management/enable_catalog_sync'
8194
);
8295
$outOfStockThresholdOld = $this->fetchValue(
8396
$storeId,
84-
"facebook/inventory_management/out_of_stock_threshold"
97+
'facebook/inventory_management/out_of_stock_threshold'
8598
);
8699
$outOfStockThresholdNew = $this->fetchValue(
87100
$storeId,
88-
"facebook/catalog_management/out_of_stock_threshold"
101+
'facebook/catalog_management/out_of_stock_threshold'
89102
);
90103

91104
if ($isCatalogSyncEnabled == null && $isDailyFeedSyncEnabled != null) {
92105
$connection->insert($coreConfigTable, [
93-
"scope" => $storeId ? "stores" : "default",
94-
"scope_id" => $storeId,
95-
"path" => "facebook/catalog_management/enable_catalog_sync",
96-
"value" => $isDailyFeedSyncEnabled,
106+
'scope' => $storeId ? 'stores' : 'default',
107+
'scope_id' => $storeId,
108+
'path' => 'facebook/catalog_management/enable_catalog_sync',
109+
'value' => $isDailyFeedSyncEnabled,
97110
]);
98111
}
99112

100113
if ($outOfStockThresholdNew == null && $outOfStockThresholdOld != null) {
101114
$connection->insert($coreConfigTable, [
102-
"scope" => $storeId ? "stores" : "default",
103-
"scope_id" => $storeId,
104-
"path" => "facebook/catalog_management/out_of_stock_threshold",
105-
"value" => $outOfStockThresholdOld,
115+
'scope' => $storeId ? 'stores' : 'default',
116+
'scope_id' => $storeId,
117+
'path' => 'facebook/catalog_management/out_of_stock_threshold',
118+
'value' => $outOfStockThresholdOld,
106119
]);
107120
}
108121

109122
$connection->delete($coreConfigTable, [
110-
"scope_id = ?" => $storeId,
111-
"path = ?" => "facebook/catalog_management/daily_product_feed",
123+
'scope_id = ?' => $storeId,
124+
'path = ?' => 'facebook/catalog_management/daily_product_feed',
112125
]);
113126
$connection->delete($coreConfigTable, [
114-
"scope_id = ?" => $storeId,
115-
"path = ?" =>
116-
"facebook/inventory_management/out_of_stock_threshold",
127+
'scope_id = ?' => $storeId,
128+
'path = ?' =>
129+
'facebook/inventory_management/out_of_stock_threshold',
117130
]);
118131
$connection->delete($coreConfigTable, [
119-
"scope_id = ?" => $storeId,
120-
"path = ?" =>
121-
"facebook/catalog_management/incremental_product_updates",
132+
'scope_id = ?' => $storeId,
133+
'path = ?' =>
134+
'facebook/catalog_management/incremental_product_updates',
122135
]);
123136
$connection->delete($coreConfigTable, [
124-
"scope_id = ?" => $storeId,
125-
"path = ?" =>
126-
"facebook/inventory_management/enable_inventory_upload",
137+
'scope_id = ?' => $storeId,
138+
'path = ?' =>
139+
'facebook/inventory_management/enable_inventory_upload',
127140
]);
128141
$connection->delete($coreConfigTable, [
129-
"scope_id = ?" => $storeId,
130-
"path = ?" => "facebook/catalog_management/feed_upload_method",
142+
'scope_id = ?' => $storeId,
143+
'path = ?' => 'facebook/catalog_management/feed_upload_method',
131144
]);
132145
}
133146

134147
/**
135148
* Fetch store config value
136149
*
137-
* @param $storeId
138-
* @param $config_path
150+
* @param int $storeId
151+
* @param string $configPath
139152
* @return mixed|null
140153
*/
141-
private function fetchValue($storeId, $config_path): mixed
154+
private function fetchValue($storeId, $configPath)
142155
{
143156
$connection = $this->moduleDataSetup->getConnection();
144-
$scopeCondition = $connection->prepareSqlCondition("scope_id", [
145-
"eq" => $storeId,
157+
$scopeCondition = $connection->prepareSqlCondition('scope_id', [
158+
'eq' => $storeId,
146159
]);
147-
$pathCondition = $connection->prepareSqlCondition("path", [
148-
"eq" => $config_path,
160+
$pathCondition = $connection->prepareSqlCondition('path', [
161+
'eq' => $configPath,
149162
]);
150163
$query = $connection
151164
->select()

app/code/Meta/Sales/Observer/Order/Cancel.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use GuzzleHttp\Exception\GuzzleException;
2525
use Magento\Framework\Event\Observer;
2626
use Magento\Framework\Event\ObserverInterface;
27+
use Magento\Framework\Exception\LocalizedException;
2728
use Magento\Sales\Model\Order;
2829
use Meta\BusinessExtension\Helper\GraphAPIAdapter;
2930
use Meta\BusinessExtension\Model\System\Config as SystemConfig;
@@ -101,8 +102,8 @@ private function cancelOrder(int $storeId, string $fbOrderId)
101102
$this->graphAPIAdapter->cancelOrder($fbOrderId);
102103
} catch (GuzzleException $e) {
103104
$response = $e->getResponse();
104-
$body = json_decode($response->getBody());
105-
throw new Exception(__(
105+
$body = json_decode((string)$response->getBody());
106+
throw new LocalizedException(__(
106107
'Error code: "%1"; Error message: "%2"',
107108
(string)$body->error->code,
108109
(string)($body->error->error_user_msg ?? $body->error->message)

app/code/Meta/Sales/Observer/Order/MarkAsShipped.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public function execute(Observer $observer)
9797
$this->shipper->markAsShipped($shipment);
9898
} catch (GuzzleException $e) {
9999
$response = $e->getResponse();
100-
$body = json_decode($response->getBody());
101-
throw new Exception(__(
100+
$body = json_decode((string)$response->getBody());
101+
throw new LocalizedException(__(
102102
'Error code: "%1"; Error message: "%2"',
103103
(string)$body->error->code,
104104
(string)($body->error->error_user_msg ?? $body->error->message)

app/code/Meta/Sales/Observer/Order/Refund.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use GuzzleHttp\Exception\GuzzleException;
2525
use Magento\Framework\Event\Observer;
2626
use Magento\Framework\Event\ObserverInterface;
27+
use Magento\Framework\Exception\LocalizedException;
2728
use Magento\Sales\Api\Data\CreditmemoInterface;
2829
use Magento\Sales\Api\Data\CreditmemoItemInterface as CreditmemoItem;
2930
use Magento\Sales\Api\Data\OrderPaymentInterface;
@@ -173,8 +174,8 @@ private function refundOrder(
173174
);
174175
} catch (GuzzleException $e) {
175176
$response = $e->getResponse();
176-
$body = json_decode($response->getBody());
177-
throw new Exception(__(
177+
$body = json_decode((string)$response->getBody());
178+
throw new LocalizedException(__(
178179
'Error code: "%1"; Error message: "%2"',
179180
(string)$body->error->code,
180181
(string)($body->error->error_user_msg ?? $body->error->message)

0 commit comments

Comments
 (0)