Skip to content

Commit

Permalink
0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Sep 25, 2017
1 parent dfeb053 commit ed70373
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
27 changes: 24 additions & 3 deletions Charge.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Dfe\YandexKassa;
use Dfe\YandexKassa\Source\Option;
use Magento\Sales\Model\Order\Item as OI;
/**
* 2017-09-16
* The charge parameters are specified here:
Expand Down Expand Up @@ -306,7 +307,27 @@ protected function pCharge() {$s = $this->s(); $o = $this->m()->option(); return
*/
,'shopSuccessUrl'
], $this->customerReturnRemote())
+ ($o && Option::LOAN !== $o ? [] : [
+ ($o && Option::LOAN !== $o ? [] : $this->pLoan());}

/**
* 2017-09-25
* @used-by pCharge()
* @return array(string => mixed)
*/
private function pLoan() {return
dfa_flatten(df_map_k(
function($i, array $a) {return dfa_key_transform($a, function($k) use($i) {return "{$k}_{$i}";});}
,$this->oiLeafs(function(OI $i) {return [
// 2017-09-25 «Price per product unit» / «Стоимость единицы товара». Optional, CurrencyAmount.
'goods_cost' => $this->amountFormat(df_oqi_price($i, true))
// 2017-09-25 «Product description» / «Описание товара». Optional, String(255).
,'goods_description' => df_oqi_desc($i, 255)
// 2017-09-25 «Название товара» / «Product name». Optional, String(255).
,'goods_name' => $i->getName()
// 2017-09-25 «Number of units of the product» / «Количество единиц товара». Optional, Int.
,'goods_quantity' => df_oqi_qty($i)
];})
))
/**
* 2017-09-25 «Provide the 1 year only loan term?»
* In English:
Expand All @@ -320,6 +341,6 @@ protected function pCharge() {$s = $this->s(); $o = $this->m()->option(); return
* Например: «Холодильник за 3000 рублей в месяц».
* Ежемесячный платеж в таком случае равен 10% от стоимости.»
*/
'fixed_term' => $s->b('provide1YearOnlyLoanTerm')
]);}
+ ['fixed_term' => $this->s()->b('provide1YearOnlyLoanTerm')]
;}
}
7 changes: 7 additions & 0 deletions Source/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
namespace Dfe\YandexKassa\Source;
/**
* 2017-09-16
* 2017-09-25
* [Yandex.Kassa] The payment options: https://mage2.pro/t/4494
* https://tech.yandex.com/money/doc/payment-solution/reference/payment-type-codes-docpage
* https://tech.yandex.ru/money/doc/payment-solution/reference/payment-type-codes-docpage
*
* @method static Option s()
* @used-by \Dfe\YandexKassa\Settings::options()
*/
Expand Down Expand Up @@ -37,6 +42,8 @@ function(array $a) {return dfa_deep($a, 'title/' . df_lang_ru_en());}

/**
* 2017-09-25
* «В Яндекс.Кассе появилось POS-кредитование от Тинькофф Банка»:
* https://roem.ru/24-09-2015/207831/yandex-kassa-credit
* @used-by \Dfe\YandexKassa\Charge::pCharge()
*/
const LOAN = 'KV';
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/yandex-kassa"
,"version": "0.2.5"
,"version": "0.2.6"
,"description": "The «Yandex.Kassa» (Яндекс.Касса, Yandex.Checkout) payment extension for Magento 2."
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/yandex-kassa"
Expand Down

0 comments on commit ed70373

Please sign in to comment.