@model Nop.Plugin.Payments.Qualpay.Models.ConfigurationModel;

@{
    Layout = "_ConfigurePlugin";
}

@await Component.InvokeAsync("StoreScopeConfiguration")

<form asp-controller="Qualpay" asp-action="Configure" method="post">
    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-body">
                <p>
                    Please enter your email to receive an information about special offers from Qualpay
                </p>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="MerchantEmail" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="MerchantEmail" />
                        <span asp-validation-for="MerchantEmail"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <input type="submit" name="subscribe" class="btn btn-primary" value="@T("Plugins.Payments.Qualpay.Subscribe")" />
                    </div>
                </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-body">
                <p>
                    To configure the Qualpay plugin for nopCommerce.<br />
                    <br />
                    1. Decide if you'd like to run Sandbox (test) or Production (live) transactions.<br />
                    2. If you don't have a Qualpay account, use the links below to create one.<br />
                        &emsp;a. <a href="https://app-test.qualpay.com/login/signup" target="_blank">Sign up for a Qualpay sandbox account</a>.<br />
                        &emsp;b. <a href="https://www.qualpay.com/get-started/nopcommerce " target="_blank">Apply for a Qualpay production account</a>.<br />
                    3. Log into either the <a href="https://app-test.qualpay.com" target="_blank">Qualpay sandbox</a> or <a href="https://app.qualpay.com" target="_blank">Qualpay production</a> environment to retrieve your security keys.<br />
                    4. On the main menu to the left, select "Administration" then "API Security Keys".<br />
                    5. In the "Key Detail" section, locate your Merchant ID and click the clipboard icon to copy your merchant ID.<br />
                    6. Paste your Merchant ID below in the Merchant ID field.<br />
                    7. In "Manage Access" enable the following API's<br />
                        &emsp;a. Payment Gateway API<br />
                        &emsp;b. Embedded Fields API<br />
                        &emsp;c. Customer Vault API<br />
                        &emsp;d. Recurring Billing API<br />
                        &emsp;e. Webhook API<br />
                    8. Click "Generate".<br />
                    9. Click on the clipboard icon to copy your Security Key.<br />
                    10. Paste your Security Key below.<br />
                    11. Save the configuration.<br />
                </p>
                <p>
                    <em>Notes:</em><br />
                    For this plugin to work properly ensure that you have set your primary store currency to USD.<br />
                    Qualpay Sandbox (test) or Production (live) are unique. For example, you may not use a Sandbox (test) Merchant ID and Security Key to run Production (live) transactions.<br />
                </p>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="MerchantId" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="MerchantId" asp-required="true" />
                        <span asp-validation-for="MerchantId"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="SecurityKey" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="SecurityKey" asp-required="true" />
                        <span asp-validation-for="SecurityKey"></span>
                    </div>
                </div>
                @if (Model.IsConfigured)
                {
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-override-store-checkbox asp-for="UseSandbox_OverrideForStore" asp-input="UseSandbox" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                            <nop-label asp-for="UseSandbox" />
                        </div>
                        <div class="col-md-9">
                            <nop-editor asp-for="UseSandbox" />
                            <span asp-validation-for="UseSandbox"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-override-store-checkbox asp-for="UseEmbeddedFields_OverrideForStore" asp-input="UseEmbeddedFields" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                            <nop-label asp-for="UseEmbeddedFields" />
                        </div>
                        <div class="col-md-9">
                            <nop-editor asp-for="UseEmbeddedFields" />
                            <span asp-validation-for="UseEmbeddedFields"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-override-store-checkbox asp-for="UseCustomerVault_OverrideForStore" asp-input="UseCustomerVault" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                            <nop-label asp-for="UseCustomerVault" />
                        </div>
                        <div class="col-md-9">
                            <nop-editor asp-for="UseCustomerVault" />
                            <span asp-validation-for="UseCustomerVault"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-override-store-checkbox asp-for="UseRecurringBilling_OverrideForStore" asp-input="UseRecurringBilling" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                            <nop-label asp-for="UseRecurringBilling" />
                        </div>
                        <div class="col-md-9">
                            <nop-editor asp-for="UseRecurringBilling" />
                            <span asp-validation-for="UseRecurringBilling"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="ProfileId" />
                        </div>
                        <div class="col-md-9">
                            <nop-editor asp-for="ProfileId" />
                            <span asp-validation-for="ProfileId"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-override-store-checkbox asp-for="PaymentTransactionTypeId_OverrideForStore" asp-input="PaymentTransactionTypeId" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                            <nop-label asp-for="PaymentTransactionTypeId" />
                        </div>
                        <div class="col-md-9">
                            <nop-select asp-for="PaymentTransactionTypeId" asp-items="Model.PaymentTransactionTypes" />
                            <span asp-validation-for="PaymentTransactionTypeId"></span>
                        </div>
                    </div>
                }
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="AdditionalFee_OverrideForStore" asp-input="AdditionalFee" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="AdditionalFee" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AdditionalFee" />
                        <span asp-validation-for="AdditionalFee"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="AdditionalFeePercentage_OverrideForStore" asp-input="AdditionalFeePercentage" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="AdditionalFeePercentage" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AdditionalFeePercentage" />
                        <span asp-validation-for="AdditionalFeePercentage"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <input type="submit" name="save" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>