14 private const TYPE =
'paysystem';
16 private const PAY_SYSTEM_HANDLERS = [
17 \Sale\Handlers\PaySystem\YandexCheckoutHandler::class,
18 \Sale\Handlers\PaySystem\WooppayHandler::class,
19 \Sale\Handlers\PaySystem\RoboxchangeHandler::class,
20 \Sale\Handlers\PaySystem\PlatonHandler::class,
27 private $paySystemService;
31 $this->payment = $payment;
32 $this->paySystemService = $this->payment->getPaySystem();
48 if (!$this->paySystemService)
53 $actionFile = $this->paySystemService->getField(
'ACTION_FILE');
54 $paySystemClassName = strtolower(
Sale\PaySystem\Manager::getClassNameFromPath($actionFile));
56 $isPaySystemExists = (bool)array_filter(
57 self::PAY_SYSTEM_HANDLERS,
58 static function ($paySystemHandler) use ($paySystemClassName) {
59 return strtolower($paySystemHandler) === $paySystemClassName;
63 return $isPaySystemExists && $this->payment->isPaid();
73 $paymentData = $this->getPaymentData();
77 'pay_system' => $this->paySystemService->getField(
'ACTION_FILE'),
78 'transactions' => $paymentData,
88 private function getPaymentData(): array
92 $externalId = $this->payment->getField(
'PS_INVOICE_ID');
93 $date = $this->payment->getField(
'PS_RESPONSE_DATE') ?: $this->payment->getField(
'DATE_PAID');
100 $date = $date->format(
'Y-m-d H:i:s');
103 'id' => $externalId ?: $this->payment->getField(
'XML_ID'),
104 'date_time' => $date,