fix(ns): class_exists() must use FQCN after PSR-4
Bare class_exists('Balance') looks up global Balance, always false
under AKSRT\* namespaces → REST 403 on balance exchange and friends.
Rewrite string checks to AKSRT\{Domain}\{Class}.
This commit is contained in:
1 parent
d55d1c6b62
commit
68d2e78d77
40 files changed
+105
-105
No files matched your search
@@ -137,7 +137,7 @@ class AfterSale {
|
||||
$items = $wpdb->get_results($wpdb->prepare($sql, $params), ARRAY_A);
|
||||
$items = array_map([$this, 'decorate_record'], (array) $items);
|
||||
|
||||
if ($include_order_context && !empty($items) && class_exists('OrderRepository')) {
|
||||
if ($include_order_context && !empty($items) && class_exists('AKSRT\\Payment\\OrderRepository')) {
|
||||
$contexts = OrderRepository::get_instance()->get_admin_order_context_map(array_column($items, 'order_number'));
|
||||
foreach ($items as &$item) {
|
||||
$item['order_context'] = $contexts[(string) ($item['order_number'] ?? '')] ?? [];
|
||||
@@ -174,7 +174,7 @@ class AfterSale {
|
||||
return null;
|
||||
}
|
||||
|
||||
$record['order_context'] = class_exists('OrderRepository')
|
||||
$record['order_context'] = class_exists('AKSRT\\Payment\\OrderRepository')
|
||||
? OrderRepository::get_instance()->get_admin_order_context((string) ($record['order_number'] ?? ''))
|
||||
: [];
|
||||
|
||||
@@ -561,7 +561,7 @@ class AfterSale {
|
||||
}
|
||||
|
||||
private function sync_order_status(array $record, string $new_status, string $note = ''): void {
|
||||
if (!class_exists('OrderRepository') || !class_exists('Order')) {
|
||||
if (!class_exists('AKSRT\\Payment\\OrderRepository') || !class_exists('AKSRT\\Payment\\Order')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user