9Main\Localization\Loc::loadMessages(__FILE__);
18 private const TTL = 31536000;
26 abstract protected function send(
string $url,
Sale\
Payment $payment, array $fields,
string $method = self::SEND_METHOD_HTTP_POST):
Sale\
Result;
43 $supportedKkmModels = [];
45 $paySystemIterator = Sale\PaySystem\Manager::getList([
50 while ($paySystemItem = $paySystemIterator->fetch())
54 $paySystemService->isSupportPrintCheck()
55 && $paySystemService->getCashboxClass() ===
'\\'.static::class
58 $supportedKkmModels[] = static::getKkmValue($paySystemService);
62 $supportedKkmModels = array_unique(array_merge(...$supportedKkmModels));
65 foreach ($supportedKkmModels as $supportedKkm)
67 $result[$supportedKkm] = [
68 'NAME' => $supportedKkm
82 $params = $payment->getPaySystem()->getParamsBusValue($payment);
83 return $params[$code] ??
null;
96 if ($payment && $service = $payment->getPaySystem())
98 if (!$service->isSupportPrintCheck())
103 'SALE_CASHBOX_PAYSYSTEM_PAYSYSTEM_NOT_SUPPORT_PRINT_CHECK',
105 '#PAY_SYSTEM_NAME#' => $service->getField(
'NAME')
112 if (!$service->canPrintCheckSelf($payment))
117 'SALE_CASHBOX_PAYSYSTEM_PAYSYSTEM_CANT_PRINT_CHECK_SELF',
119 '#PAY_SYSTEM_NAME#' => $service->getField(
'NAME')
130 Main\Localization\
Loc::getMessage(
'SALE_CASHBOX_PAYSYSTEM_PAYMENT_NOT_FOUND')
148 if (!$checkParamsResult->isSuccess())
150 $result->addErrors($checkParamsResult->getErrors());
161 Main\Localization\
Loc::getMessage(
'SALE_CASHBOX_PAYSYSTEM_PAYMENT_NOT_FOUND')
170 $sendResult = $this->
send($url, $payment, $fields);
171 if ($sendResult->isSuccess())
174 if ($processPrintResult->isSuccess())
176 $result->setData($processPrintResult->getData());
180 $result->addErrors($processPrintResult->getErrors());
185 $result->addErrors($sendResult->getErrors());
200 $isShipmentEntity = (bool)array_filter($check->getEntities(),
static function ($entity) {
227 if (!$checkParamsResult->isSuccess())
229 $result->addErrors($checkParamsResult->getErrors());
238 Main\Localization\
Loc::getMessage(
'SALE_CASHBOX_PAYSYSTEM_PAYMENT_NOT_FOUND')
248 $sendResult = $this->
send($url, $payment, $fields, $sendMethod);
249 if (!$sendResult->isSuccess())
251 $result->addErrors($sendResult->getErrors());
256 if ($processCheckResult->isSuccess())
259 if (!$onAfterProcessCheckResult->isSuccess())
261 $result->addErrors($onAfterProcessCheckResult->getErrors());
266 $result->addErrors($processCheckResult->getErrors());
294 $paySystemCodeForKkm = static::getPaySystemCodeForKkm();
296 $service->getConsumerName(),
300 return $supportedKkmModels;
static getMessage($code, $replace=null, $language=null)
static getValuesByCode(string $consumerName, string $code)
buildCheckQuery(Check $check)
send(string $url, Sale\Payment $payment, array $fields, string $method=self::SEND_METHOD_HTTP_POST)
static getPaySystemCodeForKkm()
onAfterProcessCheck(Sale\Result $result, Sale\Payment $payment)
const SEND_METHOD_HTTP_POST
getPaySystemSetting(Sale\Payment $payment, string $code)
needPrintCheck(Check $check)
checkParams(Check $check)
getDataForCheck(Sale\Payment $payment)
static getSupportedKkmModels()
static getKkmValue(Sale\PaySystem\Service $service)
printImmediately(Check $check)
processCheckResult(Sale\Result $result)
const SEND_METHOD_HTTP_GET
processPrintResult(Sale\Result $result)
static getPaymentByCheck(Check $check)