feat: add fiscalization settings, POST callbacks and fix callback issues
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
> **📦 Версия модуля: 1.0.3**
|
> **📦 Версия модуля: 1.0.4**
|
||||||
|
|
||||||
> **ℹ️ Совместимость версий OpenCart:**
|
> **ℹ️ Совместимость версий OpenCart:**
|
||||||
> 4.0.2.0, 4.0.2.1, 4.0.2.2, 4.0.2.3, 4.1.0.0, 4.1.0.1, 4.1.0.2, 4.1.0.3, 4.1.0.4
|
> 4.0.2.0, 4.0.2.1, 4.0.2.2, 4.0.2.3, 4.1.0.0, 4.1.0.1, 4.1.0.2, 4.1.0.3, 4.1.0.4
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Opencart\Admin\Controller\Extension\PayAnyWay\Payment;
|
|||||||
class PayAnyWay extends \Opencart\System\Engine\Controller
|
class PayAnyWay extends \Opencart\System\Engine\Controller
|
||||||
{
|
{
|
||||||
public const CMS_NAME = 'OpenCart';
|
public const CMS_NAME = 'OpenCart';
|
||||||
public const MODULE_VERSION = '1.0.3';
|
public const MODULE_VERSION = '1.0.4';
|
||||||
public const MODULE_DEFAULT_SORT_ORDER = 0;
|
public const MODULE_DEFAULT_SORT_ORDER = 0;
|
||||||
|
|
||||||
private const ROUTE_STARTUP_CODE = 'payanyway_post_route';
|
private const ROUTE_STARTUP_CODE = 'payanyway_post_route';
|
||||||
|
|||||||
@@ -719,34 +719,6 @@ class Callback extends \Opencart\System\Engine\Controller
|
|||||||
return 'unknown';
|
return 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<non-empty-string, mixed> $data
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function buildJsonResponse(array $data): array
|
|
||||||
{
|
|
||||||
$jsonData = [
|
|
||||||
'id' => $data['MNT_ID'],
|
|
||||||
'transactionId' => $data['MNT_TRANSACTION_ID'],
|
|
||||||
'amount' => $data['MNT_AMOUNT'],
|
|
||||||
'signature' => $data['MNT_SIGNATURE'],
|
|
||||||
'resultCode' => $data['MNT_RESULT_CODE'],
|
|
||||||
'description' => $data['MNT_DESCRIPTION'],
|
|
||||||
'externalId' => $data['MNT_TRANSACTION_ID'],
|
|
||||||
'receipt' => [
|
|
||||||
'client' => $data['client'],
|
|
||||||
'items' => $data['items'],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$json = json_encode($jsonData, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'data' => $json ?: '',
|
|
||||||
'contentType' => self::JSON_CONTENT_TYPE,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, mixed> $data
|
* @param array<string, mixed> $data
|
||||||
* @return array{data: string, contentType: string}
|
* @return array{data: string, contentType: string}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ trait PayAnyWay
|
|||||||
private static int $orderLockTimeoutSeconds = 10;
|
private static int $orderLockTimeoutSeconds = 10;
|
||||||
|
|
||||||
private static string $moduleCode = 'payanyway';
|
private static string $moduleCode = 'payanyway';
|
||||||
private static string $moduleVersion = '1.0.3';
|
private static string $moduleVersion = '1.0.4';
|
||||||
private static string $defaultCmsName = 'OpenCart';
|
private static string $defaultCmsName = 'OpenCart';
|
||||||
|
|
||||||
private static int $clientEmailMaxLength = 64;
|
private static int $clientEmailMaxLength = 64;
|
||||||
@@ -301,25 +301,4 @@ trait PayAnyWay
|
|||||||
|
|
||||||
return $email;
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return non-empty-string|null */
|
|
||||||
private function getClientName(): ?string
|
|
||||||
{
|
|
||||||
$name = trim(($this->orderInfo['firstname'] ?? '') . ' ' . ($this->orderInfo['lastname'] ?? ''));
|
|
||||||
return ('' !== $name) ? $name : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return non-empty-string|null */
|
|
||||||
private function getClientEmail(): ?string
|
|
||||||
{
|
|
||||||
$email = trim((string)($this->orderInfo['email'] ?? ''));
|
|
||||||
return ('' !== $email) ? filter_var($email, FILTER_SANITIZE_EMAIL) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return non-empty-string|null */
|
|
||||||
private function getClientPhone(): ?string
|
|
||||||
{
|
|
||||||
$digits = preg_replace('/\D/', '', trim((string)($this->orderInfo['telephone'] ?? '')));
|
|
||||||
return ('' !== $digits) ? '+' . $digits : null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"code": "payanyway",
|
"code": "payanyway",
|
||||||
"name": "PayAnyWay (МОНЕТА)",
|
"name": "PayAnyWay (МОНЕТА)",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"author": "PayAnyWay (МОНЕТА)",
|
"author": "PayAnyWay (МОНЕТА)",
|
||||||
"link": "https://www.payanyway.ru/"
|
"link": "https://www.payanyway.ru/"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user