Skip to content

Commit

Permalink
Create remaining configuration settings mcspronko#16
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolalardev committed Aug 29, 2019
1 parent 5d05bfd commit 1b9d21b
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 1 deletion.
36 changes: 36 additions & 0 deletions admin/Source/Currencies.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Copyright © Pronko Consulting (https://www.pronkoconsulting.com)
* See LICENSE for the license details.
*/
declare(strict_types=1);

namespace Pronko\LiqPayAdmin\Source;

use Magento\Framework\Data\OptionSourceInterface;

/**
* Class ConnectionType
*/
class Currencies implements OptionSourceInterface
{
const USD = 'USD';
const EUR = 'EUR';
const RUB = 'RUB';
const UAH = 'UAH';

/**
* Return array of options as value-label pairs
*
* @return array Format: array(array('value' => '<value>', 'label' => '<label>'), ...)
*/
public function toOptionArray()
{
return [
['value' => self::USD, 'label' => __(self::USD)],
['value' => self::EUR, 'label' => __(self::EUR)],
['value' => self::RUB, 'label' => __(self::RUB)],
['value' => self::UAH, 'label' => __(self::UAH)]
];
}
}
31 changes: 31 additions & 0 deletions admin/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
<source_model>Pronko\LiqPayAdmin\Source\ConnectionType</source_model>
<config_path>payment/pronko_liqpay/connection_type</config_path>
</field>
<field id="payment_action" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<label>Payment Action</label>
<source_model>Magento\AuthorizenetAcceptjs\Model\Adminhtml\Source\PaymentAction</source_model>
<config_path>payment/pronko_liqpay/payment_action</config_path>
</field>
</group>
<group id="pronko_liqpay_account" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="5">
<label>Account Settings</label>
Expand Down Expand Up @@ -68,6 +73,32 @@
<config_path>payment/pronko_liqpay/production_private_key</config_path>
</field>
</group>
<group id="pronko_liqpay_advanced" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="10">
<label>Advanced Settings</label>
<attribute type="expanded">0</attribute>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="minimum_order_total" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Minimum Order Total</label>
<config_path>payment/pronko_liqpay/minimum_order_total</config_path>
</field>
<field id="maximum_order_total" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Maximum Order Total</label>
<config_path>payment/pronko_liqpay/maximum_order_total</config_path>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Sort Total</label>
<config_path>payment/pronko_liqpay/sort_order</config_path>
</field>
<field id="order_status" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<label>New Order Status</label>
<source_model>Magento\Sales\Model\Config\Source\Order\Status\Processing</source_model>
</field>
<field id="accepted_currencies" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Accepted Currencies</label>
<source_model>Pronko\LiqPayAdmin\Source\Currencies</source_model>
<config_path>payment/pronko_liqpay/mode</config_path>
</field>
</group>
</group>
</group>
</section>
Expand Down
21 changes: 21 additions & 0 deletions admin/etc/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<pronko_liqpay_section>
<pronko_liqpay>
<pronko_liqpay_general>
<payment_action>
<payment_action>authorize</payment_action>
</payment_action>
</pronko_liqpay_general>
<pronko_liqpay_advanced>
<order_status>processing</order_status>
<accepted_currencies>USD</accepted_currencies>
</pronko_liqpay_advanced>
</pronko_liqpay>
</pronko_liqpay_section>
</payment>
</default>
</config>
6 changes: 5 additions & 1 deletion admin/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Pronko_LiqPayAdmin" />
<module name="Pronko_LiqPayAdmin">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
</config>
23 changes: 23 additions & 0 deletions card-admin/Model/Source/Cctype.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* Copyright © Pronko Consulting (https://www.pronkoconsulting.com)
* See LICENSE for the license details.
*/
declare(strict_types=1);

namespace Pronko\LiqPayCardAdmin\Model\Source;

use Magento\Payment\Model\Source\Cctype as PaymentCctype;

class Cctype extends PaymentCctype
{
/**
* Return all supported credit card types
*
* @return string[]
*/
public function getAllowedTypes()
{
return ['VI', 'MC', 'AE', 'DI', 'JCB', 'DN'];
}
}
24 changes: 24 additions & 0 deletions card-admin/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="payment">
<group id="pronko_liqpay_section" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
<group id="pronko_liqpay" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>LiqPay</label>
<fieldset_css>complex</fieldset_css>
<attribute type="displayIn">other_payment_methods</attribute>
<group id="pronko_liqpay_card_payment" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="5">
<label>Card Payment</label>
<attribute type="expanded">1</attribute>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="cctypes" translate="label" type="multiselect" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<label>Credit Card Types</label>
<source_model>Pronko\LiqPayCardAdmin\Model\Source\Cctype</source_model>
</field>
</group>
</group>
</group>
</section>
</system>
</config>
1 change: 1 addition & 0 deletions modman
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
./api app/code/Pronko/LiqPayApi
./sdk app/code/Pronko/LiqPaySdk
./customer app/code/Pronko/LiqPayCustomer
./card-admin app/code/Pronko/LiqPayCardAdmin

0 comments on commit 1b9d21b

Please sign in to comment.