From e2a56a0643d79fbb3299b2b51a80f3b8242b8313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B0=20=D0=94=2E=20=D0=A1=D0=BF=D0=B8=D1=80=D0=B8=D0=B4=D0=BE?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0?= Date: Wed, 15 Dec 2021 11:46:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=BB=D0=B0=D1=82=D0=B5=D0=B6=D0=B0=20=D1=81=D1=80?= =?UTF-8?q?=D0=B0=D0=B7=D1=83=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BE?= =?UTF-8?q?=D0=BF=D0=BB=D0=B0=D1=82=D1=8B.=20=D0=9E=D0=B1=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=20SDK=20=D0=B4=D0=BE=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D0=B8=202.2.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ src/Plugin/Commerce/PaymentGateway/YooKassa.php | 7 ++++++- yookassa.libraries.yml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 362fb19..0a18dd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### v2.2.1 от 15.12.2021 +* Обновление статуса платежа сразу после оплаты +* Обновлен SDK до версии 2.2.4 + ### v2.2.0 от 13.10.2021 * Замена Сбербанк Онлайн на SberPay diff --git a/src/Plugin/Commerce/PaymentGateway/YooKassa.php b/src/Plugin/Commerce/PaymentGateway/YooKassa.php index c158049..804d83f 100644 --- a/src/Plugin/Commerce/PaymentGateway/YooKassa.php +++ b/src/Plugin/Commerce/PaymentGateway/YooKassa.php @@ -59,7 +59,7 @@ */ class YooKassa extends OffsitePaymentGatewayBase { - const YOOMONEY_MODULE_VERSION = '2.2.0'; + const YOOMONEY_MODULE_VERSION = '2.2.1'; /** * @property Client apiClient @@ -405,6 +405,7 @@ public function onNotify(Request $request) $this->log('Payment info after capture: ' . json_encode($captureResponse)); if ($captureResponse->status == PaymentStatus::SUCCEEDED) { $payment->setRemoteState($paymentInfo->status); + $payment->setState('completed'); $order->state = 'completed'; $order->setCompletedTime(Drupal::time()->getRequestTime()); $order->save(); @@ -414,6 +415,7 @@ public function onNotify(Request $request) return new Response('Payment completed', 200); } elseif ($captureResponse->status == PaymentStatus::CANCELED) { $payment->setRemoteState($paymentInfo->status); + $payment->setState('canceled'); $payment->save(); $this->log('Payment canceled'); @@ -422,12 +424,14 @@ public function onNotify(Request $request) break; case PaymentStatus::PENDING: $payment->setRemoteState($paymentInfo->status); + $payment->setState('pending'); $payment->save(); $this->log('Payment pending'); return new Response(' Payment Required', 402); case PaymentStatus::SUCCEEDED: $payment->setRemoteState($paymentInfo->status); + $payment->setState('completed'); $order->state = 'completed'; $order->setCompletedTime(Drupal::time()->getRequestTime()); $order->save(); @@ -437,6 +441,7 @@ public function onNotify(Request $request) return new Response('Payment complete', 200); case PaymentStatus::CANCELED: $payment->setRemoteState($paymentInfo->status); + $payment->setState('canceled'); $payment->save(); $this->log('Payment canceled'); diff --git a/yookassa.libraries.yml b/yookassa.libraries.yml index c52d800..d9a7caf 100644 --- a/yookassa.libraries.yml +++ b/yookassa.libraries.yml @@ -8,7 +8,7 @@ billing_validation: yookassa-sdk-php: remote: https://github.com/yoomoney/yookassa-sdk-php - version: "2.0.5" + version: "2.2.4" license: name: MIT url: https://github.com/yoomoney/yookassa-sdk-php/blob/master/LICENSE.md