diff --git a/W/Event.php b/W/Event.php index 7863252..7ccf344 100644 --- a/W/Event.php +++ b/W/Event.php @@ -44,6 +44,7 @@ function isSuccessful() {return !in_array($this->status(), [ * @used-by \Df\Payment\W\Nav::pid() * @used-by \Df\PaypalClone\W\Event::idE() * @used-by \Df\StripeClone\W\Event::idBase() + * @used-by \Dfe\Qiwi\W\Handler::amount() * @used-by \Dfe\Robokassa\W\Responder::success() * @return string */ @@ -59,10 +60,11 @@ function pid() {return df_trim_text_left(parent::pid(), '_TEST_');} * @see \Df\PaypalClone\W\Event::ttCurrent() * @used-by \Df\Payment\W\Strategy\ConfirmPending::_handle() * @used-by \Df\PaypalClone\W\Nav::id() + * @used-by \Dfe\Qiwi\W\Handler::strategyC() */ function ttCurrent() {return !$this->isSuccessful() ? parent::ttCurrent() : dfa([ self::$S_PROCESSING => self::T_INFO - ,self::$S_SUCCESS => self::T_REFUND + ,self::S_SUCCESS => self::T_REFUND ,self::$S_WAITING => self::T_INFO ,self::$S_PAID => self::T_CAPTURE ], $this->status());} @@ -117,6 +119,12 @@ protected function k_signature() {return Reader::K__SIGNATURE;} */ protected function k_status() {return 'status';} + /** + * 2017-09-14 «Payment refund is successful» / «Платеж проведен». + * @var string + */ + const S_SUCCESS = 'success'; + /** * 2017-09-14 «Invoice expired. Invoice has not been paid.» / «Время жизни счета истекло. Счет не оплачен.» * @used-by isSuccessful() @@ -145,11 +153,6 @@ protected function k_status() {return 'status';} * @var string */ private static $S_REJECTED = 'rejected'; - /** - * 2017-09-14 «Payment refund is successful» / «Платеж проведен». - * @var string - */ - private static $S_SUCCESS = 'success'; /** * 2017-09-14 * «Payment processing error. Invoice has not been paid.»/ «Ошибка при проведении оплаты. Счет не оплачен.» diff --git a/W/Handler.php b/W/Handler.php new file mode 100644 index 0000000..c80a68d --- /dev/null +++ b/W/Handler.php @@ -0,0 +1,45 @@ +e()->r('amount');} + + /** + * 2017-09-14 + * Метод должен вернуть идентификатор операции (не платежа!) в платёжной системе. + * Он нужен нам для избежания обработки оповещений о возвратах, инициированных нами же + * из административной части Magento: @see \Df\StripeClone\Method::_refund() + * Это должен быть тот же самый идентификатор, + * который возвращает @see \Dfe\Stripe\Facade\Refund::transId() + * @override + * @see \Df\Payment\W\IRefund::eTransId() + * @used-by \Df\Payment\W\Strategy\Refund::_handle() + * @return string + */ + function eTransId() {return $this->e()->pid();} + + /** + * 2017-09-14 + * «Operation Statuses»: + * https://github.com/QIWI-API/pull-payments-docs/blob/40d48cf0/_statuses_en.html.md#operation-statuses + * «Статусы операций»: + * https://github.com/QIWI-API/pull-payments-docs/blob/40d48cf0/_statuses_ru.html.md#Статусы-операций + * @override + * @see \Df\Payment\W\Handler::strategyC() + * @used-by \Df\Payment\W\Handler::handle() + * @return string|null + */ + protected function strategyC() {return + Event::T_REFUND === $this->e()->ttCurrent() ? Refund::class : ConfirmPending::class + ;} +} \ No newline at end of file