Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Aug 4, 2023
1 parent b2f25e4 commit f9d3f95
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
17 changes: 8 additions & 9 deletions Result.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php
namespace Dfe\YandexKassa;
use \Exception as Ex;
use Df\PaypalClone\W\Exception\InvalidSignature;
use Dfe\YandexKassa\W\Event as Ev;
use Zend_Date as ZD;

use \Throwable as Th; # 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311
/**
* 2017-10-02
* 1. In English:
Expand Down Expand Up @@ -93,7 +92,7 @@ final protected function attributes():array {return [
* Ошибка разбора запроса
* Магазин не в состоянии разобрать запрос. Окончательная ошибка.
*/
'code' => !$this->_ex ? 0 : ($this->_ex instanceof InvalidSignature ? 1 : 200)
'code' => !$this->_th ? 0 : ($this->_th instanceof InvalidSignature ? 1 : 200)
# 2017-10-03
# «Yandex.Checkout transaction ID. Must match the invoiceId field in the request.»
# «Идентификатор транзакции в Яндекс.Кассе. Должен дублировать поле invoiceId запроса.»
Expand Down Expand Up @@ -164,11 +163,11 @@ final protected function attributes():array {return [
# Как правило, используется как дополнительная информация об ошибках. Необязательное поле.»
# String(64)
,'techMessage' => 'Author: Dmitrii Fediuk (https://mage2.pro, admin@mage2.pro)'
] + (!$this->_ex ? [] : [
] + (!$this->_th ? [] : [
# 2017-10-03
# «Text explanation if the payment is not accepted» / «Текстовое пояснение в случае отказа принять платеж»
# String(255)
'message' => df_chop($this->_ex->message(), 255)
'message' => df_chop(df_xts($this->_th), 255)
]);}

/**
Expand All @@ -192,16 +191,16 @@ final protected function tag():string {return "{$this->_ev->t()}Response";}
* 2017-10-02
* @used-by self::attributes()
* @used-by self::i()
* @var Ex|null
* @var Th|null
*/
private $_ex;
private $_th;

/**
* 2017-10-02
* @used-by \Dfe\YandexKassa\W\Responder::error()
* @used-by \Dfe\YandexKassa\W\Responder::success()
*/
final static function i(Ev $ev, Ex $ex = null):self {
/** @var self $i */ $i = new self; $i->_ev = $ev; $i->_ex = $ex; return $i;
final static function i(Ev $ev, Th $th = null):self {
/** @var self $i */ $i = new self; $i->_ev = $ev; $i->_th = $th; return $i;
}
}
5 changes: 3 additions & 2 deletions W/Responder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
final class Responder extends \Df\Payment\W\Responder {
/**
* 2017-10-02
* 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311
* @override
* @see \Df\Payment\W\Responder::error()
* @used-by \Df\Payment\W\Responder::setError()
* @param \Exception|string $e
* @param \Throwable|string $t
*/
protected function error($e):Result {df_assert($e instanceof \Exception); return Result::i($this->e(), $e);}
protected function error($t):Result {df_assert(df_is_th($t)); return Result::i($this->e(), $t);}

/**
* 2017-10-02
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/yandex-kassa"
,"version": "1.2.0"
,"version": "1.2.1"
,"description": "Yandex.Kassa (Яндекс.Касса, Yandex.Checkout) integration with Magento 2"
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/yandex-kassa"
Expand All @@ -11,7 +11,7 @@
"homepage": "https://upwork.com/fl/mage2pro",
"role": "Developer"
}]
,"require": {"mage2pro/core": ">=8.0.0"}
,"require": {"mage2pro/core": ">=10.2.1"}
,"autoload": {"files": ["registration.php"], "psr-4": {"Dfe\\YandexKassa\\": ""}}
,"keywords": [
"API"
Expand Down

0 comments on commit f9d3f95

Please sign in to comment.