Skip to content

Commit

Permalink
0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Sep 25, 2017
1 parent dc93e79 commit dfeb053
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 9 deletions.
23 changes: 20 additions & 3 deletions Charge.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Dfe\YandexKassa;
use Dfe\YandexKassa\Source\Option;
/**
* 2017-09-16
* The charge parameters are specified here:
Expand Down Expand Up @@ -91,7 +92,7 @@ protected function k_Signature() {return null;}
* @used-by \Df\PaypalClone\Charge::p()
* @return array(string => mixed)
*/
protected function pCharge() {$s = $this->s(); return [
protected function pCharge() {$s = $this->s(); $o = $this->m()->option(); return [
/**
* 2017-09-16
* Note 1.
Expand Down Expand Up @@ -157,7 +158,7 @@ protected function pCharge() {$s = $this->s(); return [
* ».
* Type: normalizedString, 5 characters.
*/
,'paymentType' => $this->m()->option()
,'paymentType' => $o
/**
* 2017-09-16
* «ID of the payment form, issued during activation of Yandex.Checkout».
Expand Down Expand Up @@ -304,5 +305,21 @@ protected function pCharge() {$s = $this->s(); return [
* https://tech.yandex.ru/money/doc/payment-solution/payment-form/payment-form-http-docpage
*/
,'shopSuccessUrl'
], $this->customerReturnRemote());}
], $this->customerReturnRemote())
+ ($o && Option::LOAN !== $o ? [] : [
/**
* 2017-09-25 «Provide the 1 year only loan term?»
* In English:
* «If this parameter is set to true, the bank is passed a fixed loan term of 12 months.
* This is necessary for displaying the monthly loan repayment next to the product price.
* For example, "Refrigerator for 3000 rubles a month".
* This makes the monthly payment equal to 10% of the price.»
* In Russian:
* «Если этот параметр равен true, в банк передается фиксированный срок кредита — 12 месяцев.
* Это нужно для отображения ежемесячного платежа по кредиту рядом со стоимостью товара.
* Например: «Холодильник за 3000 рублей в месяц».
* Ежемесячный платеж в таком случае равен 10% от стоимости.»
*/
'fixed_term' => $s->b('provide1YearOnlyLoanTerm')
]);}
}
6 changes: 6 additions & 0 deletions Source/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ function(array $a) {return dfa_deep($a, 'title/' . df_lang_ru_en());}
dfa($a, 'hideOnCheckout')
);})
));}

/**
* 2017-09-25
* @used-by \Dfe\YandexKassa\Charge::pCharge()
*/
const LOAN = 'KV';
}
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.4"
,"version": "0.2.5"
,"description": "The «Yandex.Kassa» (Яндекс.Касса, Yandex.Checkout) payment extension for Magento 2."
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/yandex-kassa"
Expand Down
29 changes: 24 additions & 5 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,32 @@
</depends>
</field>
<field
id='requireBillingAddress'
id='provide1YearOnlyLoanTerm'
translate='label'
type='Df\Framework\Form\Element\Checkbox'
sortOrder='16'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Provide the 1 year only loan term?</label>
<backend_model>Df\Config\Backend\Checkbox</backend_model>
<comment><![CDATA[
This option is used only for <a href='https://tech.yandex.com/money/doc/payment-solution/payment-process/payments-credit-docpage/' target='_blank' title='«Description of the payment process» → «Payment by credit»'>instant loans</a> (<a href='https://www.kupivkredit.ru' target='_blank'>KupiVkredit</a> - Tinkoff Bank).
<br/>If it is <b>checked</b>, then the bank is passed a fixed loan term of 12 months.
<br/>This is necessary for displaying the monthly loan repayment next to the product price.
<br/>For example, «Refrigerator for 3000 rubles a month».
<br/>This makes the <b>monthly</b> payment equal to <b>10%</b> of the price.]]></comment>
<depends><field id='enable'>1</field></depends>
</field>
<field
id='requireBillingAddress'
translate='label'
type='Df\Framework\Form\Element\Checkbox'
sortOrder='26'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Require the billing address?</label>
<backend_model>Df\Config\Backend\Checkbox</backend_model>
Expand All @@ -248,7 +267,7 @@
id='min_order_total'
translate='label'
type='text'
sortOrder='19'
sortOrder='27'
showInDefault='1'
showInWebsite='1'
showInStore='1'
Expand All @@ -262,7 +281,7 @@
id='max_order_total'
translate='label'
type='text'
sortOrder='20'
sortOrder='28'
showInDefault='1'
showInWebsite='1'
showInStore='1'
Expand All @@ -276,7 +295,7 @@
id='country_restriction'
translate='label'
type='select'
sortOrder='21'
sortOrder='29'
showInDefault='1'
showInWebsite='1'
showInStore='1'
Expand All @@ -289,7 +308,7 @@
id='countries'
translate='label'
type='Df\Framework\Form\Element\Multiselect'
sortOrder='22'
sortOrder='30'
showInDefault='1'
showInWebsite='1'
showInStore='1'
Expand Down

0 comments on commit dfeb053

Please sign in to comment.