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