Skip to content

Commit

Permalink
2.11.33
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Sep 10, 2017
1 parent 137b89c commit 581c819
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 24 deletions.
5 changes: 3 additions & 2 deletions API/Facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ final function patch($p) {return $this->p($p);}

/**
* 2017-09-03
* Currently it is never used.
* @used-by \Dfe\Qiwi\Init\Action::preorder()
* @param int|string|array(string => mixed)|array(int|string, array(int|string => mixed)) $p
* @return O
* @throws DFE
Expand Down Expand Up @@ -96,7 +96,8 @@ final protected function p($p = [], $method = null, $path = null) {
list($id, $p) = !is_array($p) ? [$p, []] : (!df_is_assoc($p) ? $p : [null, $p]);
/** @var Client $client */
$client = df_newa(df_con($this, 'API\\Client'), Client::class,
$path ?: df_cc_path($this->prefix(), strtolower(df_class_l($this)) . 's', $id), $p, $method
$path ?: df_cc_path($this->prefix(), strtolower(df_class_l($this)) . 's', urlencode($id))
,$p, $method
);
/**
* 2017-08-08
Expand Down
43 changes: 33 additions & 10 deletions Payment/Init/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ class Action {
*/
final protected function e2i($id, $t = null) {return $this->m()->tid()->e2i($id, $t);}

/**
* 2017-09-10
* @used-by action()
* @see \Dfe\Qiwi\Init\Action::redirectMethod()
* @return bool
*/
protected function forceGet() {return false;}

/**
* 2017-03-21
* @final I do not use the PHP «final» keyword here to allow refine the return type using PHPDoc.
Expand All @@ -44,6 +52,7 @@ protected function m() {return $this->_m;}
* 2017-03-21
* @used-by action()
* @see \Df\PaypalClone\Init\Action::redirectParams()
* @see \Dfe\Qiwi\Init\Action::redirectParams()
* @return array(string => mixed)
*/
protected function redirectParams() {return [];}
Expand Down Expand Up @@ -83,6 +92,13 @@ protected function redirectUrl() {return null;}
*/
final protected function preconfiguredToCapture() {return AC::c($this->preconfigured());}

/**
* 2017-09-10
* @used-by action()
* @see \Dfe\Qiwi\Init\Action::preorder()
*/
protected function preorder() {}

