Skip to content

Commit

Permalink
0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Apr 13, 2017
1 parent 342ddd2 commit 2f258f6
Show file tree
Hide file tree
Showing 19 changed files with 501 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Block/Info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace Dfe\YandexKassa\Block;
// 2017-04-13
/** @final Unable to use the PHP «final» keyword here because of the M2 code generation. */
class Info extends \Df\Payment\Block\Info {
/**
* 2017-04-13
* @override
* @see \Df\Payment\Block\Info::prepare()
* @used-by \Df\Payment\Block\Info::_prepareSpecificInformation()
*/
final protected function prepare() {}
}
35 changes: 35 additions & 0 deletions Charge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
namespace Dfe\YandexKassa;
/**
* 2017-04-13
* @method Method m()
* @method Settings s()
*/
final class Charge extends \Df\PaypalClone\Charge {
/**
* 2017-04-13
* @override
* @see \Df\PaypalClone\Charge::pCharge()
* @used-by \Df\PaypalClone\Charge::p()
* @return array(string => mixed)
*/
protected function pCharge() {$s = $this->s(); return [];}

/**
* 2017-04-13
* @override
* @see \Df\PaypalClone\Charge::k_RequestId()
* @used-by \Df\PaypalClone\Charge::p()
* @return string
*/
protected function k_RequestId() {return '';}

/**
* 2017-04-13
* @override
* @see \Df\PaypalClone\Charge::k_Signature()
* @used-by \Df\PaypalClone\Charge::p()
* @return string
*/
protected function k_Signature() {return '';}
}
4 changes: 4 additions & 0 deletions ConfigProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
namespace Dfe\YandexKassa;
// 2017-04-13
final class ConfigProvider extends \Df\Payment\ConfigProvider {}
14 changes: 14 additions & 0 deletions Init/Action.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace Dfe\YandexKassa\Init;
// 2017-04-13
/** @method \Dfe\YandexKassa\Method m() */
final class Action extends \Df\PaypalClone\Init\Action {
/**
* 2017-04-13
* @override
* @see \Df\Payment\Init\Action::redirectUrl()
* @used-by \Df\Payment\Init\Action::action()
* @return string
*/
protected function redirectUrl() {return '';}
}
13 changes: 13 additions & 0 deletions Method.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace Dfe\YandexKassa;
// 2017-04-13
final class Method extends \Df\PaypalClone\Method {
/**
* 2017-04-13
* @override
* @see \Df\Payment\Method::amountLimits()
* @used-by \Df\Payment\Method::isAvailable()
* @return null
*/
protected function amountLimits() {return null;}
}
5 changes: 5 additions & 0 deletions Settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
namespace Dfe\YandexKassa;
// 2017-04-13
/** @method static Settings s() */
final class Settings extends \Df\Payment\Settings {}
26 changes: 26 additions & 0 deletions Signer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
namespace Dfe\YandexKassa;
/**
* 2017-04-13
* @see \Dfe\YandexKassa\Signer\Request
* @see \Dfe\YandexKassa\Signer\Response
* @method Settings s()
*/
abstract class Signer extends \Df\PaypalClone\Signer {
/**
* 2017-04-13
* @used-by sign()
* @see \Dfe\YandexKassa\Signer\Request::values()
* @see \Dfe\YandexKassa\Signer\Response::values()
* @return string[]
*/
abstract protected function values();

/**
* 2017-04-13
* @override
* @see \Df\PaypalClone\Signer::sign()
* @return string
*/
final protected function sign() {return implode($this->values());}
}
13 changes: 13 additions & 0 deletions Signer/Request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace Dfe\YandexKassa\Signer;
// 2017-04-13
final class Request extends \Dfe\YandexKassa\Signer {
/**
* 2017-04-13
* @override
* @see \Dfe\YandexKassa\Signer::values()
* @used-by \Dfe\YandexKassa\Signer::sign()
* @return string[]
*/
protected function values() {return dfa_select_ordered($this->v(), []);}
}
13 changes: 13 additions & 0 deletions Signer/Response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace Dfe\YandexKassa\Signer;
// 2017-04-13
final class Response extends \Dfe\YandexKassa\Signer {
/**
* 2017-04-13
* @override
* @see \Dfe\YandexKassa\Signer::values()
* @used-by \Dfe\YandexKassa\Signer::sign()
* @return string[]
*/
protected function values() {return dfa_select_ordered($this->v(), []);}
}
240 changes: 240 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
<?xml version='1.0'?>
<config
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:noNamespaceSchemaLocation='urn:magento:module:Df_Config:etc/system_file.xsd'
>
<system>
<section id='df_payment'>
<!--
2015-09-25
1-я и 2-я цифры sortOrder соответствуют порядковому номеру первой буквы модуля
в английском алфавите: https://en.wikipedia.org/wiki/English_alphabet
3-я и 4-я цифры sortOrder соответствуют порядковому номеру второй буквы модуля
в английском алфавите.
-->
<group
id='yandex_kassa'
translate='label'
type='text'
sortOrder='2501'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Yandex.Kassa</label>
<dfExtension>Dfe_YandexKassa</dfExtension>
<frontend_model>Df\Config\Fieldset</frontend_model>
<field
id='enable'
translate='label'
type='Df\Framework\Form\Element\Checkbox'
sortOrder='1'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Enable?</label>
<backend_model>Df\Config\Backend\Checkbox</backend_model>
<comment><![CDATA[Enable the «<a href='https://mage2.pro/c/extensions/yandex-kassa' target='_blank'>Yandex.Kassa</a>» payment extension?]]></comment>
</field>
<field
id='title'
translate='label'
type='text'
sortOrder='2'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Title</label>
<comment><![CDATA[It is shown on the checkout screen.]]></comment>
<depends><field id='enable'>1</field></depends>
<validate>required-entry</validate>
</field>
<field
id='test'
translate='label'
type='Df\Framework\Form\Element\Checkbox'
sortOrder='3'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Test Mode?</label>
<backend_model>Df\Config\Backend\Checkbox</backend_model>
<comment><![CDATA[]]></comment>
<depends><field id='enable'>1</field></depends>
</field>
<field
id='testPublicKey'
translate='label'
type='text'
sortOrder='4'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Test Public Key</label>
<comment><![CDATA[<a href='https://mage2.pro/c/extensions/yandex-kassa' target='_blank'>How to get it?</a>]]></comment>
<depends>
<field id='enable'>1</field>
<field id='test'>1</field>
</depends>
<validate>required-entry</validate>
</field>
<field
id='testPrivateKey'
translate='label'
type='obscure'
sortOrder='5'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Test Private Key</label>
<comment><![CDATA[<a href='https://mage2.pro/c/extensions/yandex-kassa' target='_blank'>How to get it?</a>]]></comment>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<depends>
<field id='enable'>1</field>
<field id='test'>1</field>
</depends>
<validate>required-entry</validate>
</field>
<field
id='livePublicKey'
translate='label'
type='text'
sortOrder='6'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Live Public Key</label>
<comment><![CDATA[]]></comment>
<depends>
<field id='enable'>1</field>
<field id='test'>0</field>
</depends>
<validate>required-entry</validate>
</field>
<field
id='livePrivateKey'
translate='label'
type='obscure'
sortOrder='7'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Live Private Key</label>
<comment><![CDATA[]]></comment>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<depends>
<field id='enable'>1</field>
<field id='test'>0</field>
</depends>
<validate>required-entry</validate>
</field>
<field
id='description'
translate='label'
type='textarea'
sortOrder='8'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Description</label>
<comment><![CDATA[It will be displayed to you in the Yandex.Kassa merchant interface alongside the payment.
<br/>Up to 100 characters.
<br/>You can use <a href='https://mage2.pro/t/1834' target='_blank'>variables</a> in the description.]]></comment>
<!--
2016-07-01
Не используем здесь validate-length, потому что описание допускает параметры,
и реальная длина описания нам не известна вплоть до момента вычисления значения этих параметров.
-->
<validate>required-entry</validate>
<depends><field id='enable'>1</field></depends>
</field>
<field
id='requireBillingAddress'
translate='label'
type='Df\Framework\Form\Element\Checkbox'
sortOrder='16'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Require the billing address?</label>
<backend_model>Df\Config\Backend\Checkbox</backend_model>
<comment><![CDATA[If <b>checked</b>, Magento will require the billing address. It is the default Magento behaviour.<br/>If <b>unchecked</b>, Magento will not require the billing address, and even will not ask for it.]]></comment>
<depends><field id='enable'>1</field></depends>
</field>
<field
id='min_order_total'
translate='label'
type='text'
sortOrder='19'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Minimum Order Total</label>
<comment><![CDATA[]]></comment>
<validate>validate-number validate-greater-than-zero</validate>
<depends><field id='enable'>1</field></depends>
</field>
<field
id='max_order_total'
translate='label'
type='text'
sortOrder='20'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Maximum Order Total</label>
<comment><![CDATA[]]></comment>
<validate>validate-number validate-greater-than-zero</validate>
<depends><field id='enable'>1</field></depends>
</field>
<field
id='country_restriction'
translate='label'
type='select'
sortOrder='21'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Country Restriction</label>
<source_model>Df\Config\Source\NoWhiteBlack</source_model>
<depends><field id='enable'>1</field></depends>
</field>
<field
id='countries'
translate='label'
type='Df\Framework\Form\Element\Multiselect'
sortOrder='22'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
<depends>
<field id='enable'>1</field>
<!--
2016-03-08
«The negative syntax for a backend config field <depends> condition»
https://mage2.pro/t/329
-->
<field id='country_restriction' negative='1'>0</field>
</depends>
<comment><![CDATA[Customers from which countries can (or can not) use the method?]]></comment>
</field>
</group>
</section>
</system>
</config>
Loading

0 comments on commit 2f258f6

Please sign in to comment.