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:
parent
950bae16e1
commit
23e2fe956f
|
@ -56,8 +56,9 @@ func (h *PublicHandler) Handler(user *auth.User, company *auth.Company, conn *da
|
||||||
|
|
||||||
type publicPage struct {
|
type publicPage struct {
|
||||||
*template.PublicPage
|
*template.PublicPage
|
||||||
Form *bookingForm
|
Form *bookingForm
|
||||||
HasErrors bool
|
HasErrors bool
|
||||||
|
Environment string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPublicPage(r *http.Request, company *auth.Company, conn *database.Conn, l *locale.Locale) (*publicPage, error) {
|
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) {
|
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)
|
p.Setup(r, user, company, conn)
|
||||||
var err error
|
if err := conn.QueryRow(r.Context(), "select environment from redsys where company_id = $1", company.ID).Scan(&p.Environment); err != nil && !database.ErrorIsNotFound(err) {
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if httplib.IsHTMxRequest(r) {
|
if httplib.IsHTMxRequest(r) {
|
||||||
|
|
6
po/ca.po
6
po/ca.po
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: camper\n"
|
"Project-Id-Version: camper\n"
|
||||||
"Report-Msgid-Bugs-To: jordi@tandem.blog\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"
|
"PO-Revision-Date: 2024-02-06 10:04+0100\n"
|
||||||
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
|
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
|
||||||
"Language-Team: Catalan <ca@dodds.net>\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. You’ll find more details highlighted below."
|
msgid "Sorry, there was a problem. You’ll find more details highlighted below."
|
||||||
msgstr "Hi ha hagut un problema. Trobeu més informació ressaltada a baix."
|
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/public/booking/fields.gohtml:14
|
||||||
#: web/templates/admin/payment/details.gohtml:44
|
#: web/templates/admin/payment/details.gohtml:44
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
|
|
6
po/es.po
6
po/es.po
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: camper\n"
|
"Project-Id-Version: camper\n"
|
||||||
"Report-Msgid-Bugs-To: jordi@tandem.blog\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"
|
"PO-Revision-Date: 2024-02-06 10:04+0100\n"
|
||||||
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
|
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
|
||||||
"Language-Team: Spanish <es@tp.org.es>\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. You’ll find more details highlighted below."
|
msgid "Sorry, there was a problem. You’ll find more details highlighted below."
|
||||||
msgstr "Ha habido un problema. Encontraréis más información resaltada debajo."
|
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/public/booking/fields.gohtml:14
|
||||||
#: web/templates/admin/payment/details.gohtml:44
|
#: web/templates/admin/payment/details.gohtml:44
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
|
|
6
po/fr.po
6
po/fr.po
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: camper\n"
|
"Project-Id-Version: camper\n"
|
||||||
"Report-Msgid-Bugs-To: jordi@tandem.blog\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"
|
"PO-Revision-Date: 2024-02-06 10:05+0100\n"
|
||||||
"Last-Translator: Oriol Carbonell <info@oriolcarbonell.cat>\n"
|
"Last-Translator: Oriol Carbonell <info@oriolcarbonell.cat>\n"
|
||||||
"Language-Team: French <traduc@traduc.org>\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. You’ll find more details highlighted below."
|
msgid "Sorry, there was a problem. You’ll find more details highlighted below."
|
||||||
msgstr "Il y avait un problème. Vous trouverez plus de détails ci-dessous."
|
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 d’effectuer le paiement."
|
||||||
|
|
||||||
#: web/templates/public/booking/fields.gohtml:14
|
#: web/templates/public/booking/fields.gohtml:14
|
||||||
#: web/templates/admin/payment/details.gohtml:44
|
#: web/templates/admin/payment/details.gohtml:44
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
|
|
|
@ -103,7 +103,7 @@ html {
|
||||||
--accent: #00aa7d;
|
--accent: #00aa7d;
|
||||||
--accent-2: #FFE37F;
|
--accent-2: #FFE37F;
|
||||||
--accent-3: #9adff4;
|
--accent-3: #9adff4;
|
||||||
--error: #871d1f;
|
--error: #876e1d;
|
||||||
--clar-rgb: 239, 237, 236;
|
--clar-rgb: 239, 237, 236;
|
||||||
--clar: rgb(var(--clar-rgb));
|
--clar: rgb(var(--clar-rgb));
|
||||||
}
|
}
|
||||||
|
@ -1296,16 +1296,27 @@ button[disabled] {
|
||||||
color: var(--error);
|
color: var(--error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.warning {
|
||||||
|
color: var(--error);
|
||||||
|
}
|
||||||
|
|
||||||
input[aria-invalid="true"] {
|
input[aria-invalid="true"] {
|
||||||
border-color: var(--error);
|
border-color: var(--error);
|
||||||
}
|
}
|
||||||
|
|
||||||
.error[role="alert"] {
|
div[role="alert"] {
|
||||||
background-color: #fae0e3;
|
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
margin: 1em 0 2em;
|
margin: 1em 0 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error[role="alert"] {
|
||||||
|
background-color: #fae0e3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning[role="alert"] {
|
||||||
|
background-color: #faf4e0;
|
||||||
|
}
|
||||||
|
|
||||||
/* radio buttins + checkbox */
|
/* radio buttins + checkbox */
|
||||||
|
|
||||||
/* Context for relative positioning */
|
/* Context for relative positioning */
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
<p>{{( gettext "Sorry, there was a problem. You’ll find more details highlighted below." )}}</p>
|
<p>{{( gettext "Sorry, there was a problem. You’ll find more details highlighted below." )}}</p>
|
||||||
</div>
|
</div>
|
||||||
{{- end }}
|
{{- 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"
|
<form id="booking" action="/{{ currentLocale }}/booking" method="post"
|
||||||
data-hx-include="this"
|
data-hx-include="this"
|
||||||
data-hx-target="this"
|
data-hx-target="this"
|
||||||
|
|
Loading…
Reference in New Issue