<?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="ewayrapid" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Eway Rapid - {value}</label>
                <fieldset_css>complex eway-section</fieldset_css>
                <comment><![CDATA[Effortless online payments]]></comment>
                <frontend_model>Eway\EwayRapid\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
                <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                    <label>Enable this solution</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <group id="heading_basic_settings" translate="label" type="text" sortOrder="500" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Basic Settings</label>
                    <field id="title" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                        <label>Title</label>
                        <config_path>payment/ewayrapid/title</config_path>
                    </field>
                    <field id="connection_type" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Connection Type</label>
                        <source_model>\Eway\EwayRapid\Model\Config\Source\ConnectionType</source_model>
                        <config_path>payment/ewayrapid/connection_type</config_path>
                    </field>
                    <field id="payment_action" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Payment Action</label>
                        <source_model>\Eway\EwayRapid\Model\Config\Source\PaymentAction</source_model>
                        <config_path>payment/ewayrapid/payment_action</config_path>
                    </field>
                </group>

                <group id="heading_mode" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>
                        <![CDATA[
                                Eway Rapid 3.1.2 Mode
                                <p style="font-size: 1.2rem">
                                    All below credentials are required for this payment method to be active
                                </p>
                            ]]>
                    </label>

                    <field id="mode" type="select" translate="label" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Mode</label>
                        <source_model>\Eway\EwayRapid\Model\Config\Source\Mode</source_model>
                        <config_path>payment/ewayrapid/mode</config_path>
                    </field>
                    <field id="live_api_key" translate="label" type="obscure" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0">
                        <label>Live API Key</label>
                        <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
                        <depends>
                            <field id="mode">live</field>
                        </depends>
                        <config_path>payment/ewayrapid/live_api_key</config_path>
                    </field>
                    <field id="live_api_password" translate="label" type="obscure" sortOrder="230" showInDefault="1" showInWebsite="1" showInStore="0">
                        <label>Live API Password</label>
                        <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
                        <depends>
                            <field id="mode">live</field>
                        </depends>
                        <comment>
                            <![CDATA[<a href="https://go.eway.io/s/article/How-do-I-setup-my-Live-eWAY-API-Key-and-Password" target="_blank">How to generate Live Rapid 3.1 API Key and Password</a>]]>
                        </comment>
                        <config_path>payment/ewayrapid/live_api_password</config_path>
                    </field>
                    <field id="sandbox_api_key" translate="label" type="obscure" sortOrder="260" showInDefault="1" showInWebsite="1" showInStore="0">
                        <label>Sandbox API Key</label>
                        <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
                        <depends>
                            <field id="mode">sandbox</field>
                        </depends>
                        <config_path>payment/ewayrapid/sandbox_api_key</config_path>
                    </field>
                    <field id="sandbox_api_password" translate="label" type="obscure" sortOrder="270" showInDefault="1" showInWebsite="1" showInStore="0">
                        <label>Sandbox API Password</label>
                        <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
                        <depends>
                            <field id="mode">sandbox</field>
                        </depends>
                        <comment>
                            <![CDATA[<a href="https://go.eway.io/s/article/How-do-I-set-up-my-Sandbox-API-Key-and-password" target="_blank">How to generate Sandbox Rapid 3.1 API Key and Password</a>]]>
                        </comment>
                        <config_path>payment/ewayrapid/sandbox_api_password</config_path>
                    </field>
                </group>

                <group id="heading_token_settings" translate="label" type="text" sortOrder="1500" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Token Payment Settings</label>
                    <field id="token_enabled" type="select" translate="label" sortOrder="310" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Enable Token Payment</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <config_path>payment/ewayrapid/token_enabled</config_path>
                    </field>
                    <field id="save_text" type="text" translate="label" sortOrder="320" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                        <label>Save Card Label</label>
                        <depends>
                            <field id="token_enabled">1</field>
                        </depends>
                        <config_path>payment/ewayrapid/save_text</config_path>
                    </field>
                    <field id="save_card_checked" type="select" translate="label" sortOrder="330" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Default Check</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <depends>
                            <field id="token_enabled">1</field>
                        </depends>
                        <config_path>payment/ewayrapid/save_card_checked</config_path>
                    </field>
                    <field id="can_edit_token" type="select" translate="label" sortOrder="400" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Customer can edit token</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <depends>
                            <field id="token_enabled">1</field>
                        </depends>
                        <config_path>payment/ewayrapid/can_edit_token</config_path>
                    </field>
                </group>

                <group id="heading_advanced_settings" translate="label" type="text" sortOrder="2000" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Advanced Settings</label>
                    <field id="block_fraud_customers" type="select" translate="label" sortOrder="550" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Block Suspected Fraud Customers</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <comment>
                            <![CDATA[If enabled, customers who place a Suspected Fraud order will be blocked from placing a new order
                            until the earlier order is accepted or unblocked by admin.]]>
                        </comment>
                        <config_path>payment/ewayrapid/block_fraud_customers</config_path>
                    </field>
                    <field id="useccv" type="select" translate="label" sortOrder="600" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Require CVN</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <comment>
                            <![CDATA[Eway strongly recommends enabling CVN to help prevent fraud. Many banks require it.]]>
                        </comment>
                        <config_path>payment/ewayrapid/useccv</config_path>
                    </field>
                    <field id="cctypes" type="multiselect" translate="label" sortOrder="700" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Accepted Credit Cards</label>
                        <source_model>\Eway\EwayRapid\Model\Config\Source\Cctype</source_model>
                        <comment>
                            <![CDATA[Visa Electron and Maestro are accepted in the UK only.]]>
                        </comment>
                        <config_path>payment/ewayrapid/cctypes</config_path>
                    </field>
                    <field id="allowspecific" translate="label" type="allowspecific" sortOrder="800" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Payment from Applicable Countries</label>
                        <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
                        <config_path>payment/ewayrapid/allowspecific</config_path>
                    </field>
                    <field id="specificcountry" translate="label" type="multiselect" sortOrder="900" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Payment from Specific Countries</label>
                        <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
                        <config_path>payment/ewayrapid/specificcountry</config_path>
                    </field>
                    <field id="order_status" type="select" translate="label" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>New Order Status</label>
                        <source_model>\Eway\EwayRapid\Model\Config\Source\OrderStatus</source_model>
                        <backend_model>\Eway\EwayRapid\Model\Config\Backend\OrderStatus</backend_model>
                        <comment>
                            <![CDATA[If you have changed Payment Action, please save the config before updating this field.]]>
                        </comment>
                        <config_path>payment/ewayrapid/order_status</config_path>
                    </field>
                    <field id="transfer_cart_items" type="select" translate="label" sortOrder="1100" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Transfer Cart Line Items</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <comment>
                            <![CDATA[Used by Eway Fraud Alerts (Enterprise) to calculate a risk score.]]>
                        </comment>
                        <config_path>payment/ewayrapid/transfer_cart_items</config_path>
                    </field>
                    <field id="invoice_reference" type="select" translate="label" sortOrder="1110" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Invoice Reference</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <comment>
                            <![CDATA[Send order id as Invoice Reference.]]>
                        </comment>
                        <config_path>payment/ewayrapid/invoice_reference</config_path>
                    </field>
                    <field id="invoice_description" type="select" translate="label" sortOrder="1120" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Invoice Description</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <comment>
                            <![CDATA[Send order items as Invoice Description.]]>
                        </comment>
                        <config_path>payment/ewayrapid/invoice_description</config_path>
                    </field>

                    <field id="debug" type="select" translate="label" sortOrder="1200" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Debug</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <config_path>payment/ewayrapid/debug</config_path>
                    </field>
                    <field id="sort_order" translate="label" type="text" sortOrder="1300" showInDefault="1" showInWebsite="1" showInStore="0">
                        <label>Sort Order</label>
                        <frontend_class>validate-number</frontend_class>
                        <config_path>payment/ewayrapid/sort_order</config_path>
                    </field>

                    <field id="hide_payment_method" type="select" translate="label" sortOrder="1500" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Hide Payment Method If Outside Cart Totals</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <comment>
                            <![CDATA[If set to No, then Eway will still appear as an option in the checkout, however the customer will receive the Cart Total Messages defined below when their order falls outside your accepted range.]]>
                        </comment>
                        <config_path>payment/ewayrapid/hide_payment_method</config_path>
                    </field>
                    <field id="min_max_scope" type="select" translate="label" sortOrder="1600" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Enforcing Minimum-Maximum Totals</label>
                        <source_model>\Eway\EwayRapid\Model\Config\Source\EnforcingScope</source_model>
                        <comment>
                            <![CDATA[Enforce on customer side only or both customer and admin side.]]>
                        </comment>
                        <config_path>payment/ewayrapid/min_max_scope</config_path>
                    </field>
                    <field id="min_cart_total" translate="label" type="text" sortOrder="1700" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Minimum Cart Totals</label>
                        <validate>validate-number validate-zero-or-greater</validate>
                        <comment>
                            <![CDATA[The minimum cart totals of the order for Eway payment method. Setting zero as a min value will mean no minimum value is enforced.]]>
                        </comment>
                        <config_path>payment/ewayrapid/min_cart_total</config_path>
                    </field>
                    <field id="min_cart_total_message" translate="label" type="textarea" sortOrder="1800" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Minimum Cart Totals Message</label>
                        <comment>
                            <![CDATA[{$value} will be replaced with the amount you've entered in the minimum cart total field.]]>
                        </comment>
                        <config_path>payment/ewayrapid/min_cart_total_message</config_path>
                    </field>
                    <field id="max_cart_total" translate="label" type="text" sortOrder="1900" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Maximum Cart Totals</label>
                        <validate>validate-number validate-zero-or-greater validate-minimum-greater</validate>
                        <comment>
                            <![CDATA[The maximum cart totals of the order for Eway payment method. Setting zero as a min value will mean no maximum value is enforced.]]>
                        </comment>
                        <config_path>payment/ewayrapid/max_cart_total</config_path>
                    </field>
                    <field id="max_cart_total_message" translate="label" type="textarea" sortOrder="2000" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Maximum Cart Totals Message</label>
                        <comment>
                            <![CDATA[{$value} will be replaced with the amount you've entered in the maximum cart total field.]]>
                        </comment>
                        <config_path>payment/ewayrapid/max_cart_total_message</config_path>
                    </field>
                    <field id="three_d_secure_two_enabled" type="select" translate="label" sortOrder="2100" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Enable 3DS 2.0</label>
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                        <comment>
                            <![CDATA[Only Direct Connection and Sercure Fields are supported by 3DS 2.0. Others are controlled by Eway account configuration. ]]>
                        </comment>
                        <config_path>payment/ewayrapid/three_d_secure_two_enabled</config_path>
                    </field>
                    <field id="three_d_secure_two_verification_type" type="select" translate="label" sortOrder="2200" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>3DS 2.0 Verification Type</label>
                        <source_model>\Eway\EwayRapid\Model\Config\Source\ThreeDSecureVerificationType</source_model>
                        <comment>
                            <![CDATA[Redirecting the customer to the verification endpoint or opening it in a popup window using the 3DS SDK.]]>
                        </comment>
                        <config_path>payment/ewayrapid/three_d_secure_two_verification_type</config_path>
                    </field>
                    <field id="sandbox_javascript_sdk" translate="label" type="text" sortOrder="2300" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Sandbox 3DS Javascript SDK</label>
                        <config_path>payment/ewayrapid/sandbox_javascript_sdk</config_path>
                    </field>
                    <field id="live_javascript_sdk" translate="label" type="text" sortOrder="2400" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                        <label>Live 3DS Javascript SDK</label>
                        <config_path>payment/ewayrapid/live_javascript_sdk</config_path>
                    </field>
                </group>
            </group>
        </section>
    </system>
</config>
