<!--
 SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
 SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
    {{( pgettext "Booking Payment" "title" )}}
{{- end }}

{{ define "head" -}}
    {{ template "alpineScript" }}
{{- end }}

{{ define "content" -}}
    {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/payment.paymentPage*/ -}}
    <h2>{{ template "title" . }}</h2>
    {{ template "details.gohtml" .Payment }}
    {{ with .Request -}}
        <p>{{( gettext "Thank you for your booking. Please, click the button below to pay with a credit card via Servired/Redsys.")}}</p>
        <form id="payment" method="post" x-init="$el.submit()"
                {{- if eq $.Environment "live" }} action="https://sis.redsys.es/sis/realizarPago"
                {{- else }} action="https://sis-t.redsys.es:25443/sis/realizarPago"
                {{- end -}}
        >
            <input type="hidden" name="Ds_MerchantParameters" value="{{ .MerchantParameters }}"/>
            <input type="hidden" name="Ds_Signature" value="{{ .Signature }}"/>
            <input type="hidden" name="Ds_SignatureVersion" value="{{ .SignatureVersion }}"/>
            <button type="submit">{{( pgettext "Pay with credit card" "action" )}}</button>
        </form>
        <dialog class="redirect" x-init="$el.showModal()">
            <p>{{( gettext "Please, wait until we redirect you to the payment page.")}}</p>
        </dialog>
    {{- end }}
{{- end }}
