Skip to content

Commit

Permalink
1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Dec 3, 2021
1 parent 107dc2f commit 1ccd7e8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 43 deletions.
60 changes: 21 additions & 39 deletions Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
namespace Dfe\YandexKassa;
use \Exception as Ex;
use Df\PaypalClone\W\Exception\InvalidSignature;
use Df\Xml\G;
use Dfe\YandexKassa\W\Event as Ev;
use Magento\Framework\App\Response\Http as HttpResponse;
use Magento\Framework\App\Response\HttpInterface as IHttpResponse;
use Zend_Date as ZD;

/**
Expand Down Expand Up @@ -52,19 +49,15 @@
*
* @final Unable to use the PHP «final» keyword here because of the M2 code generation.
*/
class Result extends \Df\Framework\W\Result {
class Result extends \Df\Framework\W\Result\Xml {
/**
* 2017-10-02
* 2017-11-17
* We can use the PHP «final» keyword here,
* because the method is absent in @see \Magento\Framework\Controller\ResultInterface
* 2021-12-03
* @override
* @see \Df\Framework\W\Result::__toString()
* @used-by render()
* @used-by \Df\Payment\W\Action::execute()
* @return string
* @see \Df\Framework\W\Result\Xml::attributes()
* @used-by \Df\Framework\W\Result\Xml::__toString()
* @return array(string => mixed)
*/
final function __toString() {return df_xml_g("{$this->_ev->t()}Response", [], [G::P__ATTRIBUTES => [
final protected function attributes() {return [
/**
* 2017-10-03
* In English:
Expand Down Expand Up @@ -164,52 +157,41 @@ final function __toString() {return df_xml_g("{$this->_ev->t()}Response", [], [G
# «Store ID. Must match the `shopId` field in the request.»
# «Идентификатор магазина. Должен дублировать поле `shopId` запроса.»
,'shopId' => $this->_ev->r('shopId')
/**
* 2017-10-03
* «Additional text explanation of the merchant's response.
* This is usually used for more detailed information about errors. Optional field.»
* «Дополнительное текстовое пояснение ответа магазина.
* Как правило, используется как дополнительная информация об ошибках. Необязательное поле.»
* String(64)
*/
# 2017-10-03
# «Additional text explanation of the merchant's response.
# This is usually used for more detailed information about errors. Optional field.»
# «Дополнительное текстовое пояснение ответа магазина.
# Как правило, используется как дополнительная информация об ошибках. Необязательное поле.»
# String(64)
,'techMessage' => 'Author: Dmitry Fedyuk (https://mage2.pro, [email protected])'
] + (!$this->_ex ? [] : [
# 2017-10-03
# «Text explanation if the payment is not accepted» / «Текстовое пояснение в случае отказа принять платеж»
# String(255)
'message' => df_chop($this->_ex->message(), 255)
])]);}
]);}

/**
* 2017-10-02
* 2021-12-03
* @override
* @see \Magento\Framework\Controller\AbstractResult::render()
* https://github.com/magento/magento2/blob/2.1.0/lib/internal/Magento/Framework/Controller/AbstractResult.php#L109-L113
* @param IHttpResponse|HttpResponse $r
* @see \Df\Framework\W\Result\Xml::tag()
* @used-by \Df\Framework\W\Result\Xml::__toString()
* @return string
*/
final protected function render(IHttpResponse $r) {
$r->setBody($this->__toString());
/**
* 2017-10-02
* In English: «MIME type: application/xml».
* https://tech.yandex.com/money/doc/payment-solution/payment-notifications/payment-notifications-http-docpage/
* In Russian: «MIME-тип: application/xml».
* https://tech.yandex.ru/money/doc/payment-solution/payment-notifications/payment-notifications-http-docpage/
*/
df_response_content_type('application/xml', $r);
}
final protected function tag() {return "{$this->_ev->t()}Response";}

/**
* 2017-10-02
* @used-by __toString()
* @used-by attributes()
* @used-by i()
* @used-by tag()
* @var Ev
*/
private $_ev;

/**
* 2017-10-02
* @used-by __toString()
* @used-by attributes()
* @used-by i()
* @var Ex|null
*/
Expand Down
3 changes: 1 addition & 2 deletions W/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ final class Reader extends \Df\Payment\W\Reader {
* }
* 2017-10-03
* We need to distinguish the notifications not only for a payment title decoration,
* but primarily for \Dfe\YandexKassa\Result::__toString():
* a response's root tag should start with the notification type.
* but primarily for @see \Dfe\YandexKassa\Result::tag(): a response's root tag should start with the notification type.
* @override
* @see \Df\Payment\W\Reader::kt()
* @used-by \Df\Payment\W\Reader::tRaw()
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.1.4"
,"version": "1.1.5"
,"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://mage2.pro/users/dmitry_fedyuk",
"role": "Developer"
}]
,"require": {"mage2pro/core": ">=5.8.0"}
,"require": {"mage2pro/core": ">=8.0.0"}
,"autoload": {"files": ["registration.php"], "psr-4": {"Dfe\\YandexKassa\\": ""}}
,"keywords": [
"API"
Expand Down

0 comments on commit 1ccd7e8

Please sign in to comment.