Add a warning on the booking page when payment is using test environment

Apparently, the bank has to validate the fucking thing on the actual
domain, because of reasons, so we have to replace the current web in
production with this version in test mode, meaning that users **will**
believe they have paid, when in fact they have not.

The warning is for these few people that actually read such notices.
This commit is contained in:
jordi fita mas 2024-02-26 16:00:29 +01:00
parent 950bae16e1
commit 23e2fe956f
6 changed files with 38 additions and 10 deletions

View File

@ -58,6 +58,7 @@ type publicPage struct {
*template.PublicPage
Form *bookingForm
HasErrors bool
Environment string
}
func newPublicPage(r *http.Request, company *auth.Company, conn *database.Conn, l *locale.Locale) (*publicPage, error) {
@ -77,8 +78,7 @@ func newPublicPageWithForm(form *bookingForm) *publicPage {
func (p *publicPage) MustRender(w http.ResponseWriter, r *http.Request, user *auth.User, company *auth.Company, conn *database.Conn) {
p.Setup(r, user, company, conn)
var err error
if err != nil {
if err := conn.QueryRow(r.Context(), "select environment from redsys where company_id = $1", company.ID).Scan(&p.Environment); err != nil && !database.ErrorIsNotFound(err) {
panic(err)
}
if httplib.IsHTMxRequest(r) {

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2024-02-24 19:56+0100\n"
"POT-Creation-Date: 2024-02-26 15:55+0100\n"
"PO-Revision-Date: 2024-02-06 10:04+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Catalan <ca@dodds.net>\n"
@ -649,6 +649,10 @@ msgstr "<abbr title=\"Número\">Núm.</abbr> <abbr title=\"Registre de Turisme d
msgid "Sorry, there was a problem. Youll find more details highlighted below."
msgstr "Hi ha hagut un problema. Trobeu més informació ressaltada a baix."
#: web/templates/public/booking/page.gohtml:20
msgid "Payment is in test mode. You can make the booking regardless, but no money will be charged. We will send you an additional email with instructions on how to perform the payment."
msgstr "El pagament està en mode de proves. Igualment podeu fer la reserva, però no se us farà cap càrrec. Us enviarem un correu addicional amb instruccions sobre com realitzar el pagament."
#: web/templates/public/booking/fields.gohtml:14
#: web/templates/admin/payment/details.gohtml:44
msgctxt "title"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2024-02-24 19:56+0100\n"
"POT-Creation-Date: 2024-02-26 15:55+0100\n"
"PO-Revision-Date: 2024-02-06 10:04+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
@ -649,6 +649,10 @@ msgstr "<abbr title=\"Número\">Nº</abbr> <abbr title=\"Registro de Turismo de
msgid "Sorry, there was a problem. Youll find more details highlighted below."
msgstr "Ha habido un problema. Encontraréis más información resaltada debajo."
#: web/templates/public/booking/page.gohtml:20
msgid "Payment is in test mode. You can make the booking regardless, but no money will be charged. We will send you an additional email with instructions on how to perform the payment."
msgstr "El pago está en modo de pruebas. Igualmente podéis hacer la reserva, pero no se os hará ningún cargo. Os enviaremos un correo adicional con instrucciones sobre cómo realizar el pago."
#: web/templates/public/booking/fields.gohtml:14
#: web/templates/admin/payment/details.gohtml:44
msgctxt "title"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2024-02-24 19:56+0100\n"
"POT-Creation-Date: 2024-02-26 15:55+0100\n"
"PO-Revision-Date: 2024-02-06 10:05+0100\n"
"Last-Translator: Oriol Carbonell <info@oriolcarbonell.cat>\n"
"Language-Team: French <traduc@traduc.org>\n"
@ -649,6 +649,10 @@ msgstr "<abbr title=\"Registre du tourisme de Catalogne\"># RTC</abbr> %s"
msgid "Sorry, there was a problem. Youll find more details highlighted below."
msgstr "Il y avait un problème. Vous trouverez plus de détails ci-dessous."
#: web/templates/public/booking/page.gohtml:20
msgid "Payment is in test mode. You can make the booking regardless, but no money will be charged. We will send you an additional email with instructions on how to perform the payment."
msgstr "Le paiement est en mode test. Malgré tout, vous pouvez effectuer la réservation, mais aucun argent ne sera facturé. Nous vous enverrons un e-mail supplémentaire avec des instructions sur la manière deffectuer le paiement."
#: web/templates/public/booking/fields.gohtml:14
#: web/templates/admin/payment/details.gohtml:44
msgctxt "title"

View File

@ -103,7 +103,7 @@ html {
--accent: #00aa7d;
--accent-2: #FFE37F;
--accent-3: #9adff4;
--error: #871d1f;
--error: #876e1d;
--clar-rgb: 239, 237, 236;
--clar: rgb(var(--clar-rgb));
}
@ -1296,16 +1296,27 @@ button[disabled] {
color: var(--error);
}
.warning {
color: var(--error);
}
input[aria-invalid="true"] {
border-color: var(--error);
}
.error[role="alert"] {
background-color: #fae0e3;
div[role="alert"] {
padding: 1em;
margin: 1em 0 2em;
}
.error[role="alert"] {
background-color: #fae0e3;
}
.warning[role="alert"] {
background-color: #faf4e0;
}
/* radio buttins + checkbox */
/* Context for relative positioning */

View File

@ -15,6 +15,11 @@
<p>{{( gettext "Sorry, there was a problem. Youll find more details highlighted below." )}}</p>
</div>
{{- end }}
{{ if eq .Environment "test" }}
<div role="alert" class="warning">
<p>{{( gettext "Payment is in test mode. You can make the booking regardless, but no money will be charged. We will send you an additional email with instructions on how to perform the payment." )}}</p>
</div>
{{- end }}
<form id="booking" action="/{{ currentLocale }}/booking" method="post"
data-hx-include="this"
data-hx-target="this"