/**
* 2017-03-21
* @final I do not use the PHP «final» keyword here to allow refine the return type using PHPDoc.
Expand Down Expand Up @@ -125,9 +141,10 @@ private function __construct(M $m) {$this->_m = $m;}
*/
private function action() {return $this->_m->action(function() {
$m = $this->_m; /** @var M $m */
$this->preorder();
$p = $this->redirectParams(); /** @var array(string => mixed) $p */
if ($url = dfp_url_api($m, $this->redirectUrl())) { /** @var string|null $url */
PO::setRedirectData($m, $url, $p);
PO::setRedirectData($m, $url, $p, $this->forceGet());
// 2016-12-20
if ($this->s()->log()) {
dfp_report($m, ['Redirect Params' => $p, 'Redirect URL' => $url], 'request');
Expand Down Expand Up @@ -155,15 +172,21 @@ private function action() {return $this->_m->action(function() {
if ($id = $this->transId() /** @var string|null $id */) {
$result = null;
$m->ii()->setTransactionId($id); // 2016-07-10 Сохраняем информацию о транзакции.
/**
* 2017-03-26
* Некоторые модули (Ginger Payments, Kassa Compleet) перенаправляют покупателя
* на платёжную страницу ПС без параметров POST: они передают параметры через URL.
* В этом случае данный вызов @uses \Df\Payment\Method::iiaSetTRR()
* безвреден (он ничего не сделает), а параметры запроса сохраняются в транзакции
* каким-то другим методом, например @see \Df\GingerPaymentsBase\Init\Action::req()
*/
$m->iiaSetTRR($p);
if (!$this->forceGet()) {
/**
* 2017-03-26
* Некоторые модули (Ginger Payments, Kassa Compleet, QIWI Wallet) перенаправляют покупателя
* на платёжную страницу ПС без параметров POST: они передают параметры через URL.
* В этом случае данный вызов @uses \Df\Payment\Method::iiaSetTRR()
* безвреден (он ничего не сделает), а параметры запроса сохраняются в транзакции
* каким-то другим методом, например:
* @see \Df\GingerPaymentsBase\Init\Action::req()
* @see \Df\GingerPaymentsBase\Init\Action::res()
* @see \Dfe\Qiwi\Init\Action::req()
* @see \Dfe\Qiwi\Init\Action::res()
*/
$m->iiaSetTRR($p);
}
/**
* 2016-07-10
* @uses \Magento\Sales\Model\Order\Payment\Transaction::TYPE_PAYMENT —
Expand Down
3 changes: 1 addition & 2 deletions Payment/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,7 @@ final function iiaSet($k, $v = null) {$this->ii()->setAdditionalInformation($k,
* @used-by \Df\GingerPaymentsBase\Init\Action::res()
* @used-by \Df\Payment\Init\Action::action()
* @used-by \Df\StripeClone\Method::transInfo()
* @used-by \Dfe\Qiwi\Init\Action::req()
* @used-by \Dfe\Qiwi\Init\Action::res()
* @used-by \Dfe\Qiwi\Init\Action::preorder()
* @used-by \Dfe\SecurePay\Refund::process()
*
* Эта информация в настоящее время используется:
Expand Down
7 changes: 4 additions & 3 deletions Payment/PlaceOrderInternal.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ static function p($cartId, $isGuest) {return dfw_encode((new self($cartId, $isGu
* @param M $m
* @param string $url
* @param array(string => mixed) $p [optional]
* @param bool $forceGet [optional]
*/
static function setRedirectData(M $m, $url, array $p = []) {$m->iiaSet(self::$REDIRECT_DATA, [
'p' => $p, 'url' => $url
]);}
static function setRedirectData(M $m, $url, array $p = [], $forceGet = false) {$m->iiaSet(
self::$REDIRECT_DATA, ['forceGet' => $forceGet, 'p' => $p, 'url' => $url]
);}

/**
* 2016-07-01
Expand Down
2 changes: 1 addition & 1 deletion Payment/lib/qa.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function dfp_error_message($message = null) {return nl2br(df_cc_n(
* @used-by \Dfe\CheckoutCom\Handler::p()
* @used-by \Dfe\CheckoutCom\Handler\CustomerReturn::p()
* @used-by \Dfe\CheckoutCom\Response::a()
* @used-by \Dfe\Qiwi\Init\Action::req()
* @used-by \Dfe\Qiwi\Init\Action::preorder()
* @used-by \Dfe\SecurePay\Refund::process()
* @used-by \Dfe\TwoCheckout\Handler::p()
* @param string|object $caller
Expand Down
15 changes: 10 additions & 5 deletions Payment/view/frontend/web/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,12 @@ return {
// 2017-04-05
// Отныне json у нас всегда строка: @see dfw_encode().
// Для не требующих перенаправления модулей эта строка пуста, и !json возвращает true.
/** @type {Object} */
/**
* @type {Object} d
* @type {Boolean=} d.forceGet
* @type {Object=} d.p
* @type {String=} d.url
*/
var d = !json ? {} : $.parseJSON(json);
// 2016-06-28
// Замечание 1.
Expand All @@ -386,10 +391,10 @@ return {
// window.checkoutConfig.defaultSuccessPageUrl отсутствует в версиях ранее 2.1.0:
// https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Checkout/Model/DefaultConfigProvider.php#L268
// By analogy with https://github.com/magento/magento2/blob/2.0.7/app/code/Magento/Checkout/view/frontend/web/js/action/place-order.js#L51
d.url && !df.o.e(d.p) ? rPost(d.url, df.o.merge(d.p, _this.postParams())) :
window.location.replace(d.url || lUrl.build(
window.checkoutConfig.defaultSuccessPageUrl || 'checkout/onepage/success/'
))
d.url && !df.o.e(d.p) && !d.forceGet ? rPost(d.url, df.o.merge(d.p, _this.postParams())) :
window.location.replace(d.url ? (df.o.e(d.p) ? d.url : d.url + '?' + $.param(d.p)) :
lUrl.build(window.checkoutConfig.defaultSuccessPageUrl || 'checkout/onepage/success/')
)
;
})
;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/core"
,"version": "2.11.32"
,"version": "2.11.33"
,"description": "Mage2.PRO core package."
,"type": "magento2-module"
,"homepage": "https://mage2.pro"
Expand Down

0 comments on commit 581c819

Please sign in to comment.