<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <record id="payment_provider_form" model="ir.ui.view">
        <field name="name">Poynt Provider Form</field>
        <field name="model">payment.provider</field>
        <field name="inherit_id" ref="payment.payment_provider_form"/>
        <field name="arch" type="xml">
            <group name="provider_credentials" position="inside">
                <group invisible="code != 'poynt'" name="poynt_credentials">
                    <field name="poynt_application_id"
                           required="code == 'poynt' and state != 'disabled'"
                           placeholder="urn:aid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"/>
                    <field name="poynt_private_key"
                           required="code == 'poynt' and state != 'disabled'"
                           widget="text"
                           placeholder="-----BEGIN RSA PRIVATE KEY-----&#10;...&#10;-----END RSA PRIVATE KEY-----"/>
                    <field name="poynt_business_id"
                           required="code == 'poynt' and state != 'disabled'"
                           placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"/>
                    <field name="poynt_store_id"
                           placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"/>
                    <label for="poynt_webhook_secret"/>
                    <div class="o_row" col="2">
                        <field name="poynt_webhook_secret" password="True"/>
                    </div>
                    <field name="poynt_default_terminal_id"/>
                </group>
            </group>
            <group name="provider_credentials" position="after">
                <group string="Poynt Actions"
                       invisible="code != 'poynt'" name="poynt_actions"
                       col="4">
                    <button string="Test Connection"
                            type="object"
                            name="action_poynt_test_connection"
                            class="btn-primary"
                            invisible="not poynt_application_id or not poynt_private_key or not poynt_business_id"
                            colspan="2"/>
                    <button string="Fetch Terminals"
                            type="object"
                            name="action_poynt_fetch_terminals"
                            class="btn-secondary"
                            invisible="not poynt_business_id"
                            colspan="2"/>
                </group>
            </group>
        </field>
    </record>

</odoo>
