diff --git a/demo/demo.sql b/demo/demo.sql
index 41f0b22..51d445f 100644
--- a/demo/demo.sql
+++ b/demo/demo.sql
@@ -10,8 +10,8 @@ values ('demo@camper', 'Demo User', 'demo', 'ca')
;
alter table company alter column company_id restart with 52;
-insert into company (slug, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country_code, rtc_number, tourist_tax, currency_code, default_lang_tag, legal_disclaimer)
-values ('09184122-b276-4be2-9553-e4bbcbafe40d', 'El pont de Llierca, S.L.', 'ESB17377656', 'Càmping Montagut', parse_packed_phone_number('661 673 057', 'ES'), 'info@campingmontagut.com', 'https://campingmontagut.com/', 'Ctra. de Sadernes, Km 2', 'Montagut i Oix', 'Girona', '17855', 'ES', 'KG-000133', 60, 'EUR', 'ca', 'El pont de Llierca, S.L. és responsable del tractament de les seves dades d’acord amb el RGPD i la LOPDGDD, i les tracta per a mantenir una relació mercantil/comercial amb vostè. Les conservarà mentre es mantingui aquesta relació i no es comunicaran a tercers. Pot exercir els drets d’accés, rectificació, portabilitat, supressió, limitació i oposició a El pont de Llierca, S.L., amb domicili Ctra. de Sadernes, Km 2, 17855 Montagut i Oix o enviant un correu electrònic a info@campingmontagut.com. Per a qualsevol reclamació pot acudir a agpd.es. Per a més informació pot consultar la nostra política de privacitat a campingmontagut.com.');
+insert into company (slug, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country_code, rtc_number, tourist_tax, tourist_tax_max_days, currency_code, default_lang_tag, legal_disclaimer)
+values ('09184122-b276-4be2-9553-e4bbcbafe40d', 'El pont de Llierca, S.L.', 'ESB17377656', 'Càmping Montagut', parse_packed_phone_number('661 673 057', 'ES'), 'info@campingmontagut.com', 'https://campingmontagut.com/', 'Ctra. de Sadernes, Km 2', 'Montagut i Oix', 'Girona', '17855', 'ES', 'KG-000133', 60, 7, 'EUR', 'ca', 'El pont de Llierca, S.L. és responsable del tractament de les seves dades d’acord amb el RGPD i la LOPDGDD, i les tracta per a mantenir una relació mercantil/comercial amb vostè. Les conservarà mentre es mantingui aquesta relació i no es comunicaran a tercers. Pot exercir els drets d’accés, rectificació, portabilitat, supressió, limitació i oposició a El pont de Llierca, S.L., amb domicili Ctra. de Sadernes, Km 2, 17855 Montagut i Oix o enviant un correu electrònic a info@campingmontagut.com. Per a qualsevol reclamació pot acudir a agpd.es. Per a més informació pot consultar la nostra política de privacitat a campingmontagut.com.');
insert into company_host (company_id, host)
values (52, 'localhost:8080')
@@ -1413,6 +1413,22 @@ values (72, 77, 'en', 'Legend')
, (76, 103, 'es', 'Leyenda')
;
+insert into acsi (campsite_type_id, number_adults, number_teenagers, number_children, number_dogs, cost_per_night)
+values (72, 2, 0, 0, 1, 2300);
+
+insert into acsi_calendar (campsite_type_id, acsi_range)
+values (72, daterange(make_date(extract(year from current_date)::int, 2, 4), make_date(extract(year from current_date)::int, 6, 20)))
+ , (72, daterange(make_date(extract(year from current_date)::int, 9, 1), make_date(extract(year from current_date)::int, 10, 13)))
+;
+
+insert into acsi_option (campsite_type_id, campsite_type_option_id, units)
+values (72, 102, 1)
+ , (72, 103, 1)
+ , (72, 104, 1)
+ , (72, 107, 1)
+ , (72, 109, 1)
+;
+
alter table surroundings_highlight alter column surroundings_highlight_id restart with 112;
select add_surroundings_highlight(52, 62, 'El Pont del Llierca', '
Pont d’estil romànic i bany natural a 400 m del càmping.
');
diff --git a/deploy/acsi.sql b/deploy/acsi.sql
new file mode 100644
index 0000000..19cfc65
--- /dev/null
+++ b/deploy/acsi.sql
@@ -0,0 +1,23 @@
+-- Deploy camper:acsi to pg
+-- requires: roles
+-- requires: schema_camper
+-- requires: campsite_type
+
+begin;
+
+set search_path to camper, public;
+
+create table acsi (
+ campsite_type_id integer primary key references campsite_type,
+ number_adults positive_integer not null,
+ number_teenagers nonnegative_integer not null,
+ number_children nonnegative_integer not null,
+ number_dogs nonnegative_integer not null,
+ cost_per_night nonnegative_integer not null
+);
+
+grant select on table acsi to guest;
+grant select on table acsi to employee;
+grant select, insert, update, delete on table acsi to admin;
+
+commit;
diff --git a/deploy/acsi_calendar.sql b/deploy/acsi_calendar.sql
new file mode 100644
index 0000000..909500d
--- /dev/null
+++ b/deploy/acsi_calendar.sql
@@ -0,0 +1,21 @@
+-- Deploy camper:acsi_calendar to pg
+-- requires: roles
+-- requires: schema_camper
+-- requires: acsi
+
+begin;
+
+set search_path to camper, public;
+
+create table acsi_calendar (
+ campsite_type_id integer not null references acsi,
+ acsi_range daterange not null,
+ primary key (campsite_type_id, acsi_range),
+ constraint disallow_acsi_overlap exclude using gist (campsite_type_id with =, acsi_range with &&)
+);
+
+grant select on table acsi_calendar to guest;
+grant select on table acsi_calendar to employee;
+grant select, insert, update, delete on table acsi_calendar to admin;
+
+commit;
diff --git a/deploy/acsi_option.sql b/deploy/acsi_option.sql
new file mode 100644
index 0000000..528a7ef
--- /dev/null
+++ b/deploy/acsi_option.sql
@@ -0,0 +1,22 @@
+-- Deploy camper:acsi_option to pg
+-- requires: roles
+-- requires: schema_camper
+-- requires: acsi
+-- requires: campsite_type_option
+
+begin;
+
+set search_path to camper, public;
+
+create table acsi_option (
+ campsite_type_id integer not null references acsi,
+ campsite_type_option_id integer not null references campsite_type_option,
+ units positive_integer not null,
+ primary key (campsite_type_id, campsite_type_option_id)
+);
+
+grant select on table acsi_option to guest;
+grant select on table acsi_option to employee;
+grant select, insert, update, delete on table acsi_option to admin;
+
+commit;
diff --git a/deploy/draft_payment.sql b/deploy/draft_payment.sql
index 894cd94..036438e 100644
--- a/deploy/draft_payment.sql
+++ b/deploy/draft_payment.sql
@@ -11,12 +11,17 @@
-- requires: payment
-- requires: payment_option
-- requires: company__tourist_tax_max_days
+-- requires: acsi
+-- requires: acsi_calendar
+-- requires: acsi_options
begin;
set search_path to camper, public;
-create or replace function draft_payment(payment_slug uuid, arrival_date date, departure_date date, campsite_type_slug uuid, num_adults integer, num_teenagers integer, num_children integer, num_dogs integer, zone_preferences text, options option_units[]) returns payment as
+drop function if exists draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]);
+
+create or replace function draft_payment(payment_slug uuid, arrival_date date, departure_date date, campsite_type_slug uuid, num_adults integer, num_teenagers integer, num_children integer, num_dogs integer, zone_preferences text, acsi_card boolean, options option_units[]) returns payment as
$$
declare
p payment;
@@ -44,26 +49,28 @@ begin
, currency_code
, down_payment_percent
, zone_preferences
+ , acsi_card
)
select coalesce(payment_slug, gen_random_uuid())
, company_id
- , campsite_type_id
+ , campsite_type.campsite_type_id
, arrival_date
, departure_date
- , sum(cost.cost_per_night * ceiling((num_adults::numeric + num_teenagers::numeric + num_children::numeric) / max_campers::numeric)::integer)::integer
+ , sum(coalesce(acsi.cost_per_night, 0) + cost.cost_per_night * (ceiling((num_adults::numeric + num_teenagers::numeric + num_children::numeric) / max_campers::numeric)::integer - case when acsi.cost_per_night is null then 0 else 1 end))::integer
, num_adults
- , sum(cost_per_adult * num_adults)::integer
+ , sum(cost_per_adult * greatest(0, num_adults - coalesce(acsi.number_adults, 0)))::integer
, num_teenagers
- , sum(cost_per_teenager * num_teenagers)::integer
+ , sum(cost_per_teenager * greatest(0, num_teenagers - coalesce(acsi.number_teenagers, 0)))::integer
, num_children
- , sum(cost_per_child * num_children)::integer
+ , sum(cost_per_child * greatest(0, num_children - coalesce(acsi.number_children, 0)))::integer
, num_dogs
- , sum(case when num_dogs > 0 then coalesce(pet.cost_per_night, 0) else 0 end)::integer
+ , sum(case when (num_dogs - coalesce(acsi.number_dogs, 0)) > 0 then coalesce(pet.cost_per_night, 0) else 0 end)::integer
, sum(case when day_num <= tourist_tax_max_days then tourist_tax * num_adults else 0 end)::integer
, 0
, currency_code
, case when arrival_date - current_date >= 7 then 0.3 else 1.0 end
, coalesce(zone_preferences, '')
+ , acsi_card
from generate_series(arrival_date, departure_date - 1, interval '1 day') with ordinality as date(day, day_num)
left join season_calendar on season_range @> date.day::date
left join season using (season_id)
@@ -71,9 +78,13 @@ begin
left join campsite_type_pet_cost as pet using (campsite_type_id)
left join campsite_type_cost as cost using (campsite_type_id, season_id)
left join company using (company_id)
+ left join (acsi join acsi_calendar using (campsite_type_id)) as acsi
+ on acsi_card
+ and acsi.campsite_type_id = campsite_type.campsite_type_id
+ and date.day::date <@ acsi_range
where campsite_type.slug = campsite_type_slug
group by company_id
- , campsite_type_id
+ , campsite_type.campsite_type_id
, currency_code
on conflict (slug) do update
set company_id = excluded.company_id
@@ -94,6 +105,7 @@ begin
, currency_code = excluded.currency_code
, down_payment_percent = excluded.down_payment_percent
, zone_preferences = excluded.zone_preferences
+ , acsi_card = excluded.acsi_card
, updated_at = current_timestamp
returning *
into p
@@ -115,16 +127,18 @@ begin
, subtotal
)
select p.payment_id
- , campsite_type_option_id
- , units
- , case when per_night then sum(cost * units)::integer else max(cost * units)::integer end
+ , campsite_type_option.campsite_type_option_id
+ , option.units
+ , case when per_night then sum(cost * greatest(0, option.units - coalesce(acsi_option.units, 0)))::integer else max(cost * greatest(0, option.units - coalesce(acsi_option.units, 0)))::integer end
from generate_series(arrival_date, departure_date - 1, interval '1 day') as date(day)
join season_calendar on season_range @> date.day::date
join campsite_type_option_cost using (season_id)
join campsite_type_option using (campsite_type_option_id)
join unnest(options) as option(campsite_type_option_id, units) using (campsite_type_option_id)
- group by campsite_type_option_id
- , units
+ left join acsi_calendar on acsi_card and day::date <@ acsi_range
+ left join acsi_option on acsi_option.campsite_type_id = acsi_calendar.campsite_type_id and acsi_option.campsite_type_option_id = campsite_type_option.campsite_type_option_id
+ group by campsite_type_option.campsite_type_option_id
+ , option.units
, per_night
on conflict (payment_id, campsite_type_option_id) do update
set units = excluded.units
@@ -161,9 +175,9 @@ $$
language plpgsql
;
-revoke execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) from public;
-grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to guest;
-grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to employee;
-grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to admin;
+revoke execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, boolean, option_units[]) from public;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, boolean, option_units[]) to guest;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, boolean, option_units[]) to employee;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, boolean, option_units[]) to admin;
commit;
diff --git a/deploy/draft_payment@v5.sql b/deploy/draft_payment@v5.sql
new file mode 100644
index 0000000..894cd94
--- /dev/null
+++ b/deploy/draft_payment@v5.sql
@@ -0,0 +1,169 @@
+-- Deploy camper:draft_payment to pg
+-- requires: roles
+-- requires: schema_camper
+-- requires: season_calendar
+-- requires: season
+-- requires: campsite_type
+-- requires: campsite_type_pet_cost
+-- requires: campsite_type_cost
+-- requires: campsite_type_option_cost
+-- requires: campsite_type_option
+-- requires: payment
+-- requires: payment_option
+-- requires: company__tourist_tax_max_days
+
+begin;
+
+set search_path to camper, public;
+
+create or replace function draft_payment(payment_slug uuid, arrival_date date, departure_date date, campsite_type_slug uuid, num_adults integer, num_teenagers integer, num_children integer, num_dogs integer, zone_preferences text, options option_units[]) returns payment as
+$$
+declare
+ p payment;
+begin
+ if exists(select 1 from payment where slug = payment_slug and payment_status <> 'draft') then
+ payment_slug = null;
+ end if;
+ insert into payment (
+ slug
+ , company_id
+ , campsite_type_id
+ , arrival_date
+ , departure_date
+ , subtotal_nights
+ , number_adults
+ , subtotal_adults
+ , number_teenagers
+ , subtotal_teenagers
+ , number_children
+ , subtotal_children
+ , number_dogs
+ , subtotal_dogs
+ , subtotal_tourist_tax
+ , total
+ , currency_code
+ , down_payment_percent
+ , zone_preferences
+ )
+ select coalesce(payment_slug, gen_random_uuid())
+ , company_id
+ , campsite_type_id
+ , arrival_date
+ , departure_date
+ , sum(cost.cost_per_night * ceiling((num_adults::numeric + num_teenagers::numeric + num_children::numeric) / max_campers::numeric)::integer)::integer
+ , num_adults
+ , sum(cost_per_adult * num_adults)::integer
+ , num_teenagers
+ , sum(cost_per_teenager * num_teenagers)::integer
+ , num_children
+ , sum(cost_per_child * num_children)::integer
+ , num_dogs
+ , sum(case when num_dogs > 0 then coalesce(pet.cost_per_night, 0) else 0 end)::integer
+ , sum(case when day_num <= tourist_tax_max_days then tourist_tax * num_adults else 0 end)::integer
+ , 0
+ , currency_code
+ , case when arrival_date - current_date >= 7 then 0.3 else 1.0 end
+ , coalesce(zone_preferences, '')
+ from generate_series(arrival_date, departure_date - 1, interval '1 day') with ordinality as date(day, day_num)
+ left join season_calendar on season_range @> date.day::date
+ left join season using (season_id)
+ left join campsite_type using (company_id)
+ left join campsite_type_pet_cost as pet using (campsite_type_id)
+ left join campsite_type_cost as cost using (campsite_type_id, season_id)
+ left join company using (company_id)
+ where campsite_type.slug = campsite_type_slug
+ group by company_id
+ , campsite_type_id
+ , currency_code
+ on conflict (slug) do update
+ set company_id = excluded.company_id
+ , campsite_type_id = excluded.campsite_type_id
+ , arrival_date = excluded.arrival_date
+ , departure_date = excluded.departure_date
+ , subtotal_nights = excluded.subtotal_nights
+ , number_adults = excluded.number_adults
+ , subtotal_adults = excluded.subtotal_adults
+ , number_teenagers = excluded.number_teenagers
+ , subtotal_teenagers = excluded.subtotal_teenagers
+ , number_children = excluded.number_children
+ , subtotal_children = excluded.subtotal_children
+ , number_dogs = excluded.number_dogs
+ , subtotal_dogs = excluded.subtotal_dogs
+ , subtotal_tourist_tax = excluded.subtotal_tourist_tax
+ , total = excluded.total
+ , currency_code = excluded.currency_code
+ , down_payment_percent = excluded.down_payment_percent
+ , zone_preferences = excluded.zone_preferences
+ , updated_at = current_timestamp
+ returning *
+ into p
+ ;
+
+ if array_length(coalesce(options, array[]::option_units[]), 1) > 0 then
+ delete
+ from payment_option
+ where payment_id = p.payment_id
+ and campsite_type_option_id not in (
+ select campsite_type_option_id
+ from unnest(options) as option(campsite_type_option_id, units)
+ );
+
+ insert into payment_option (
+ payment_id
+ , campsite_type_option_id
+ , units
+ , subtotal
+ )
+ select p.payment_id
+ , campsite_type_option_id
+ , units
+ , case when per_night then sum(cost * units)::integer else max(cost * units)::integer end
+ from generate_series(arrival_date, departure_date - 1, interval '1 day') as date(day)
+ join season_calendar on season_range @> date.day::date
+ join campsite_type_option_cost using (season_id)
+ join campsite_type_option using (campsite_type_option_id)
+ join unnest(options) as option(campsite_type_option_id, units) using (campsite_type_option_id)
+ group by campsite_type_option_id
+ , units
+ , per_night
+ on conflict (payment_id, campsite_type_option_id) do update
+ set units = excluded.units
+ , subtotal = excluded.subtotal
+ ;
+
+ with option as (
+ select sum(subtotal)::integer as subtotal
+ from payment_option
+ where payment_id = p.payment_id
+ )
+ update payment
+ set total = subtotal_nights + subtotal_adults + subtotal_teenagers + subtotal_children + subtotal_dogs + subtotal_tourist_tax + coalesce(option.subtotal, 0)
+ from option
+ where payment_id = p.payment_id
+ returning total into p.total
+ ;
+ else
+ delete
+ from payment_option
+ where payment_id = p.payment_id;
+
+ update payment
+ set total = subtotal_nights + subtotal_adults + subtotal_teenagers + subtotal_children + subtotal_dogs + subtotal_tourist_tax
+ where payment_id = p.payment_id
+ returning total into p.total
+ ;
+ end if;
+
+
+ return p;
+end;
+$$
+ language plpgsql
+;
+
+revoke execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) from public;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to guest;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to employee;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to admin;
+
+commit;
diff --git a/deploy/payment__acsi_card.sql b/deploy/payment__acsi_card.sql
new file mode 100644
index 0000000..349910d
--- /dev/null
+++ b/deploy/payment__acsi_card.sql
@@ -0,0 +1,22 @@
+-- Deploy camper:payment__acsi_card to pg
+-- requires: payment
+
+begin;
+
+set search_path to camper, public;
+
+alter table payment
+add column acsi_card boolean not null default false
+;
+
+update payment
+set acsi_card = payment_customer.acsi_card
+from payment_customer
+where payment_customer.payment_id = payment.payment_id
+;
+
+alter table payment
+alter column acsi_card drop default
+;
+
+commit;
diff --git a/deploy/payment_customer__-acsi_card.sql b/deploy/payment_customer__-acsi_card.sql
new file mode 100644
index 0000000..7093b9d
--- /dev/null
+++ b/deploy/payment_customer__-acsi_card.sql
@@ -0,0 +1,10 @@
+-- Deploy camper:payment_customer__-acsi_card to pg
+-- requires: payment__acsi_card
+
+begin;
+
+alter table camper.payment_customer
+drop column if exists acsi_card
+;
+
+commit;
diff --git a/deploy/ready_payment.sql b/deploy/ready_payment.sql
index ad25355..f0e522e 100644
--- a/deploy/ready_payment.sql
+++ b/deploy/ready_payment.sql
@@ -6,12 +6,16 @@
-- requires: country_code
-- requires: email
-- requires: extension_pg_libphonenumber
+-- requires: payment__acsi_card
+-- requires: payment_customer__-acsi_card
begin;
set search_path to camper, public;
-create or replace function ready_payment(payment_slug uuid, customer_name text, customer_address text, customer_post_code text, customer_city text, customer_country_code country_code, customer_email email, customer_phone text, customer_lang_tag text, customer_acsi_card boolean) returns integer as
+drop function if exists ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean);
+
+create or replace function ready_payment(payment_slug uuid, customer_name text, customer_address text, customer_post_code text, customer_city text, customer_country_code country_code, customer_email email, customer_phone text, customer_lang_tag text) returns integer as
$$
declare
pid integer;
@@ -28,8 +32,8 @@ begin
raise check_violation using message = 'insert or update on table "payment" violates check constraint "payment_is_draft"';
end if;
- insert into payment_customer (payment_id, full_name, address, postal_code, city, country_code, email, phone, acsi_card, lang_tag)
- values (pid, customer_name, customer_address, customer_post_code, customer_city, customer_country_code, customer_email, parse_packed_phone_number(customer_phone, customer_country_code), customer_acsi_card, customer_lang_tag)
+ insert into payment_customer (payment_id, full_name, address, postal_code, city, country_code, email, phone, lang_tag)
+ values (pid, customer_name, customer_address, customer_post_code, customer_city, customer_country_code, customer_email, parse_packed_phone_number(customer_phone, customer_country_code), customer_lang_tag)
on conflict (payment_id) do update
set full_name = excluded.full_name
, address = excluded.address
@@ -38,7 +42,6 @@ begin
, country_code = excluded.country_code
, email = excluded.email
, phone = excluded.phone
- , acsi_card = excluded.acsi_card
, lang_tag = excluded.lang_tag
;
@@ -48,9 +51,9 @@ $$
language plpgsql
;
-revoke execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) from public;
-grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to guest;
-grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to employee;
-grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to admin;
+revoke execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text) from public;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text) to guest;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text) to employee;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text) to admin;
commit;
diff --git a/deploy/ready_payment@v5.sql b/deploy/ready_payment@v5.sql
new file mode 100644
index 0000000..ad25355
--- /dev/null
+++ b/deploy/ready_payment@v5.sql
@@ -0,0 +1,56 @@
+-- Deploy camper:ready_payment to pg
+-- requires: roles
+-- requires: schema_camper
+-- requires: payment
+-- requires: payment_customer
+-- requires: country_code
+-- requires: email
+-- requires: extension_pg_libphonenumber
+
+begin;
+
+set search_path to camper, public;
+
+create or replace function ready_payment(payment_slug uuid, customer_name text, customer_address text, customer_post_code text, customer_city text, customer_country_code country_code, customer_email email, customer_phone text, customer_lang_tag text, customer_acsi_card boolean) returns integer as
+$$
+declare
+ pid integer;
+begin
+ update payment
+ set payment_status = 'pending'
+ , updated_at = current_timestamp
+ where slug = payment_slug
+ and payment_status = 'draft'
+ returning payment_id into pid
+ ;
+
+ if pid is null then
+ raise check_violation using message = 'insert or update on table "payment" violates check constraint "payment_is_draft"';
+ end if;
+
+ insert into payment_customer (payment_id, full_name, address, postal_code, city, country_code, email, phone, acsi_card, lang_tag)
+ values (pid, customer_name, customer_address, customer_post_code, customer_city, customer_country_code, customer_email, parse_packed_phone_number(customer_phone, customer_country_code), customer_acsi_card, customer_lang_tag)
+ on conflict (payment_id) do update
+ set full_name = excluded.full_name
+ , address = excluded.address
+ , postal_code = excluded.postal_code
+ , city = excluded.city
+ , country_code = excluded.country_code
+ , email = excluded.email
+ , phone = excluded.phone
+ , acsi_card = excluded.acsi_card
+ , lang_tag = excluded.lang_tag
+ ;
+
+ return pid;
+end;
+$$
+ language plpgsql
+;
+
+revoke execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) from public;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to guest;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to employee;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to admin;
+
+commit;
diff --git a/pkg/booking/cart.go b/pkg/booking/cart.go
index 15e1760..6f61583 100644
--- a/pkg/booking/cart.go
+++ b/pkg/booking/cart.go
@@ -66,6 +66,11 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
zonePreferences = f.Options.ZonePreferences.Val
}
+ var ACSICard bool
+ if f.Guests.ACSICard != nil {
+ ACSICard = f.Guests.ACSICard.Checked
+ }
+
optionMap := make(map[int]*campsiteTypeOption)
var typeOptions []*campsiteTypeOption
if f.Options != nil {
@@ -97,7 +102,7 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
, to_price(total, decimal_digits)
, to_price(payment.down_payment, decimal_digits)
, (payment.down_payment_percent * 100)::int
- from draft_payment($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) as payment
+ from draft_payment($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) as payment
join currency using (currency_code)
`,
database.ZeroNullUUID(f.PaymentSlug.Val),
@@ -109,6 +114,7 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
numChildren,
numDogs,
zonePreferences,
+ ACSICard,
database.OptionUnitsArray(optionUnits),
)
var paymentID int
diff --git a/pkg/booking/payment.go b/pkg/booking/payment.go
index fa120df..b662e07 100644
--- a/pkg/booking/payment.go
+++ b/pkg/booking/payment.go
@@ -43,7 +43,6 @@ func requestPayment(w http.ResponseWriter, r *http.Request, user *auth.User, com
f.Customer.Email.Val,
f.Customer.Phone.Val,
user.Locale.Language,
- f.Customer.ACSICard.Checked,
)
if err != nil {
panic(err)
diff --git a/pkg/booking/public.go b/pkg/booking/public.go
index be029fd..3f21c98 100644
--- a/pkg/booking/public.go
+++ b/pkg/booking/public.go
@@ -119,6 +119,7 @@ type bookingGuestFields struct {
NumberTeenagers *form.Input
NumberChildren *form.Input
NumberDogs *form.Input
+ ACSICard *form.Checkbox
Error error
}
@@ -144,7 +145,6 @@ type bookingCustomerFields struct {
Country *form.Select
Email *form.Input
Phone *form.Input
- ACSICard *form.Checkbox
Agreement *form.Checkbox
}
@@ -183,7 +183,7 @@ func newBookingForm(r *http.Request, company *auth.Company, conn *database.Conn,
return f, nil
}
- f.Guests, err = newBookingGuestFields(r.Context(), conn, campsiteType)
+ f.Guests, err = newBookingGuestFields(r.Context(), conn, campsiteType, f.Dates.ArrivalDate.Val, f.Dates.DepartureDate.Val)
if err != nil {
return nil, err
}
@@ -317,7 +317,7 @@ func (f *DateFields) Valid(v *form.Validator, l *locale.Locale) {
}
}
-func newBookingGuestFields(ctx context.Context, conn *database.Conn, campsiteType string) (*bookingGuestFields, error) {
+func newBookingGuestFields(ctx context.Context, conn *database.Conn, campsiteType string, arrivalDate string, departureDate string) (*bookingGuestFields, error) {
f := &bookingGuestFields{
NumberAdults: &form.Input{Name: "number_adults"},
NumberTeenagers: &form.Input{Name: "number_teenagers"},
@@ -327,17 +327,26 @@ func newBookingGuestFields(ctx context.Context, conn *database.Conn, campsiteTyp
select max_campers
, overflow_allowed
, pet.cost_per_night is not null as dogs_allowed
+ , exists (
+ select 1 from acsi_calendar
+ where acsi_calendar.campsite_type_id = campsite_type.campsite_type_id
+ and acsi_range && daterange($2::date, $3::date)
+ ) as acsi_allowed
from campsite_type
left join campsite_type_pet_cost as pet using (campsite_type_id)
where slug = $1
- `, campsiteType)
+ `, campsiteType, arrivalDate, departureDate)
var dogsAllowed bool
- if err := row.Scan(&f.MaxGuests, &f.OverflowAllowed, &dogsAllowed); err != nil {
+ var ACSIAllowed bool
+ if err := row.Scan(&f.MaxGuests, &f.OverflowAllowed, &dogsAllowed, &ACSIAllowed); err != nil {
return nil, err
}
if dogsAllowed {
f.NumberDogs = &form.Input{Name: "number_dogs"}
}
+ if ACSIAllowed {
+ f.ACSICard = &form.Checkbox{Name: "acsi_card"}
+ }
return f, nil
}
@@ -349,6 +358,9 @@ func (f *bookingGuestFields) FillValues(r *http.Request, l *locale.Locale) {
if f.NumberDogs != nil {
fillNumericField(f.NumberDogs, r, 0)
}
+ if f.ACSICard != nil {
+ f.ACSICard.FillValue(r)
+ }
if numGuests > f.MaxGuests {
if f.OverflowAllowed {
f.Overflow = true
@@ -495,9 +507,6 @@ func newBookingCustomerFields(ctx context.Context, conn *database.Conn, l *local
Phone: &form.Input{
Name: "phone",
},
- ACSICard: &form.Checkbox{
- Name: "acsi_card",
- },
Agreement: &form.Checkbox{
Name: "agreement",
},
@@ -512,7 +521,6 @@ func (f *bookingCustomerFields) FillValues(r *http.Request) {
f.Country.FillValue(r)
f.Email.FillValue(r)
f.Phone.FillValue(r)
- f.ACSICard.FillValue(r)
f.Agreement.FillValue(r)
}
diff --git a/pkg/database/funcs.go b/pkg/database/funcs.go
index a157095..8846585 100644
--- a/pkg/database/funcs.go
+++ b/pkg/database/funcs.go
@@ -348,6 +348,6 @@ func (tx *Tx) TranslateHome(ctx context.Context, companyID int, langTag language
return err
}
-func (c *Conn) ReadyPayment(ctx context.Context, paymentSlug string, customerName string, customerAddress string, customerPostCode string, customerCity string, customerCountryCode string, customerEmail string, customerPhone string, customerLangTag language.Tag, acsiCard bool) (int, error) {
- return c.GetInt(ctx, "select ready_payment($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", paymentSlug, customerName, customerAddress, customerPostCode, customerCity, customerCountryCode, customerEmail, customerPhone, customerLangTag, acsiCard)
+func (c *Conn) ReadyPayment(ctx context.Context, paymentSlug string, customerName string, customerAddress string, customerPostCode string, customerCity string, customerCountryCode string, customerEmail string, customerPhone string, customerLangTag language.Tag) (int, error) {
+ return c.GetInt(ctx, "select ready_payment($1, $2, $3, $4, $5, $6, $7, $8, $9)", paymentSlug, customerName, customerAddress, customerPostCode, customerCity, customerCountryCode, customerEmail, customerPhone, customerLangTag)
}
diff --git a/pkg/payment/admin.go b/pkg/payment/admin.go
index de69dfb..fe69d96 100644
--- a/pkg/payment/admin.go
+++ b/pkg/payment/admin.go
@@ -178,6 +178,7 @@ type paymentDetails struct {
DownPaymentPercent int
DownPayment string
ZonePreferences string
+ ACSICard bool
Status string
StatusLabel string
CreatedAt time.Time
@@ -200,7 +201,6 @@ type paymentCustomer struct {
Email string
Phone string
Language string
- ACSICard bool
}
func fetchPaymentDetails(ctx context.Context, conn *database.Conn, slug string, locale *locale.Locale) (*paymentDetails, error) {
@@ -220,6 +220,7 @@ func fetchPaymentDetails(ctx context.Context, conn *database.Conn, slug string,
, (down_payment_percent * 100)::integer
, to_price(payment.down_payment, decimal_digits)
, zone_preferences
+ , acsi_card
, payment.payment_status
, coalesce(payment_status_i18n.name, payment_status.name)
, created_at
@@ -251,6 +252,7 @@ func fetchPaymentDetails(ctx context.Context, conn *database.Conn, slug string,
&details.DownPaymentPercent,
&details.DownPayment,
&details.ZonePreferences,
+ &details.ACSICard,
&details.Status,
&details.StatusLabel,
&details.CreatedAt,
@@ -309,7 +311,6 @@ func fetchPaymentCustomer(ctx context.Context, conn *database.Conn, paymentID in
, email
, phone::text
, language.endonym
- , acsi_card
from payment_customer
join country using (country_code)
left join country_i18n on country.country_code = country_i18n.country_code
@@ -327,7 +328,6 @@ func fetchPaymentCustomer(ctx context.Context, conn *database.Conn, paymentID in
&customer.Email,
&customer.Phone,
&customer.Language,
- &customer.ACSICard,
); err != nil {
return nil, err
}
diff --git a/po/ca.po b/po/ca.po
index a95bbb4..3fceeec 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
-"POT-Creation-Date: 2024-02-29 16:55+0100\n"
+"POT-Creation-Date: 2024-03-14 22:05+0100\n"
"PO-Revision-Date: 2024-02-06 10:04+0100\n"
"Last-Translator: jordi fita mas \n"
"Language-Team: Catalan \n"
@@ -127,160 +127,13 @@ msgid "Area preferences"
msgstr "Preferències d’àrea"
#: web/templates/mail/payment/details.gotxt:18
-#: web/templates/public/campsite/dates.gohtml:4
-#: web/templates/public/booking/fields.gohtml:30
#: web/templates/admin/payment/details.gohtml:52
msgctxt "input"
-msgid "Arrival date"
-msgstr "Data d’arribada"
-
-#: web/templates/mail/payment/details.gotxt:19
-#: web/templates/public/campsite/dates.gohtml:15
-#: web/templates/public/booking/fields.gohtml:41
-#: web/templates/admin/payment/details.gohtml:56
-msgctxt "input"
-msgid "Departure date"
-msgstr "Data de sortida"
-
-#: web/templates/mail/payment/details.gotxt:20
-#: web/templates/admin/payment/details.gohtml:60
-msgctxt "cart"
-msgid "Nights"
-msgstr "Nits"
-
-#: web/templates/mail/payment/details.gotxt:21
-#: web/templates/public/booking/fields.gohtml:60
-#: web/templates/admin/payment/details.gohtml:64
-msgctxt "input"
-msgid "Adults aged 17 or older"
-msgstr "Adults de 17 anys o més"
-
-#: web/templates/mail/payment/details.gotxt:22
-#: web/templates/public/booking/fields.gohtml:71
-#: web/templates/admin/payment/details.gohtml:68
-msgctxt "input"
-msgid "Teenagers from 11 to 16 years old"
-msgstr "Adolescents d’entre 11 i 16 anys"
-
-#: web/templates/mail/payment/details.gotxt:23
-#: web/templates/public/booking/fields.gohtml:82
-#: web/templates/admin/payment/details.gohtml:72
-msgctxt "input"
-msgid "Children from 2 to 10 years old"
-msgstr "Nens d’entre 2 i 10 anys"
-
-#: web/templates/mail/payment/details.gotxt:24
-#: web/templates/public/booking/fields.gohtml:100
-#: web/templates/admin/payment/details.gohtml:76
-msgctxt "input"
-msgid "Dogs"
-msgstr "Gossos"
-
-#: web/templates/mail/payment/details.gotxt:25
-#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:191
-msgctxt "cart"
-msgid "Tourist tax"
-msgstr "Impost turístic"
-
-#: web/templates/mail/payment/details.gotxt:26
-#: web/templates/public/booking/fields.gohtml:242
-msgctxt "cart"
-msgid "Total"
-msgstr "Total"
-
-#: web/templates/mail/payment/details.gotxt:27
-#: web/templates/public/booking/fields.gohtml:247
-#: web/templates/admin/payment/details.gohtml:84
-msgctxt "cart"
-msgid "Down payment"
-msgstr "A compte"
-
-#: web/templates/mail/payment/details.gotxt:30
-#: web/templates/admin/payment/details.gohtml:92
-#: web/templates/admin/campsite/type/option/form.gohtml:18
-#: web/templates/admin/campsite/type/option/index.gohtml:6
-#: web/templates/admin/campsite/type/option/index.gohtml:17
-msgctxt "title"
-msgid "Campsite Type Options"
-msgstr "Opcions del tipus d’allotjament"
-
-#: web/templates/mail/payment/details.gotxt:38
-#: web/templates/public/booking/fields.gohtml:146
-#: web/templates/admin/payment/details.gohtml:106
-msgctxt "title"
-msgid "Customer Details"
-msgstr "Detalls del client"
-
-#: web/templates/mail/payment/details.gotxt:40
-#: web/templates/public/booking/fields.gohtml:149
-#: web/templates/admin/payment/details.gohtml:109
-msgctxt "input"
-msgid "Full name"
-msgstr "Nom i cognoms"
-
-#: web/templates/mail/payment/details.gotxt:41
-#: web/templates/public/booking/fields.gohtml:158
-#: web/templates/admin/payment/details.gohtml:113
-#: web/templates/admin/taxDetails.gohtml:69
-msgctxt "input"
-msgid "Address"
-msgstr "Adreça"
-
-#: web/templates/mail/payment/details.gotxt:42
-#: web/templates/public/booking/fields.gohtml:167
-#: web/templates/admin/payment/details.gohtml:117
-#: web/templates/admin/taxDetails.gohtml:93
-msgctxt "input"
-msgid "Postcode"
-msgstr "Codi postal"
-
-#: web/templates/mail/payment/details.gotxt:43
-#: web/templates/admin/payment/details.gohtml:121
-#: web/templates/admin/taxDetails.gohtml:77
-msgctxt "input"
-msgid "City"
-msgstr "Població"
-
-#: web/templates/mail/payment/details.gotxt:44
-#: web/templates/public/booking/fields.gohtml:185
-#: web/templates/admin/payment/details.gohtml:125
-#: web/templates/admin/taxDetails.gohtml:101
-msgctxt "input"
-msgid "Country"
-msgstr "País"
-
-#: web/templates/mail/payment/details.gotxt:45
-#: web/templates/public/booking/fields.gohtml:196
-#: web/templates/admin/payment/details.gohtml:129
-#: web/templates/admin/login.gohtml:27 web/templates/admin/profile.gohtml:38
-#: web/templates/admin/taxDetails.gohtml:53
-msgctxt "input"
-msgid "Email"
-msgstr "Correu-e"
-
-#: web/templates/mail/payment/details.gotxt:46
-#: web/templates/public/booking/fields.gohtml:205
-#: web/templates/admin/payment/details.gohtml:133
-#: web/templates/admin/taxDetails.gohtml:45
-msgctxt "input"
-msgid "Phone"
-msgstr "Telèfon"
-
-#: web/templates/mail/payment/details.gotxt:47
-#: web/templates/admin/payment/details.gohtml:137
-#: web/templates/admin/profile.gohtml:68
-msgctxt "input"
-msgid "Language"
-msgstr "Idioma"
-
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:141
-msgctxt "input"
msgid "ACSI card?"
msgstr "Targeta ACSI?"
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:142
+#: web/templates/mail/payment/details.gotxt:18
+#: web/templates/admin/payment/details.gohtml:53
#: web/templates/admin/campsite/index.gohtml:41
#: web/templates/admin/campsite/type/index.gohtml:53
#: web/templates/admin/season/index.gohtml:44
@@ -289,8 +142,8 @@ msgstr "Targeta ACSI?"
msgid "Yes"
msgstr "Sí"
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:142
+#: web/templates/mail/payment/details.gotxt:18
+#: web/templates/admin/payment/details.gohtml:53
#: web/templates/admin/campsite/index.gohtml:41
#: web/templates/admin/campsite/type/index.gohtml:53
#: web/templates/admin/season/index.gohtml:44
@@ -299,6 +152,153 @@ msgstr "Sí"
msgid "No"
msgstr "No"
+#: web/templates/mail/payment/details.gotxt:19
+#: web/templates/public/campsite/dates.gohtml:4
+#: web/templates/public/booking/fields.gohtml:30
+#: web/templates/admin/payment/details.gohtml:56
+msgctxt "input"
+msgid "Arrival date"
+msgstr "Data d’arribada"
+
+#: web/templates/mail/payment/details.gotxt:20
+#: web/templates/public/campsite/dates.gohtml:15
+#: web/templates/public/booking/fields.gohtml:41
+#: web/templates/admin/payment/details.gohtml:60
+msgctxt "input"
+msgid "Departure date"
+msgstr "Data de sortida"
+
+#: web/templates/mail/payment/details.gotxt:21
+#: web/templates/admin/payment/details.gohtml:64
+msgctxt "cart"
+msgid "Nights"
+msgstr "Nits"
+
+#: web/templates/mail/payment/details.gotxt:22
+#: web/templates/public/booking/fields.gohtml:60
+#: web/templates/admin/payment/details.gohtml:68
+msgctxt "input"
+msgid "Adults aged 17 or older"
+msgstr "Adults de 17 anys o més"
+
+#: web/templates/mail/payment/details.gotxt:23
+#: web/templates/public/booking/fields.gohtml:71
+#: web/templates/admin/payment/details.gohtml:72
+msgctxt "input"
+msgid "Teenagers from 11 to 16 years old"
+msgstr "Adolescents d’entre 11 i 16 anys"
+
+#: web/templates/mail/payment/details.gotxt:24
+#: web/templates/public/booking/fields.gohtml:82
+#: web/templates/admin/payment/details.gohtml:76
+msgctxt "input"
+msgid "Children from 2 to 10 years old"
+msgstr "Nens d’entre 2 i 10 anys"
+
+#: web/templates/mail/payment/details.gotxt:25
+#: web/templates/public/booking/fields.gohtml:100
+#: web/templates/admin/payment/details.gohtml:80
+msgctxt "input"
+msgid "Dogs"
+msgstr "Gossos"
+
+#: web/templates/mail/payment/details.gotxt:26
+#: web/templates/admin/payment/details.gohtml:84 pkg/booking/cart.go:197
+msgctxt "cart"
+msgid "Tourist tax"
+msgstr "Impost turístic"
+
+#: web/templates/mail/payment/details.gotxt:27
+#: web/templates/public/booking/fields.gohtml:225
+msgctxt "cart"
+msgid "Total"
+msgstr "Total"
+
+#: web/templates/mail/payment/details.gotxt:28
+#: web/templates/public/booking/fields.gohtml:230
+#: web/templates/admin/payment/details.gohtml:88
+msgctxt "cart"
+msgid "Down payment"
+msgstr "A compte"
+
+#: web/templates/mail/payment/details.gotxt:31
+#: web/templates/admin/payment/details.gohtml:96
+#: web/templates/admin/campsite/type/option/form.gohtml:18
+#: web/templates/admin/campsite/type/option/index.gohtml:6
+#: web/templates/admin/campsite/type/option/index.gohtml:17
+msgctxt "title"
+msgid "Campsite Type Options"
+msgstr "Opcions del tipus d’allotjament"
+
+#: web/templates/mail/payment/details.gotxt:39
+#: web/templates/public/booking/fields.gohtml:146
+#: web/templates/admin/payment/details.gohtml:110
+msgctxt "title"
+msgid "Customer Details"
+msgstr "Detalls del client"
+
+#: web/templates/mail/payment/details.gotxt:41
+#: web/templates/public/booking/fields.gohtml:149
+#: web/templates/admin/payment/details.gohtml:113
+msgctxt "input"
+msgid "Full name"
+msgstr "Nom i cognoms"
+
+#: web/templates/mail/payment/details.gotxt:42
+#: web/templates/public/booking/fields.gohtml:158
+#: web/templates/admin/payment/details.gohtml:117
+#: web/templates/admin/taxDetails.gohtml:69
+msgctxt "input"
+msgid "Address"
+msgstr "Adreça"
+
+#: web/templates/mail/payment/details.gotxt:43
+#: web/templates/public/booking/fields.gohtml:167
+#: web/templates/admin/payment/details.gohtml:121
+#: web/templates/admin/taxDetails.gohtml:93
+msgctxt "input"
+msgid "Postcode"
+msgstr "Codi postal"
+
+#: web/templates/mail/payment/details.gotxt:44
+#: web/templates/admin/payment/details.gohtml:125
+#: web/templates/admin/taxDetails.gohtml:77
+msgctxt "input"
+msgid "City"
+msgstr "Població"
+
+#: web/templates/mail/payment/details.gotxt:45
+#: web/templates/public/booking/fields.gohtml:185
+#: web/templates/admin/payment/details.gohtml:129
+#: web/templates/admin/taxDetails.gohtml:101
+msgctxt "input"
+msgid "Country"
+msgstr "País"
+
+#: web/templates/mail/payment/details.gotxt:46
+#: web/templates/public/booking/fields.gohtml:196
+#: web/templates/admin/payment/details.gohtml:133
+#: web/templates/admin/login.gohtml:27 web/templates/admin/profile.gohtml:38
+#: web/templates/admin/taxDetails.gohtml:53
+msgctxt "input"
+msgid "Email"
+msgstr "Correu-e"
+
+#: web/templates/mail/payment/details.gotxt:47
+#: web/templates/public/booking/fields.gohtml:205
+#: web/templates/admin/payment/details.gohtml:137
+#: web/templates/admin/taxDetails.gohtml:45
+msgctxt "input"
+msgid "Phone"
+msgstr "Telèfon"
+
+#: web/templates/mail/payment/details.gotxt:48
+#: web/templates/admin/payment/details.gohtml:141
+#: web/templates/admin/profile.gohtml:68
+msgctxt "input"
+msgid "Language"
+msgstr "Idioma"
+
#: web/templates/mail/payment/details.gotxt:54
msgid "Best regards,"
msgstr "Salutacions,"
@@ -490,7 +490,7 @@ msgid "Discover"
msgstr "Descobreix"
#: web/templates/public/campsite/type.gohtml:49
-#: web/templates/public/booking/fields.gohtml:269
+#: web/templates/public/booking/fields.gohtml:273
msgctxt "action"
msgid "Book"
msgstr "Reserva"
@@ -917,25 +917,25 @@ msgstr "Població"
msgid "Choose a country"
msgstr "Esculli un país"
-#: web/templates/public/booking/fields.gohtml:216
+#: web/templates/public/booking/fields.gohtml:242
msgctxt "input"
msgid "ACSI card? (optional)"
msgstr "Targeta ACSI? (opcional)"
-#: web/templates/public/booking/fields.gohtml:224
+#: web/templates/public/booking/fields.gohtml:250
msgctxt "input"
msgid "I have read and I accept %[1]sthe reservation conditions%[2]s"
msgstr "He llegit i accepto %[1]sles condicions de reserves%[2]s"
-#: web/templates/public/booking/fields.gohtml:261
+#: web/templates/public/booking/fields.gohtml:258
msgid "By down paying the %d %% of the total, you are pre-booking your preferences. We will respond within 24 hours and this percentage will be charged if accepted."
msgstr "En tramitar el %d %% del total esteu realitzant la prereserva de les vostres preferències. Us respondrem en un termini de 24 hores i us cobrarem aquest percentatge en cas que sigui acceptada."
-#: web/templates/public/booking/fields.gohtml:263
+#: web/templates/public/booking/fields.gohtml:260
msgid "By paying the total you are pre-booking your preferences. We will respond within 24 hours and this amount will be charged if accepted."
msgstr "En tramitar el pagament del total esteu realitzant la prereserva de les vostres preferències. Us respondrem en un termini de 24 hores i us cobrarem aquesta quantitat en cas que sigui acceptada."
-#: web/templates/public/booking/fields.gohtml:267
+#: web/templates/public/booking/fields.gohtml:264
msgid "See <%s>our conditions%s> for more information."
msgstr "Consulteu <%s>les nostres condicions%s> per a més informació."
@@ -2270,7 +2270,7 @@ msgctxt "order product name"
msgid "Campsite Booking"
msgstr "Reserva de càmping"
-#: pkg/payment/public.go:372
+#: pkg/payment/public.go:369
msgctxt "subject"
msgid "Booking payment successfully received"
msgstr "Rebut amb èxit el pagament de la reserva"
@@ -2314,12 +2314,12 @@ msgid "Slide image must be an image media type."
msgstr "La imatge de la diapositiva ha de ser un mèdia de tipus imatge."
#: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:224
-#: pkg/booking/public.go:536
+#: pkg/booking/public.go:544
msgid "Email can not be empty."
msgstr "No podeu deixar el correu-e en blanc."
#: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:225
-#: pkg/booking/public.go:537
+#: pkg/booking/public.go:545
msgid "This email is not valid. It should be like name@domain.com."
msgstr "Aquest correu-e no és vàlid. Hauria de ser similar a nom@domini.com."
@@ -2687,7 +2687,7 @@ msgstr "No podeu deixar l’adreça de l’enllaç en blanc."
msgid "This web address is not valid. It should be like https://domain.com/."
msgstr "Aquesta adreça web no és vàlida. Hauria de ser similar a https://domini.com/."
-#: pkg/company/admin.go:207 pkg/booking/public.go:521
+#: pkg/company/admin.go:207 pkg/booking/public.go:529
msgid "Selected country is not valid."
msgstr "El país escollit no és vàlid."
@@ -2707,15 +2707,15 @@ msgstr "No podeu deixar el NIF en blanc."
msgid "This VAT number is not valid."
msgstr "Aquest NIF no és vàlid."
-#: pkg/company/admin.go:219 pkg/booking/public.go:539
+#: pkg/company/admin.go:219 pkg/booking/public.go:547
msgid "Phone can not be empty."
msgstr "No podeu deixar el telèfon en blanc."
-#: pkg/company/admin.go:220 pkg/booking/public.go:540
+#: pkg/company/admin.go:220 pkg/booking/public.go:548
msgid "This phone number is not valid."
msgstr "Aquest número de telèfon no és vàlid."
-#: pkg/company/admin.go:230 pkg/booking/public.go:529
+#: pkg/company/admin.go:230 pkg/booking/public.go:537
msgid "Address can not be empty."
msgstr "No podeu deixar l’adreça en blanc."
@@ -2727,11 +2727,11 @@ msgstr "No podeu deixar la població en blanc."
msgid "Province can not be empty."
msgstr "No podeu deixar la província en blanc."
-#: pkg/company/admin.go:233 pkg/booking/public.go:531
+#: pkg/company/admin.go:233 pkg/booking/public.go:539
msgid "Postcode can not be empty."
msgstr "No podeu deixar el codi postal en blanc."
-#: pkg/company/admin.go:234 pkg/booking/public.go:532
+#: pkg/company/admin.go:234 pkg/booking/public.go:540
msgid "This postcode is not valid."
msgstr "Aquest codi postal no és vàlid."
@@ -2783,27 +2783,27 @@ msgstr "No podeu deixar el fitxer del mèdia en blanc."
msgid "Filename can not be empty."
msgstr "No podeu deixar el nom del fitxer en blanc."
-#: pkg/booking/cart.go:153
+#: pkg/booking/cart.go:159
msgctxt "cart"
msgid "Night"
msgstr "Nit"
-#: pkg/booking/cart.go:154
+#: pkg/booking/cart.go:160
msgctxt "cart"
msgid "Adult"
msgstr "Adult"
-#: pkg/booking/cart.go:155
+#: pkg/booking/cart.go:161
msgctxt "cart"
msgid "Teenager"
msgstr "Adolescent"
-#: pkg/booking/cart.go:156
+#: pkg/booking/cart.go:162
msgctxt "cart"
msgid "Child"
msgstr "Nen"
-#: pkg/booking/cart.go:157
+#: pkg/booking/cart.go:163
msgctxt "cart"
msgid "Dog"
msgstr "Gos"
@@ -2849,92 +2849,92 @@ msgstr "La data de sortida ha de ser igual o posterior a %s."
msgid "Departure date must be %s or before."
msgstr "La data de sortida ha de ser anterior o igual a %s."
-#: pkg/booking/public.go:356
+#: pkg/booking/public.go:368
#, c-format
msgid "There can be at most %d guests in this accommodation."
msgstr "Hi poden haver com a màxim %d convidats a aquest allotjament."
-#: pkg/booking/public.go:376
+#: pkg/booking/public.go:388
msgid "Number of adults can not be empty"
msgstr "No podeu deixar el número d’adults en blanc."
-#: pkg/booking/public.go:377
+#: pkg/booking/public.go:389
msgid "Number of adults must be an integer."
msgstr "El número d’adults ha de ser enter."
-#: pkg/booking/public.go:378
+#: pkg/booking/public.go:390
msgid "There must be at least one adult."
msgstr "Hi ha d’haver com a mínim un adult."
-#: pkg/booking/public.go:381
+#: pkg/booking/public.go:393
msgid "Number of teenagers can not be empty"
msgstr "No podeu deixar el número d’adolescents en blanc."
-#: pkg/booking/public.go:382
+#: pkg/booking/public.go:394
msgid "Number of teenagers must be an integer."
msgstr "El número d’adolescents ha de ser enter."
-#: pkg/booking/public.go:383
+#: pkg/booking/public.go:395
msgid "Number of teenagers can not be negative."
msgstr "El número d’adolescents no pot ser negatiu."
-#: pkg/booking/public.go:386
+#: pkg/booking/public.go:398
msgid "Number of children can not be empty"
msgstr "No podeu deixar el número de nens en blanc."
-#: pkg/booking/public.go:387
+#: pkg/booking/public.go:399
msgid "Number of children must be an integer."
msgstr "El número de nens ha de ser enter."
-#: pkg/booking/public.go:388
+#: pkg/booking/public.go:400
msgid "Number of children can not be negative."
msgstr "El número de nens no pot ser negatiu."
-#: pkg/booking/public.go:391
+#: pkg/booking/public.go:403
msgid "Number of dogs can not be empty"
msgstr "No podeu deixar el número de gossos en blanc."
-#: pkg/booking/public.go:392
+#: pkg/booking/public.go:404
msgid "Number of dogs must be an integer."
msgstr "El número de gossos ha de ser enter."
-#: pkg/booking/public.go:393
+#: pkg/booking/public.go:405
msgid "Number of dogs can not be negative."
msgstr "El número de gossos no pot ser negatiu."
-#: pkg/booking/public.go:464
+#: pkg/booking/public.go:476
#, c-format
msgid "%s can not be empty"
msgstr "No podeu deixar %s en blanc."
-#: pkg/booking/public.go:465
+#: pkg/booking/public.go:477
#, c-format
msgid "%s must be an integer."
msgstr "%s ha de ser un número enter."
-#: pkg/booking/public.go:466
+#: pkg/booking/public.go:478
#, c-format
msgid "%s must be %d or greater."
msgstr "El valor de %s ha de ser com a mínim %d."
-#: pkg/booking/public.go:467
+#: pkg/booking/public.go:479
#, c-format
msgid "%s must be at most %d."
msgstr "El valor de %s ha de ser com a màxim %d."
-#: pkg/booking/public.go:525
+#: pkg/booking/public.go:533
msgid "Full name can not be empty."
msgstr "No podeu deixar el nom i els cognoms en blanc."
-#: pkg/booking/public.go:526
+#: pkg/booking/public.go:534
msgid "Full name must have at least one letter."
msgstr "El nom i els cognoms han de tenir com a mínim una lletra."
-#: pkg/booking/public.go:530
+#: pkg/booking/public.go:538
msgid "Town or village can not be empty."
msgstr "No podeu deixar la població en blanc."
-#: pkg/booking/public.go:545
+#: pkg/booking/public.go:553
msgid "It is mandatory to agree to the reservation conditions."
msgstr "És obligatori acceptar les condicions de reserves."
diff --git a/po/es.po b/po/es.po
index 0528e24..ff772e3 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
-"POT-Creation-Date: 2024-02-29 16:55+0100\n"
+"POT-Creation-Date: 2024-03-14 22:05+0100\n"
"PO-Revision-Date: 2024-02-06 10:04+0100\n"
"Last-Translator: jordi fita mas \n"
"Language-Team: Spanish \n"
@@ -127,160 +127,13 @@ msgid "Area preferences"
msgstr "Preferencias de área"
#: web/templates/mail/payment/details.gotxt:18
-#: web/templates/public/campsite/dates.gohtml:4
-#: web/templates/public/booking/fields.gohtml:30
#: web/templates/admin/payment/details.gohtml:52
msgctxt "input"
-msgid "Arrival date"
-msgstr "Fecha de llegada"
-
-#: web/templates/mail/payment/details.gotxt:19
-#: web/templates/public/campsite/dates.gohtml:15
-#: web/templates/public/booking/fields.gohtml:41
-#: web/templates/admin/payment/details.gohtml:56
-msgctxt "input"
-msgid "Departure date"
-msgstr "Fecha de salida"
-
-#: web/templates/mail/payment/details.gotxt:20
-#: web/templates/admin/payment/details.gohtml:60
-msgctxt "cart"
-msgid "Nights"
-msgstr "Noches"
-
-#: web/templates/mail/payment/details.gotxt:21
-#: web/templates/public/booking/fields.gohtml:60
-#: web/templates/admin/payment/details.gohtml:64
-msgctxt "input"
-msgid "Adults aged 17 or older"
-msgstr "Adultos de 17 años o más"
-
-#: web/templates/mail/payment/details.gotxt:22
-#: web/templates/public/booking/fields.gohtml:71
-#: web/templates/admin/payment/details.gohtml:68
-msgctxt "input"
-msgid "Teenagers from 11 to 16 years old"
-msgstr "Adolescentes de 11 a 16 años"
-
-#: web/templates/mail/payment/details.gotxt:23
-#: web/templates/public/booking/fields.gohtml:82
-#: web/templates/admin/payment/details.gohtml:72
-msgctxt "input"
-msgid "Children from 2 to 10 years old"
-msgstr "Niños de 2 a 10 años"
-
-#: web/templates/mail/payment/details.gotxt:24
-#: web/templates/public/booking/fields.gohtml:100
-#: web/templates/admin/payment/details.gohtml:76
-msgctxt "input"
-msgid "Dogs"
-msgstr "Perros"
-
-#: web/templates/mail/payment/details.gotxt:25
-#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:191
-msgctxt "cart"
-msgid "Tourist tax"
-msgstr "Impuesto turístico"
-
-#: web/templates/mail/payment/details.gotxt:26
-#: web/templates/public/booking/fields.gohtml:242
-msgctxt "cart"
-msgid "Total"
-msgstr "Total"
-
-#: web/templates/mail/payment/details.gotxt:27
-#: web/templates/public/booking/fields.gohtml:247
-#: web/templates/admin/payment/details.gohtml:84
-msgctxt "cart"
-msgid "Down payment"
-msgstr "A cuenta"
-
-#: web/templates/mail/payment/details.gotxt:30
-#: web/templates/admin/payment/details.gohtml:92
-#: web/templates/admin/campsite/type/option/form.gohtml:18
-#: web/templates/admin/campsite/type/option/index.gohtml:6
-#: web/templates/admin/campsite/type/option/index.gohtml:17
-msgctxt "title"
-msgid "Campsite Type Options"
-msgstr "Opciones del tipo de alojamiento"
-
-#: web/templates/mail/payment/details.gotxt:38
-#: web/templates/public/booking/fields.gohtml:146
-#: web/templates/admin/payment/details.gohtml:106
-msgctxt "title"
-msgid "Customer Details"
-msgstr "Detalles del cliente"
-
-#: web/templates/mail/payment/details.gotxt:40
-#: web/templates/public/booking/fields.gohtml:149
-#: web/templates/admin/payment/details.gohtml:109
-msgctxt "input"
-msgid "Full name"
-msgstr "Nombre y apellidos"
-
-#: web/templates/mail/payment/details.gotxt:41
-#: web/templates/public/booking/fields.gohtml:158
-#: web/templates/admin/payment/details.gohtml:113
-#: web/templates/admin/taxDetails.gohtml:69
-msgctxt "input"
-msgid "Address"
-msgstr "Dirección"
-
-#: web/templates/mail/payment/details.gotxt:42
-#: web/templates/public/booking/fields.gohtml:167
-#: web/templates/admin/payment/details.gohtml:117
-#: web/templates/admin/taxDetails.gohtml:93
-msgctxt "input"
-msgid "Postcode"
-msgstr "Código postal"
-
-#: web/templates/mail/payment/details.gotxt:43
-#: web/templates/admin/payment/details.gohtml:121
-#: web/templates/admin/taxDetails.gohtml:77
-msgctxt "input"
-msgid "City"
-msgstr "Población"
-
-#: web/templates/mail/payment/details.gotxt:44
-#: web/templates/public/booking/fields.gohtml:185
-#: web/templates/admin/payment/details.gohtml:125
-#: web/templates/admin/taxDetails.gohtml:101
-msgctxt "input"
-msgid "Country"
-msgstr "País"
-
-#: web/templates/mail/payment/details.gotxt:45
-#: web/templates/public/booking/fields.gohtml:196
-#: web/templates/admin/payment/details.gohtml:129
-#: web/templates/admin/login.gohtml:27 web/templates/admin/profile.gohtml:38
-#: web/templates/admin/taxDetails.gohtml:53
-msgctxt "input"
-msgid "Email"
-msgstr "Correo-e"
-
-#: web/templates/mail/payment/details.gotxt:46
-#: web/templates/public/booking/fields.gohtml:205
-#: web/templates/admin/payment/details.gohtml:133
-#: web/templates/admin/taxDetails.gohtml:45
-msgctxt "input"
-msgid "Phone"
-msgstr "Teléfono"
-
-#: web/templates/mail/payment/details.gotxt:47
-#: web/templates/admin/payment/details.gohtml:137
-#: web/templates/admin/profile.gohtml:68
-msgctxt "input"
-msgid "Language"
-msgstr "Idioma"
-
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:141
-msgctxt "input"
msgid "ACSI card?"
msgstr "¿Tarjeta ACSI?"
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:142
+#: web/templates/mail/payment/details.gotxt:18
+#: web/templates/admin/payment/details.gohtml:53
#: web/templates/admin/campsite/index.gohtml:41
#: web/templates/admin/campsite/type/index.gohtml:53
#: web/templates/admin/season/index.gohtml:44
@@ -289,8 +142,8 @@ msgstr "¿Tarjeta ACSI?"
msgid "Yes"
msgstr "Sí"
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:142
+#: web/templates/mail/payment/details.gotxt:18
+#: web/templates/admin/payment/details.gohtml:53
#: web/templates/admin/campsite/index.gohtml:41
#: web/templates/admin/campsite/type/index.gohtml:53
#: web/templates/admin/season/index.gohtml:44
@@ -299,6 +152,153 @@ msgstr "Sí"
msgid "No"
msgstr "No"
+#: web/templates/mail/payment/details.gotxt:19
+#: web/templates/public/campsite/dates.gohtml:4
+#: web/templates/public/booking/fields.gohtml:30
+#: web/templates/admin/payment/details.gohtml:56
+msgctxt "input"
+msgid "Arrival date"
+msgstr "Fecha de llegada"
+
+#: web/templates/mail/payment/details.gotxt:20
+#: web/templates/public/campsite/dates.gohtml:15
+#: web/templates/public/booking/fields.gohtml:41
+#: web/templates/admin/payment/details.gohtml:60
+msgctxt "input"
+msgid "Departure date"
+msgstr "Fecha de salida"
+
+#: web/templates/mail/payment/details.gotxt:21
+#: web/templates/admin/payment/details.gohtml:64
+msgctxt "cart"
+msgid "Nights"
+msgstr "Noches"
+
+#: web/templates/mail/payment/details.gotxt:22
+#: web/templates/public/booking/fields.gohtml:60
+#: web/templates/admin/payment/details.gohtml:68
+msgctxt "input"
+msgid "Adults aged 17 or older"
+msgstr "Adultos de 17 años o más"
+
+#: web/templates/mail/payment/details.gotxt:23
+#: web/templates/public/booking/fields.gohtml:71
+#: web/templates/admin/payment/details.gohtml:72
+msgctxt "input"
+msgid "Teenagers from 11 to 16 years old"
+msgstr "Adolescentes de 11 a 16 años"
+
+#: web/templates/mail/payment/details.gotxt:24
+#: web/templates/public/booking/fields.gohtml:82
+#: web/templates/admin/payment/details.gohtml:76
+msgctxt "input"
+msgid "Children from 2 to 10 years old"
+msgstr "Niños de 2 a 10 años"
+
+#: web/templates/mail/payment/details.gotxt:25
+#: web/templates/public/booking/fields.gohtml:100
+#: web/templates/admin/payment/details.gohtml:80
+msgctxt "input"
+msgid "Dogs"
+msgstr "Perros"
+
+#: web/templates/mail/payment/details.gotxt:26
+#: web/templates/admin/payment/details.gohtml:84 pkg/booking/cart.go:197
+msgctxt "cart"
+msgid "Tourist tax"
+msgstr "Impuesto turístico"
+
+#: web/templates/mail/payment/details.gotxt:27
+#: web/templates/public/booking/fields.gohtml:225
+msgctxt "cart"
+msgid "Total"
+msgstr "Total"
+
+#: web/templates/mail/payment/details.gotxt:28
+#: web/templates/public/booking/fields.gohtml:230
+#: web/templates/admin/payment/details.gohtml:88
+msgctxt "cart"
+msgid "Down payment"
+msgstr "A cuenta"
+
+#: web/templates/mail/payment/details.gotxt:31
+#: web/templates/admin/payment/details.gohtml:96
+#: web/templates/admin/campsite/type/option/form.gohtml:18
+#: web/templates/admin/campsite/type/option/index.gohtml:6
+#: web/templates/admin/campsite/type/option/index.gohtml:17
+msgctxt "title"
+msgid "Campsite Type Options"
+msgstr "Opciones del tipo de alojamiento"
+
+#: web/templates/mail/payment/details.gotxt:39
+#: web/templates/public/booking/fields.gohtml:146
+#: web/templates/admin/payment/details.gohtml:110
+msgctxt "title"
+msgid "Customer Details"
+msgstr "Detalles del cliente"
+
+#: web/templates/mail/payment/details.gotxt:41
+#: web/templates/public/booking/fields.gohtml:149
+#: web/templates/admin/payment/details.gohtml:113
+msgctxt "input"
+msgid "Full name"
+msgstr "Nombre y apellidos"
+
+#: web/templates/mail/payment/details.gotxt:42
+#: web/templates/public/booking/fields.gohtml:158
+#: web/templates/admin/payment/details.gohtml:117
+#: web/templates/admin/taxDetails.gohtml:69
+msgctxt "input"
+msgid "Address"
+msgstr "Dirección"
+
+#: web/templates/mail/payment/details.gotxt:43
+#: web/templates/public/booking/fields.gohtml:167
+#: web/templates/admin/payment/details.gohtml:121
+#: web/templates/admin/taxDetails.gohtml:93
+msgctxt "input"
+msgid "Postcode"
+msgstr "Código postal"
+
+#: web/templates/mail/payment/details.gotxt:44
+#: web/templates/admin/payment/details.gohtml:125
+#: web/templates/admin/taxDetails.gohtml:77
+msgctxt "input"
+msgid "City"
+msgstr "Población"
+
+#: web/templates/mail/payment/details.gotxt:45
+#: web/templates/public/booking/fields.gohtml:185
+#: web/templates/admin/payment/details.gohtml:129
+#: web/templates/admin/taxDetails.gohtml:101
+msgctxt "input"
+msgid "Country"
+msgstr "País"
+
+#: web/templates/mail/payment/details.gotxt:46
+#: web/templates/public/booking/fields.gohtml:196
+#: web/templates/admin/payment/details.gohtml:133
+#: web/templates/admin/login.gohtml:27 web/templates/admin/profile.gohtml:38
+#: web/templates/admin/taxDetails.gohtml:53
+msgctxt "input"
+msgid "Email"
+msgstr "Correo-e"
+
+#: web/templates/mail/payment/details.gotxt:47
+#: web/templates/public/booking/fields.gohtml:205
+#: web/templates/admin/payment/details.gohtml:137
+#: web/templates/admin/taxDetails.gohtml:45
+msgctxt "input"
+msgid "Phone"
+msgstr "Teléfono"
+
+#: web/templates/mail/payment/details.gotxt:48
+#: web/templates/admin/payment/details.gohtml:141
+#: web/templates/admin/profile.gohtml:68
+msgctxt "input"
+msgid "Language"
+msgstr "Idioma"
+
#: web/templates/mail/payment/details.gotxt:54
msgid "Best regards,"
msgstr "Saludos,"
@@ -490,7 +490,7 @@ msgid "Discover"
msgstr "Descubre"
#: web/templates/public/campsite/type.gohtml:49
-#: web/templates/public/booking/fields.gohtml:269
+#: web/templates/public/booking/fields.gohtml:273
msgctxt "action"
msgid "Book"
msgstr "Reservar"
@@ -917,25 +917,25 @@ msgstr "Población"
msgid "Choose a country"
msgstr "Escoja un país"
-#: web/templates/public/booking/fields.gohtml:216
+#: web/templates/public/booking/fields.gohtml:242
msgctxt "input"
msgid "ACSI card? (optional)"
msgstr "¿Tarjeta ACSI? (opcional)"
-#: web/templates/public/booking/fields.gohtml:224
+#: web/templates/public/booking/fields.gohtml:250
msgctxt "input"
msgid "I have read and I accept %[1]sthe reservation conditions%[2]s"
msgstr "He leído y acepto %[1]slas condiciones de reserva%[2]s"
-#: web/templates/public/booking/fields.gohtml:261
+#: web/templates/public/booking/fields.gohtml:258
msgid "By down paying the %d %% of the total, you are pre-booking your preferences. We will respond within 24 hours and this percentage will be charged if accepted."
msgstr "En tramitar el %d %% del total estáis realizando la prerreserva de vuestras preferencias. Os responderemos en un término de 24 horas y os cobraremos este porcentaje en caso que sea aceptada."
-#: web/templates/public/booking/fields.gohtml:263
+#: web/templates/public/booking/fields.gohtml:260
msgid "By paying the total you are pre-booking your preferences. We will respond within 24 hours and this amount will be charged if accepted."
msgstr "En tramitar el pago del total estáis realizando la prerreserva de vuestras preferencias. Os responderemos en un término de 24 horas y os cobraremos esta cantidad en caso que sea aceptada."
-#: web/templates/public/booking/fields.gohtml:267
+#: web/templates/public/booking/fields.gohtml:264
msgid "See <%s>our conditions%s> for more information."
msgstr "Consultad <%s>nuestras condiciones%s> para más información."
@@ -2270,7 +2270,7 @@ msgctxt "order product name"
msgid "Campsite Booking"
msgstr "Reserva de camping"
-#: pkg/payment/public.go:372
+#: pkg/payment/public.go:369
msgctxt "subject"
msgid "Booking payment successfully received"
msgstr "Se ha recibido correctamente el pago de la reserva"
@@ -2314,12 +2314,12 @@ msgid "Slide image must be an image media type."
msgstr "La imagen de la diapositiva tiene que ser un medio de tipo imagen."
#: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:224
-#: pkg/booking/public.go:536
+#: pkg/booking/public.go:544
msgid "Email can not be empty."
msgstr "No podéis dejar el correo-e en blanco."
#: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:225
-#: pkg/booking/public.go:537
+#: pkg/booking/public.go:545
msgid "This email is not valid. It should be like name@domain.com."
msgstr "Este correo-e no es válido. Tiene que ser parecido a nombre@dominio.com."
@@ -2687,7 +2687,7 @@ msgstr "No podéis dejar la dirección del enlace en blanco."
msgid "This web address is not valid. It should be like https://domain.com/."
msgstr "Esta dirección web no es válida. Tiene que ser parecido a https://dominio.com/."
-#: pkg/company/admin.go:207 pkg/booking/public.go:521
+#: pkg/company/admin.go:207 pkg/booking/public.go:529
msgid "Selected country is not valid."
msgstr "El país escogido no es válido."
@@ -2707,15 +2707,15 @@ msgstr "No podéis dejar el NIF en blanco."
msgid "This VAT number is not valid."
msgstr "Este NIF no es válido."
-#: pkg/company/admin.go:219 pkg/booking/public.go:539
+#: pkg/company/admin.go:219 pkg/booking/public.go:547
msgid "Phone can not be empty."
msgstr "No podéis dejar el teléfono en blanco."
-#: pkg/company/admin.go:220 pkg/booking/public.go:540
+#: pkg/company/admin.go:220 pkg/booking/public.go:548
msgid "This phone number is not valid."
msgstr "Este teléfono no es válido."
-#: pkg/company/admin.go:230 pkg/booking/public.go:529
+#: pkg/company/admin.go:230 pkg/booking/public.go:537
msgid "Address can not be empty."
msgstr "No podéis dejar la dirección en blanco."
@@ -2727,11 +2727,11 @@ msgstr "No podéis dejar la población en blanco."
msgid "Province can not be empty."
msgstr "No podéis dejar la provincia en blanco."
-#: pkg/company/admin.go:233 pkg/booking/public.go:531
+#: pkg/company/admin.go:233 pkg/booking/public.go:539
msgid "Postcode can not be empty."
msgstr "No podéis dejar el código postal en blanco."
-#: pkg/company/admin.go:234 pkg/booking/public.go:532
+#: pkg/company/admin.go:234 pkg/booking/public.go:540
msgid "This postcode is not valid."
msgstr "Este código postal no es válido."
@@ -2783,27 +2783,27 @@ msgstr "No podéis dejar el archivo del medio en blanco."
msgid "Filename can not be empty."
msgstr "No podéis dejar el nombre del archivo en blanco."
-#: pkg/booking/cart.go:153
+#: pkg/booking/cart.go:159
msgctxt "cart"
msgid "Night"
msgstr "Noche"
-#: pkg/booking/cart.go:154
+#: pkg/booking/cart.go:160
msgctxt "cart"
msgid "Adult"
msgstr "Adulto"
-#: pkg/booking/cart.go:155
+#: pkg/booking/cart.go:161
msgctxt "cart"
msgid "Teenager"
msgstr "Adolescente"
-#: pkg/booking/cart.go:156
+#: pkg/booking/cart.go:162
msgctxt "cart"
msgid "Child"
msgstr "Niño"
-#: pkg/booking/cart.go:157
+#: pkg/booking/cart.go:163
msgctxt "cart"
msgid "Dog"
msgstr "Perro"
@@ -2849,92 +2849,92 @@ msgstr "La fecha de partida tiene que igual o posterior a %s."
msgid "Departure date must be %s or before."
msgstr "La fecha de partida tiene que ser anterior o igual a %s."
-#: pkg/booking/public.go:356
+#: pkg/booking/public.go:368
#, c-format
msgid "There can be at most %d guests in this accommodation."
msgstr "Solo puede haber como máximo %d invitados en este alojamiento."
-#: pkg/booking/public.go:376
+#: pkg/booking/public.go:388
msgid "Number of adults can not be empty"
msgstr "No podéis dejar el número de adultos blanco."
-#: pkg/booking/public.go:377
+#: pkg/booking/public.go:389
msgid "Number of adults must be an integer."
msgstr "El número de adultos tiene que ser entero."
-#: pkg/booking/public.go:378
+#: pkg/booking/public.go:390
msgid "There must be at least one adult."
msgstr "Tiene que haber como mínimo un adulto."
-#: pkg/booking/public.go:381
+#: pkg/booking/public.go:393
msgid "Number of teenagers can not be empty"
msgstr "No podéis dejar el número de adolescentes en blanco."
-#: pkg/booking/public.go:382
+#: pkg/booking/public.go:394
msgid "Number of teenagers must be an integer."
msgstr "El número de adolescentes tiene que ser entero."
-#: pkg/booking/public.go:383
+#: pkg/booking/public.go:395
msgid "Number of teenagers can not be negative."
msgstr "El número de adolescentes no puede ser negativo."
-#: pkg/booking/public.go:386
+#: pkg/booking/public.go:398
msgid "Number of children can not be empty"
msgstr "No podéis dejar el número de niños en blanco."
-#: pkg/booking/public.go:387
+#: pkg/booking/public.go:399
msgid "Number of children must be an integer."
msgstr "El número de niños tiene que ser entero."
-#: pkg/booking/public.go:388
+#: pkg/booking/public.go:400
msgid "Number of children can not be negative."
msgstr "El número de niños no puede ser negativo."
-#: pkg/booking/public.go:391
+#: pkg/booking/public.go:403
msgid "Number of dogs can not be empty"
msgstr "No podéis dejar el número de perros en blanco."
-#: pkg/booking/public.go:392
+#: pkg/booking/public.go:404
msgid "Number of dogs must be an integer."
msgstr "El número de perros tiene que ser entero."
-#: pkg/booking/public.go:393
+#: pkg/booking/public.go:405
msgid "Number of dogs can not be negative."
msgstr "El número de perros no puede ser negativo."
-#: pkg/booking/public.go:464
+#: pkg/booking/public.go:476
#, c-format
msgid "%s can not be empty"
msgstr "No podéis dejar %s en blanco."
-#: pkg/booking/public.go:465
+#: pkg/booking/public.go:477
#, c-format
msgid "%s must be an integer."
msgstr "%s tiene que ser un número entero."
-#: pkg/booking/public.go:466
+#: pkg/booking/public.go:478
#, c-format
msgid "%s must be %d or greater."
msgstr "%s tiene que ser como mínimo %d."
-#: pkg/booking/public.go:467
+#: pkg/booking/public.go:479
#, c-format
msgid "%s must be at most %d."
msgstr "%s tiene que ser como máximo %d"
-#: pkg/booking/public.go:525
+#: pkg/booking/public.go:533
msgid "Full name can not be empty."
msgstr "No podéis dejar el nombre y los apellidos en blanco."
-#: pkg/booking/public.go:526
+#: pkg/booking/public.go:534
msgid "Full name must have at least one letter."
msgstr "El nombre y los apellidos tienen que tener como mínimo una letra."
-#: pkg/booking/public.go:530
+#: pkg/booking/public.go:538
msgid "Town or village can not be empty."
msgstr "No podéis dejar la población en blanco."
-#: pkg/booking/public.go:545
+#: pkg/booking/public.go:553
msgid "It is mandatory to agree to the reservation conditions."
msgstr "Es obligatorio aceptar las condiciones de reserva."
diff --git a/po/fr.po b/po/fr.po
index 4574899..d68981b 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
-"POT-Creation-Date: 2024-02-29 16:55+0100\n"
+"POT-Creation-Date: 2024-03-14 22:05+0100\n"
"PO-Revision-Date: 2024-02-06 10:05+0100\n"
"Last-Translator: Oriol Carbonell \n"
"Language-Team: French \n"
@@ -127,160 +127,13 @@ msgid "Area preferences"
msgstr "Préférences de zone"
#: web/templates/mail/payment/details.gotxt:18
-#: web/templates/public/campsite/dates.gohtml:4
-#: web/templates/public/booking/fields.gohtml:30
#: web/templates/admin/payment/details.gohtml:52
msgctxt "input"
-msgid "Arrival date"
-msgstr "Date d’arrivée"
-
-#: web/templates/mail/payment/details.gotxt:19
-#: web/templates/public/campsite/dates.gohtml:15
-#: web/templates/public/booking/fields.gohtml:41
-#: web/templates/admin/payment/details.gohtml:56
-msgctxt "input"
-msgid "Departure date"
-msgstr "Date de depart"
-
-#: web/templates/mail/payment/details.gotxt:20
-#: web/templates/admin/payment/details.gohtml:60
-msgctxt "cart"
-msgid "Nights"
-msgstr "Nuits"
-
-#: web/templates/mail/payment/details.gotxt:21
-#: web/templates/public/booking/fields.gohtml:60
-#: web/templates/admin/payment/details.gohtml:64
-msgctxt "input"
-msgid "Adults aged 17 or older"
-msgstr "Adultes âgés 17 ans ou plus"
-
-#: web/templates/mail/payment/details.gotxt:22
-#: web/templates/public/booking/fields.gohtml:71
-#: web/templates/admin/payment/details.gohtml:68
-msgctxt "input"
-msgid "Teenagers from 11 to 16 years old"
-msgstr "Adolescents de 11 à 16 ans"
-
-#: web/templates/mail/payment/details.gotxt:23
-#: web/templates/public/booking/fields.gohtml:82
-#: web/templates/admin/payment/details.gohtml:72
-msgctxt "input"
-msgid "Children from 2 to 10 years old"
-msgstr "Enfants de 2 à 10 ans"
-
-#: web/templates/mail/payment/details.gotxt:24
-#: web/templates/public/booking/fields.gohtml:100
-#: web/templates/admin/payment/details.gohtml:76
-msgctxt "input"
-msgid "Dogs"
-msgstr "Chiens"
-
-#: web/templates/mail/payment/details.gotxt:25
-#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:191
-msgctxt "cart"
-msgid "Tourist tax"
-msgstr "Taxe touristique"
-
-#: web/templates/mail/payment/details.gotxt:26
-#: web/templates/public/booking/fields.gohtml:242
-msgctxt "cart"
-msgid "Total"
-msgstr "Totale"
-
-#: web/templates/mail/payment/details.gotxt:27
-#: web/templates/public/booking/fields.gohtml:247
-#: web/templates/admin/payment/details.gohtml:84
-msgctxt "cart"
-msgid "Down payment"
-msgstr "Acompte"
-
-#: web/templates/mail/payment/details.gotxt:30
-#: web/templates/admin/payment/details.gohtml:92
-#: web/templates/admin/campsite/type/option/form.gohtml:18
-#: web/templates/admin/campsite/type/option/index.gohtml:6
-#: web/templates/admin/campsite/type/option/index.gohtml:17
-msgctxt "title"
-msgid "Campsite Type Options"
-msgstr "Options de type d’emplacement de camping"
-
-#: web/templates/mail/payment/details.gotxt:38
-#: web/templates/public/booking/fields.gohtml:146
-#: web/templates/admin/payment/details.gohtml:106
-msgctxt "title"
-msgid "Customer Details"
-msgstr "Détails du client"
-
-#: web/templates/mail/payment/details.gotxt:40
-#: web/templates/public/booking/fields.gohtml:149
-#: web/templates/admin/payment/details.gohtml:109
-msgctxt "input"
-msgid "Full name"
-msgstr "Nom et prénom"
-
-#: web/templates/mail/payment/details.gotxt:41
-#: web/templates/public/booking/fields.gohtml:158
-#: web/templates/admin/payment/details.gohtml:113
-#: web/templates/admin/taxDetails.gohtml:69
-msgctxt "input"
-msgid "Address"
-msgstr "Adresse"
-
-#: web/templates/mail/payment/details.gotxt:42
-#: web/templates/public/booking/fields.gohtml:167
-#: web/templates/admin/payment/details.gohtml:117
-#: web/templates/admin/taxDetails.gohtml:93
-msgctxt "input"
-msgid "Postcode"
-msgstr "Code postal"
-
-#: web/templates/mail/payment/details.gotxt:43
-#: web/templates/admin/payment/details.gohtml:121
-#: web/templates/admin/taxDetails.gohtml:77
-msgctxt "input"
-msgid "City"
-msgstr "Ville"
-
-#: web/templates/mail/payment/details.gotxt:44
-#: web/templates/public/booking/fields.gohtml:185
-#: web/templates/admin/payment/details.gohtml:125
-#: web/templates/admin/taxDetails.gohtml:101
-msgctxt "input"
-msgid "Country"
-msgstr "Pays"
-
-#: web/templates/mail/payment/details.gotxt:45
-#: web/templates/public/booking/fields.gohtml:196
-#: web/templates/admin/payment/details.gohtml:129
-#: web/templates/admin/login.gohtml:27 web/templates/admin/profile.gohtml:38
-#: web/templates/admin/taxDetails.gohtml:53
-msgctxt "input"
-msgid "Email"
-msgstr "E-mail"
-
-#: web/templates/mail/payment/details.gotxt:46
-#: web/templates/public/booking/fields.gohtml:205
-#: web/templates/admin/payment/details.gohtml:133
-#: web/templates/admin/taxDetails.gohtml:45
-msgctxt "input"
-msgid "Phone"
-msgstr "Téléphone"
-
-#: web/templates/mail/payment/details.gotxt:47
-#: web/templates/admin/payment/details.gohtml:137
-#: web/templates/admin/profile.gohtml:68
-msgctxt "input"
-msgid "Language"
-msgstr "Langue"
-
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:141
-msgctxt "input"
msgid "ACSI card?"
msgstr "Carte ACSI ?"
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:142
+#: web/templates/mail/payment/details.gotxt:18
+#: web/templates/admin/payment/details.gohtml:53
#: web/templates/admin/campsite/index.gohtml:41
#: web/templates/admin/campsite/type/index.gohtml:53
#: web/templates/admin/season/index.gohtml:44
@@ -289,8 +142,8 @@ msgstr "Carte ACSI ?"
msgid "Yes"
msgstr "Oui"
-#: web/templates/mail/payment/details.gotxt:48
-#: web/templates/admin/payment/details.gohtml:142
+#: web/templates/mail/payment/details.gotxt:18
+#: web/templates/admin/payment/details.gohtml:53
#: web/templates/admin/campsite/index.gohtml:41
#: web/templates/admin/campsite/type/index.gohtml:53
#: web/templates/admin/season/index.gohtml:44
@@ -299,6 +152,153 @@ msgstr "Oui"
msgid "No"
msgstr "Non"
+#: web/templates/mail/payment/details.gotxt:19
+#: web/templates/public/campsite/dates.gohtml:4
+#: web/templates/public/booking/fields.gohtml:30
+#: web/templates/admin/payment/details.gohtml:56
+msgctxt "input"
+msgid "Arrival date"
+msgstr "Date d’arrivée"
+
+#: web/templates/mail/payment/details.gotxt:20
+#: web/templates/public/campsite/dates.gohtml:15
+#: web/templates/public/booking/fields.gohtml:41
+#: web/templates/admin/payment/details.gohtml:60
+msgctxt "input"
+msgid "Departure date"
+msgstr "Date de depart"
+
+#: web/templates/mail/payment/details.gotxt:21
+#: web/templates/admin/payment/details.gohtml:64
+msgctxt "cart"
+msgid "Nights"
+msgstr "Nuits"
+
+#: web/templates/mail/payment/details.gotxt:22
+#: web/templates/public/booking/fields.gohtml:60
+#: web/templates/admin/payment/details.gohtml:68
+msgctxt "input"
+msgid "Adults aged 17 or older"
+msgstr "Adultes âgés 17 ans ou plus"
+
+#: web/templates/mail/payment/details.gotxt:23
+#: web/templates/public/booking/fields.gohtml:71
+#: web/templates/admin/payment/details.gohtml:72
+msgctxt "input"
+msgid "Teenagers from 11 to 16 years old"
+msgstr "Adolescents de 11 à 16 ans"
+
+#: web/templates/mail/payment/details.gotxt:24
+#: web/templates/public/booking/fields.gohtml:82
+#: web/templates/admin/payment/details.gohtml:76
+msgctxt "input"
+msgid "Children from 2 to 10 years old"
+msgstr "Enfants de 2 à 10 ans"
+
+#: web/templates/mail/payment/details.gotxt:25
+#: web/templates/public/booking/fields.gohtml:100
+#: web/templates/admin/payment/details.gohtml:80
+msgctxt "input"
+msgid "Dogs"
+msgstr "Chiens"
+
+#: web/templates/mail/payment/details.gotxt:26
+#: web/templates/admin/payment/details.gohtml:84 pkg/booking/cart.go:197
+msgctxt "cart"
+msgid "Tourist tax"
+msgstr "Taxe touristique"
+
+#: web/templates/mail/payment/details.gotxt:27
+#: web/templates/public/booking/fields.gohtml:225
+msgctxt "cart"
+msgid "Total"
+msgstr "Totale"
+
+#: web/templates/mail/payment/details.gotxt:28
+#: web/templates/public/booking/fields.gohtml:230
+#: web/templates/admin/payment/details.gohtml:88
+msgctxt "cart"
+msgid "Down payment"
+msgstr "Acompte"
+
+#: web/templates/mail/payment/details.gotxt:31
+#: web/templates/admin/payment/details.gohtml:96
+#: web/templates/admin/campsite/type/option/form.gohtml:18
+#: web/templates/admin/campsite/type/option/index.gohtml:6
+#: web/templates/admin/campsite/type/option/index.gohtml:17
+msgctxt "title"
+msgid "Campsite Type Options"
+msgstr "Options de type d’emplacement de camping"
+
+#: web/templates/mail/payment/details.gotxt:39
+#: web/templates/public/booking/fields.gohtml:146
+#: web/templates/admin/payment/details.gohtml:110
+msgctxt "title"
+msgid "Customer Details"
+msgstr "Détails du client"
+
+#: web/templates/mail/payment/details.gotxt:41
+#: web/templates/public/booking/fields.gohtml:149
+#: web/templates/admin/payment/details.gohtml:113
+msgctxt "input"
+msgid "Full name"
+msgstr "Nom et prénom"
+
+#: web/templates/mail/payment/details.gotxt:42
+#: web/templates/public/booking/fields.gohtml:158
+#: web/templates/admin/payment/details.gohtml:117
+#: web/templates/admin/taxDetails.gohtml:69
+msgctxt "input"
+msgid "Address"
+msgstr "Adresse"
+
+#: web/templates/mail/payment/details.gotxt:43
+#: web/templates/public/booking/fields.gohtml:167
+#: web/templates/admin/payment/details.gohtml:121
+#: web/templates/admin/taxDetails.gohtml:93
+msgctxt "input"
+msgid "Postcode"
+msgstr "Code postal"
+
+#: web/templates/mail/payment/details.gotxt:44
+#: web/templates/admin/payment/details.gohtml:125
+#: web/templates/admin/taxDetails.gohtml:77
+msgctxt "input"
+msgid "City"
+msgstr "Ville"
+
+#: web/templates/mail/payment/details.gotxt:45
+#: web/templates/public/booking/fields.gohtml:185
+#: web/templates/admin/payment/details.gohtml:129
+#: web/templates/admin/taxDetails.gohtml:101
+msgctxt "input"
+msgid "Country"
+msgstr "Pays"
+
+#: web/templates/mail/payment/details.gotxt:46
+#: web/templates/public/booking/fields.gohtml:196
+#: web/templates/admin/payment/details.gohtml:133
+#: web/templates/admin/login.gohtml:27 web/templates/admin/profile.gohtml:38
+#: web/templates/admin/taxDetails.gohtml:53
+msgctxt "input"
+msgid "Email"
+msgstr "E-mail"
+
+#: web/templates/mail/payment/details.gotxt:47
+#: web/templates/public/booking/fields.gohtml:205
+#: web/templates/admin/payment/details.gohtml:137
+#: web/templates/admin/taxDetails.gohtml:45
+msgctxt "input"
+msgid "Phone"
+msgstr "Téléphone"
+
+#: web/templates/mail/payment/details.gotxt:48
+#: web/templates/admin/payment/details.gohtml:141
+#: web/templates/admin/profile.gohtml:68
+msgctxt "input"
+msgid "Language"
+msgstr "Langue"
+
#: web/templates/mail/payment/details.gotxt:54
msgid "Best regards,"
msgstr "Cordialement,"
@@ -490,7 +490,7 @@ msgid "Discover"
msgstr "Découvrir"
#: web/templates/public/campsite/type.gohtml:49
-#: web/templates/public/booking/fields.gohtml:269
+#: web/templates/public/booking/fields.gohtml:273
msgctxt "action"
msgid "Book"
msgstr "Réserver"
@@ -917,25 +917,25 @@ msgstr "Ville"
msgid "Choose a country"
msgstr "Choisissez un pays"
-#: web/templates/public/booking/fields.gohtml:216
+#: web/templates/public/booking/fields.gohtml:242
msgctxt "input"
msgid "ACSI card? (optional)"
msgstr "Carte ACSI ? (Facultatif)"
-#: web/templates/public/booking/fields.gohtml:224
+#: web/templates/public/booking/fields.gohtml:250
msgctxt "input"
msgid "I have read and I accept %[1]sthe reservation conditions%[2]s"
msgstr "J’ai lu et j’accepte %[1]sles conditions de réservation%[2]s"
-#: web/templates/public/booking/fields.gohtml:261
+#: web/templates/public/booking/fields.gohtml:258
msgid "By down paying the %d %% of the total, you are pre-booking your preferences. We will respond within 24 hours and this percentage will be charged if accepted."
msgstr "En En effectuant le paiement de %d %% du total vous pré-réservez vos préférences. Nous vous répondrons dans les 24 heures et ce pourcentage sera facturé en cas d’acceptation."
-#: web/templates/public/booking/fields.gohtml:263
+#: web/templates/public/booking/fields.gohtml:260
msgid "By paying the total you are pre-booking your preferences. We will respond within 24 hours and this amount will be charged if accepted."
msgstr "En procédant au paiement du montant total vous pré-réservez vos préférences. Nous vous répondrons dans les 24 heures et ce montant sera facturé en cas d’acceptation."
-#: web/templates/public/booking/fields.gohtml:267
+#: web/templates/public/booking/fields.gohtml:264
msgid "See <%s>our conditions%s> for more information."
msgstr "Consultez <%s>nos conditions%s> pour plus d’informations."
@@ -2270,7 +2270,7 @@ msgctxt "order product name"
msgid "Campsite Booking"
msgstr "Réservation camping"
-#: pkg/payment/public.go:372
+#: pkg/payment/public.go:369
msgctxt "subject"
msgid "Booking payment successfully received"
msgstr "Paiement de réservation reçu avec succès"
@@ -2314,12 +2314,12 @@ msgid "Slide image must be an image media type."
msgstr "L’image de la diapositive doit être de type média d’image."
#: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:224
-#: pkg/booking/public.go:536
+#: pkg/booking/public.go:544
msgid "Email can not be empty."
msgstr "L’e-mail ne peut pas être vide."
#: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:225
-#: pkg/booking/public.go:537
+#: pkg/booking/public.go:545
msgid "This email is not valid. It should be like name@domain.com."
msgstr "Cette adresse e-mail n’est pas valide. Il devrait en être name@domain.com."
@@ -2687,7 +2687,7 @@ msgstr "L’addresse du lien ne peut pas être vide."
msgid "This web address is not valid. It should be like https://domain.com/."
msgstr "Cette adresse web n’est pas valide. Il devrait en être https://domain.com/."
-#: pkg/company/admin.go:207 pkg/booking/public.go:521
+#: pkg/company/admin.go:207 pkg/booking/public.go:529
msgid "Selected country is not valid."
msgstr "Le pays sélectionné n’est pas valide."
@@ -2707,15 +2707,15 @@ msgstr "Le numéro de TVA ne peut pas être vide."
msgid "This VAT number is not valid."
msgstr "Ce numéro de TVA n’est pas valide."
-#: pkg/company/admin.go:219 pkg/booking/public.go:539
+#: pkg/company/admin.go:219 pkg/booking/public.go:547
msgid "Phone can not be empty."
msgstr "Le téléphone ne peut pas être vide."
-#: pkg/company/admin.go:220 pkg/booking/public.go:540
+#: pkg/company/admin.go:220 pkg/booking/public.go:548
msgid "This phone number is not valid."
msgstr "Ce numéro de téléphone n’est pas valide."
-#: pkg/company/admin.go:230 pkg/booking/public.go:529
+#: pkg/company/admin.go:230 pkg/booking/public.go:537
msgid "Address can not be empty."
msgstr "L’adresse ne peut pas être vide."
@@ -2727,11 +2727,11 @@ msgstr "La ville ne peut pas être vide."
msgid "Province can not be empty."
msgstr "La province ne peut pas être vide."
-#: pkg/company/admin.go:233 pkg/booking/public.go:531
+#: pkg/company/admin.go:233 pkg/booking/public.go:539
msgid "Postcode can not be empty."
msgstr "Le code postal ne peut pas être vide."
-#: pkg/company/admin.go:234 pkg/booking/public.go:532
+#: pkg/company/admin.go:234 pkg/booking/public.go:540
msgid "This postcode is not valid."
msgstr "Ce code postal n’est pas valide."
@@ -2783,27 +2783,27 @@ msgstr "Le fichier téléchargé ne peut pas être vide."
msgid "Filename can not be empty."
msgstr "Le nom de fichier ne peut pas être vide."
-#: pkg/booking/cart.go:153
+#: pkg/booking/cart.go:159
msgctxt "cart"
msgid "Night"
msgstr "Nuit"
-#: pkg/booking/cart.go:154
+#: pkg/booking/cart.go:160
msgctxt "cart"
msgid "Adult"
msgstr "Adulte"
-#: pkg/booking/cart.go:155
+#: pkg/booking/cart.go:161
msgctxt "cart"
msgid "Teenager"
msgstr "Adolescent"
-#: pkg/booking/cart.go:156
+#: pkg/booking/cart.go:162
msgctxt "cart"
msgid "Child"
msgstr "Enfant"
-#: pkg/booking/cart.go:157
+#: pkg/booking/cart.go:163
msgctxt "cart"
msgid "Dog"
msgstr "Chien"
@@ -2849,92 +2849,92 @@ msgstr "La date de départ doit être égale ou postérieure à %s."
msgid "Departure date must be %s or before."
msgstr "La date de départ doit être antérieure ou égale à %s."
-#: pkg/booking/public.go:356
+#: pkg/booking/public.go:368
#, c-format
msgid "There can be at most %d guests in this accommodation."
msgstr "Il peut y avoir au plus %d invités dans cet hébergement."
-#: pkg/booking/public.go:376
+#: pkg/booking/public.go:388
msgid "Number of adults can not be empty"
msgstr "Le nombre d’adultes ne peut pas être vide."
-#: pkg/booking/public.go:377
+#: pkg/booking/public.go:389
msgid "Number of adults must be an integer."
msgstr "Le nombre d’adultes doit être un entier."
-#: pkg/booking/public.go:378
+#: pkg/booking/public.go:390
msgid "There must be at least one adult."
msgstr "Il doit y avoir au moins un adulte."
-#: pkg/booking/public.go:381
+#: pkg/booking/public.go:393
msgid "Number of teenagers can not be empty"
msgstr "Le nombre d’adolescents ne peut pas être vide."
-#: pkg/booking/public.go:382
+#: pkg/booking/public.go:394
msgid "Number of teenagers must be an integer."
msgstr "Le nombre d’adolescents doit être un entier."
-#: pkg/booking/public.go:383
+#: pkg/booking/public.go:395
msgid "Number of teenagers can not be negative."
msgstr "Le nombre d’adolescents ne peut pas être négatif."
-#: pkg/booking/public.go:386
+#: pkg/booking/public.go:398
msgid "Number of children can not be empty"
msgstr "Le nombre d’enfants ne peut pas être vide."
-#: pkg/booking/public.go:387
+#: pkg/booking/public.go:399
msgid "Number of children must be an integer."
msgstr "Le nombre d’enfants doit être un entier."
-#: pkg/booking/public.go:388
+#: pkg/booking/public.go:400
msgid "Number of children can not be negative."
msgstr "Le nombre d’enfants ne peut pas être négatif."
-#: pkg/booking/public.go:391
+#: pkg/booking/public.go:403
msgid "Number of dogs can not be empty"
msgstr "Le nombre de chiens ne peut pas être vide."
-#: pkg/booking/public.go:392
+#: pkg/booking/public.go:404
msgid "Number of dogs must be an integer."
msgstr "Le nombre de chiens nuits être un entier."
-#: pkg/booking/public.go:393
+#: pkg/booking/public.go:405
msgid "Number of dogs can not be negative."
msgstr "Le nombre de chiens ne peut pas être négatif."
-#: pkg/booking/public.go:464
+#: pkg/booking/public.go:476
#, c-format
msgid "%s can not be empty"
msgstr "%s ne peut pas être vide"
-#: pkg/booking/public.go:465
+#: pkg/booking/public.go:477
#, c-format
msgid "%s must be an integer."
msgstr "%s doit être un entier."
-#: pkg/booking/public.go:466
+#: pkg/booking/public.go:478
#, c-format
msgid "%s must be %d or greater."
msgstr "%s doit être %d ou plus."
-#: pkg/booking/public.go:467
+#: pkg/booking/public.go:479
#, c-format
msgid "%s must be at most %d."
msgstr "%s doit être tout au plus %d."
-#: pkg/booking/public.go:525
+#: pkg/booking/public.go:533
msgid "Full name can not be empty."
msgstr "Le nom complet ne peut pas être vide."
-#: pkg/booking/public.go:526
+#: pkg/booking/public.go:534
msgid "Full name must have at least one letter."
msgstr "Le nom complet doit comporter au moins une lettre."
-#: pkg/booking/public.go:530
+#: pkg/booking/public.go:538
msgid "Town or village can not be empty."
msgstr "La ville ne peut pas être vide."
-#: pkg/booking/public.go:545
+#: pkg/booking/public.go:553
msgid "It is mandatory to agree to the reservation conditions."
msgstr "Il est obligatoire d’accepter les conditions de réservation."
diff --git a/revert/acsi.sql b/revert/acsi.sql
new file mode 100644
index 0000000..491cd35
--- /dev/null
+++ b/revert/acsi.sql
@@ -0,0 +1,7 @@
+-- Revert camper:acsi from pg
+
+begin;
+
+drop table if exists camper.acsi;
+
+commit;
diff --git a/revert/acsi_calendar.sql b/revert/acsi_calendar.sql
new file mode 100644
index 0000000..f624091
--- /dev/null
+++ b/revert/acsi_calendar.sql
@@ -0,0 +1,7 @@
+-- Revert camper:acsi_calendar from pg
+
+begin;
+
+drop table if exists camper.acsi_calendar;
+
+commit;
diff --git a/revert/acsi_option.sql b/revert/acsi_option.sql
new file mode 100644
index 0000000..795abcf
--- /dev/null
+++ b/revert/acsi_option.sql
@@ -0,0 +1,7 @@
+-- Revert camper:acsi_option from pg
+
+begin;
+
+drop table if exists camper.acsi_option;
+
+commit;
diff --git a/revert/draft_payment.sql b/revert/draft_payment.sql
index d71c222..0321fb7 100644
--- a/revert/draft_payment.sql
+++ b/revert/draft_payment.sql
@@ -10,11 +10,14 @@
-- requires: campsite_type_option
-- requires: payment
-- requires: payment_option
+-- requires: company__tourist_tax_max_days
begin;
set search_path to camper, public;
+drop function if exists draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, boolean, option_units[]);
+
create or replace function draft_payment(payment_slug uuid, arrival_date date, departure_date date, campsite_type_slug uuid, num_adults integer, num_teenagers integer, num_children integer, num_dogs integer, zone_preferences text, options option_units[]) returns payment as
$$
declare
@@ -58,12 +61,12 @@ begin
, sum(cost_per_child * num_children)::integer
, num_dogs
, sum(case when num_dogs > 0 then coalesce(pet.cost_per_night, 0) else 0 end)::integer
- , sum(tourist_tax * num_adults)::integer
+ , sum(case when day_num <= tourist_tax_max_days then tourist_tax * num_adults else 0 end)::integer
, 0
, currency_code
, case when arrival_date - current_date >= 7 then 0.3 else 1.0 end
, coalesce(zone_preferences, '')
- from generate_series(arrival_date, departure_date - 1, interval '1 day') as date(day)
+ from generate_series(arrival_date, departure_date - 1, interval '1 day') with ordinality as date(day, day_num)
left join season_calendar on season_range @> date.day::date
left join season using (season_id)
left join campsite_type using (company_id)
diff --git a/revert/draft_payment@v5.sql b/revert/draft_payment@v5.sql
new file mode 100644
index 0000000..d71c222
--- /dev/null
+++ b/revert/draft_payment@v5.sql
@@ -0,0 +1,168 @@
+-- Deploy camper:draft_payment to pg
+-- requires: roles
+-- requires: schema_camper
+-- requires: season_calendar
+-- requires: season
+-- requires: campsite_type
+-- requires: campsite_type_pet_cost
+-- requires: campsite_type_cost
+-- requires: campsite_type_option_cost
+-- requires: campsite_type_option
+-- requires: payment
+-- requires: payment_option
+
+begin;
+
+set search_path to camper, public;
+
+create or replace function draft_payment(payment_slug uuid, arrival_date date, departure_date date, campsite_type_slug uuid, num_adults integer, num_teenagers integer, num_children integer, num_dogs integer, zone_preferences text, options option_units[]) returns payment as
+$$
+declare
+ p payment;
+begin
+ if exists(select 1 from payment where slug = payment_slug and payment_status <> 'draft') then
+ payment_slug = null;
+ end if;
+ insert into payment (
+ slug
+ , company_id
+ , campsite_type_id
+ , arrival_date
+ , departure_date
+ , subtotal_nights
+ , number_adults
+ , subtotal_adults
+ , number_teenagers
+ , subtotal_teenagers
+ , number_children
+ , subtotal_children
+ , number_dogs
+ , subtotal_dogs
+ , subtotal_tourist_tax
+ , total
+ , currency_code
+ , down_payment_percent
+ , zone_preferences
+ )
+ select coalesce(payment_slug, gen_random_uuid())
+ , company_id
+ , campsite_type_id
+ , arrival_date
+ , departure_date
+ , sum(cost.cost_per_night * ceiling((num_adults::numeric + num_teenagers::numeric + num_children::numeric) / max_campers::numeric)::integer)::integer
+ , num_adults
+ , sum(cost_per_adult * num_adults)::integer
+ , num_teenagers
+ , sum(cost_per_teenager * num_teenagers)::integer
+ , num_children
+ , sum(cost_per_child * num_children)::integer
+ , num_dogs
+ , sum(case when num_dogs > 0 then coalesce(pet.cost_per_night, 0) else 0 end)::integer
+ , sum(tourist_tax * num_adults)::integer
+ , 0
+ , currency_code
+ , case when arrival_date - current_date >= 7 then 0.3 else 1.0 end
+ , coalesce(zone_preferences, '')
+ from generate_series(arrival_date, departure_date - 1, interval '1 day') as date(day)
+ left join season_calendar on season_range @> date.day::date
+ left join season using (season_id)
+ left join campsite_type using (company_id)
+ left join campsite_type_pet_cost as pet using (campsite_type_id)
+ left join campsite_type_cost as cost using (campsite_type_id, season_id)
+ left join company using (company_id)
+ where campsite_type.slug = campsite_type_slug
+ group by company_id
+ , campsite_type_id
+ , currency_code
+ on conflict (slug) do update
+ set company_id = excluded.company_id
+ , campsite_type_id = excluded.campsite_type_id
+ , arrival_date = excluded.arrival_date
+ , departure_date = excluded.departure_date
+ , subtotal_nights = excluded.subtotal_nights
+ , number_adults = excluded.number_adults
+ , subtotal_adults = excluded.subtotal_adults
+ , number_teenagers = excluded.number_teenagers
+ , subtotal_teenagers = excluded.subtotal_teenagers
+ , number_children = excluded.number_children
+ , subtotal_children = excluded.subtotal_children
+ , number_dogs = excluded.number_dogs
+ , subtotal_dogs = excluded.subtotal_dogs
+ , subtotal_tourist_tax = excluded.subtotal_tourist_tax
+ , total = excluded.total
+ , currency_code = excluded.currency_code
+ , down_payment_percent = excluded.down_payment_percent
+ , zone_preferences = excluded.zone_preferences
+ , updated_at = current_timestamp
+ returning *
+ into p
+ ;
+
+ if array_length(coalesce(options, array[]::option_units[]), 1) > 0 then
+ delete
+ from payment_option
+ where payment_id = p.payment_id
+ and campsite_type_option_id not in (
+ select campsite_type_option_id
+ from unnest(options) as option(campsite_type_option_id, units)
+ );
+
+ insert into payment_option (
+ payment_id
+ , campsite_type_option_id
+ , units
+ , subtotal
+ )
+ select p.payment_id
+ , campsite_type_option_id
+ , units
+ , case when per_night then sum(cost * units)::integer else max(cost * units)::integer end
+ from generate_series(arrival_date, departure_date - 1, interval '1 day') as date(day)
+ join season_calendar on season_range @> date.day::date
+ join campsite_type_option_cost using (season_id)
+ join campsite_type_option using (campsite_type_option_id)
+ join unnest(options) as option(campsite_type_option_id, units) using (campsite_type_option_id)
+ group by campsite_type_option_id
+ , units
+ , per_night
+ on conflict (payment_id, campsite_type_option_id) do update
+ set units = excluded.units
+ , subtotal = excluded.subtotal
+ ;
+
+ with option as (
+ select sum(subtotal)::integer as subtotal
+ from payment_option
+ where payment_id = p.payment_id
+ )
+ update payment
+ set total = subtotal_nights + subtotal_adults + subtotal_teenagers + subtotal_children + subtotal_dogs + subtotal_tourist_tax + coalesce(option.subtotal, 0)
+ from option
+ where payment_id = p.payment_id
+ returning total into p.total
+ ;
+ else
+ delete
+ from payment_option
+ where payment_id = p.payment_id;
+
+ update payment
+ set total = subtotal_nights + subtotal_adults + subtotal_teenagers + subtotal_children + subtotal_dogs + subtotal_tourist_tax
+ where payment_id = p.payment_id
+ returning total into p.total
+ ;
+ end if;
+
+
+ return p;
+end;
+$$
+ language plpgsql
+;
+
+revoke execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) from public;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to guest;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to employee;
+grant execute on function draft_payment(uuid, date, date, uuid, integer, integer, integer, integer, text, option_units[]) to admin;
+
+commit;
diff --git a/revert/payment__acsi_card.sql b/revert/payment__acsi_card.sql
new file mode 100644
index 0000000..2ae8ae5
--- /dev/null
+++ b/revert/payment__acsi_card.sql
@@ -0,0 +1,9 @@
+-- Revert camper:payment__acsi_card from pg
+
+begin;
+
+alter table camper.payment
+drop column if exists acsi_card
+;
+
+commit;
diff --git a/revert/payment_customer__-acsi_card.sql b/revert/payment_customer__-acsi_card.sql
new file mode 100644
index 0000000..39b4bf7
--- /dev/null
+++ b/revert/payment_customer__-acsi_card.sql
@@ -0,0 +1,21 @@
+-- Revert camper:payment_customer__-acsi_card from pg
+
+begin;
+
+set search_path to camper, public;
+
+alter table payment_customer
+add column if not exists acsi_card boolean not null default false
+;
+
+update payment_customer
+set acsi_card = payment.acsi_card
+from payment
+where payment.payment_id = payment_customer.payment_id
+;
+
+alter table payment_customer
+alter column acsi_card drop default
+;
+
+commit;
diff --git a/revert/ready_payment.sql b/revert/ready_payment.sql
index 4656a04..f1a7e13 100644
--- a/revert/ready_payment.sql
+++ b/revert/ready_payment.sql
@@ -1,7 +1,58 @@
--- Revert camper:ready_payment from pg
+-- Deploy camper:ready_payment to pg
+-- requires: roles
+-- requires: schema_camper
+-- requires: payment
+-- requires: payment_customer
+-- requires: country_code
+-- requires: email
+-- requires: extension_pg_libphonenumber
begin;
-drop function if exists camper.ready_payment(uuid, text, text, text, text, camper.country_code, camper.email, text, text, boolean);
+set search_path to camper, public;
+
+drop function if exists ready_payment(uuid, text, text, text, text, country_code, email, text, text);
+
+create or replace function ready_payment(payment_slug uuid, customer_name text, customer_address text, customer_post_code text, customer_city text, customer_country_code country_code, customer_email email, customer_phone text, customer_lang_tag text, customer_acsi_card boolean) returns integer as
+$$
+declare
+ pid integer;
+begin
+ update payment
+ set payment_status = 'pending'
+ , updated_at = current_timestamp
+ where slug = payment_slug
+ and payment_status = 'draft'
+ returning payment_id into pid
+ ;
+
+ if pid is null then
+ raise check_violation using message = 'insert or update on table "payment" violates check constraint "payment_is_draft"';
+ end if;
+
+ insert into payment_customer (payment_id, full_name, address, postal_code, city, country_code, email, phone, acsi_card, lang_tag)
+ values (pid, customer_name, customer_address, customer_post_code, customer_city, customer_country_code, customer_email, parse_packed_phone_number(customer_phone, customer_country_code), customer_acsi_card, customer_lang_tag)
+ on conflict (payment_id) do update
+ set full_name = excluded.full_name
+ , address = excluded.address
+ , postal_code = excluded.postal_code
+ , city = excluded.city
+ , country_code = excluded.country_code
+ , email = excluded.email
+ , phone = excluded.phone
+ , acsi_card = excluded.acsi_card
+ , lang_tag = excluded.lang_tag
+ ;
+
+ return pid;
+end;
+$$
+ language plpgsql
+;
+
+revoke execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) from public;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to guest;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to employee;
+grant execute on function ready_payment(uuid, text, text, text, text, country_code, email, text, text, boolean) to admin;
commit;
diff --git a/revert/ready_payment@v5.sql b/revert/ready_payment@v5.sql
new file mode 100644
index 0000000..4656a04
--- /dev/null
+++ b/revert/ready_payment@v5.sql
@@ -0,0 +1,7 @@
+-- Revert camper:ready_payment from pg
+
+begin;
+
+drop function if exists camper.ready_payment(uuid, text, text, text, text, camper.country_code, camper.email, text, text, boolean);
+
+commit;
diff --git a/sqitch.plan b/sqitch.plan
index ca3ce79..880ea11 100644
--- a/sqitch.plan
+++ b/sqitch.plan
@@ -267,3 +267,10 @@ flush_payments [roles schema_camper payment payment_option payment_redsys_respon
@v5 2024-03-13T19:55:03Z jordi fita mas # Tag v5
season_calendar_season_id_fkey [season season_calendar] 2024-03-14T17:04:30Z jordi fita mas # Add foreign constraint between season_calendar and season
+acsi [roles schema_camper campsite_type] 2024-03-14T16:54:11Z jordi fita mas # Add relation of ACSI options
+acsi_calendar [roles schema_camper acsi] 2024-03-14T16:59:43Z jordi fita mas # Add relation of dates for ACSI
+acsi_option [roles schema_camper acsi campsite_type_option] 2024-03-14T17:56:59Z jordi fita mas # Add relation of acsi options
+payment__acsi_card [payment] 2024-03-14T18:24:44Z jordi fita mas # Add acsi_card to payment
+ready_payment [ready_payment@v5 payment__acsi_card] 2024-03-14T18:31:26Z jordi fita mas # Remove the acsi_card parameter from ready_payment
+payment_customer__-acsi_card [payment__acsi_card] 2024-03-14T18:43:31Z jordi fita mas # Remove the acsi_card field from payment_customer
+draft_payment [draft_payment@v5 acsi acsi_calendar acsi_option payment__acsi_card payment_customer__-acsi_card] 2024-03-14T18:05:25Z jordi fita mas # Include ACSI in payment drafting computation
diff --git a/test/acsi.sql b/test/acsi.sql
new file mode 100644
index 0000000..e9a94f1
--- /dev/null
+++ b/test/acsi.sql
@@ -0,0 +1,57 @@
+-- Test acsi
+set client_min_messages to warning;
+create extension if not exists pgtap;
+reset client_min_messages;
+
+begin;
+
+select plan(33);
+
+set search_path to camper, public;
+
+select has_table('acsi');
+select has_pk('acsi');
+select table_privs_are('acsi', 'guest', array['SELECT']);
+select table_privs_are('acsi', 'employee', array['SELECT']);
+select table_privs_are('acsi', 'admin', array['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
+select table_privs_are('acsi', 'authenticator', array[]::text[]);
+
+select has_column('acsi', 'campsite_type_id');
+select col_is_pk('acsi', 'campsite_type_id');
+select col_is_fk('acsi', 'campsite_type_id');
+select fk_ok('acsi', 'campsite_type_id', 'campsite_type', 'campsite_type_id');
+select col_type_is('acsi', 'campsite_type_id', 'integer');
+select col_not_null('acsi', 'campsite_type_id');
+select col_hasnt_default('acsi', 'campsite_type_id');
+
+select has_column('acsi', 'number_adults');
+select col_type_is('acsi', 'number_adults', 'positive_integer');
+select col_not_null('acsi', 'number_adults');
+select col_hasnt_default('acsi', 'number_adults');
+
+select has_column('acsi', 'number_teenagers');
+select col_type_is('acsi', 'number_teenagers', 'nonnegative_integer');
+select col_not_null('acsi', 'number_teenagers');
+select col_hasnt_default('acsi', 'number_teenagers');
+
+select has_column('acsi', 'number_children');
+select col_type_is('acsi', 'number_children', 'nonnegative_integer');
+select col_not_null('acsi', 'number_children');
+select col_hasnt_default('acsi', 'number_children');
+
+select has_column('acsi', 'number_dogs');
+select col_type_is('acsi', 'number_dogs', 'nonnegative_integer');
+select col_not_null('acsi', 'number_dogs');
+select col_hasnt_default('acsi', 'number_dogs');
+
+select has_column('acsi', 'cost_per_night');
+select col_type_is('acsi', 'cost_per_night', 'nonnegative_integer');
+select col_not_null('acsi', 'cost_per_night');
+select col_hasnt_default('acsi', 'cost_per_night');
+
+
+select *
+from finish();
+
+rollback;
+
diff --git a/test/acsi_calendar.sql b/test/acsi_calendar.sql
new file mode 100644
index 0000000..59c4b96
--- /dev/null
+++ b/test/acsi_calendar.sql
@@ -0,0 +1,37 @@
+-- Test acsi_calendar
+set client_min_messages to warning;
+create extension if not exists pgtap;
+reset client_min_messages;
+
+begin;
+
+select plan(17);
+
+set search_path to camper, public;
+
+select has_table('acsi_calendar');
+select has_pk('acsi_calendar');
+select col_is_pk('acsi_calendar', array['campsite_type_id', 'acsi_range']);
+select table_privs_are('acsi_calendar', 'guest', array['SELECT']);
+select table_privs_are('acsi_calendar', 'employee', array['SELECT']);
+select table_privs_are('acsi_calendar', 'admin', array['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
+select table_privs_are('acsi_calendar', 'authenticator', array[]::text[]);
+
+select has_column('acsi_calendar', 'campsite_type_id');
+select col_is_fk('acsi_calendar', 'campsite_type_id');
+select fk_ok('acsi_calendar', 'campsite_type_id', 'acsi', 'campsite_type_id');
+select col_type_is('acsi_calendar', 'campsite_type_id', 'integer');
+select col_not_null('acsi_calendar', 'campsite_type_id');
+select col_hasnt_default('acsi_calendar', 'campsite_type_id');
+
+select has_column('acsi_calendar', 'acsi_range');
+select col_type_is('acsi_calendar', 'acsi_range', 'daterange');
+select col_not_null('acsi_calendar', 'acsi_range');
+select col_hasnt_default('acsi_calendar', 'acsi_range');
+
+
+select *
+from finish();
+
+rollback;
+
diff --git a/test/acsi_option.sql b/test/acsi_option.sql
new file mode 100644
index 0000000..52d82d6
--- /dev/null
+++ b/test/acsi_option.sql
@@ -0,0 +1,44 @@
+-- Test acsi_option
+set client_min_messages to warning;
+create extension if not exists pgtap;
+reset client_min_messages;
+
+begin;
+
+select plan(23);
+
+set search_path to camper, public;
+
+select has_table('acsi_option');
+select has_pk('acsi_option');
+select col_is_pk('acsi_option', array['campsite_type_id', 'campsite_type_option_id']);
+select table_privs_are('acsi_option', 'guest', array['SELECT']);
+select table_privs_are('acsi_option', 'employee', array['SELECT']);
+select table_privs_are('acsi_option', 'admin', array['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
+select table_privs_are('acsi_option', 'authenticator', array[]::text[]);
+
+select has_column('acsi_option', 'campsite_type_id');
+select col_is_fk('acsi_option', 'campsite_type_id');
+select fk_ok('acsi_option', 'campsite_type_id', 'acsi', 'campsite_type_id');
+select col_type_is('acsi_option', 'campsite_type_id', 'integer');
+select col_not_null('acsi_option', 'campsite_type_id');
+select col_hasnt_default('acsi_option', 'campsite_type_id');
+
+select has_column('acsi_option', 'campsite_type_option_id');
+select col_is_fk('acsi_option', 'campsite_type_option_id');
+select fk_ok('acsi_option', 'campsite_type_option_id', 'campsite_type_option', 'campsite_type_option_id');
+select col_type_is('acsi_option', 'campsite_type_option_id', 'integer');
+select col_not_null('acsi_option', 'campsite_type_option_id');
+select col_hasnt_default('acsi_option', 'campsite_type_option_id');
+
+select has_column('acsi_option', 'units');
+select col_type_is('acsi_option', 'units', 'positive_integer');
+select col_not_null('acsi_option', 'units');
+select col_hasnt_default('acsi_option', 'units');
+
+
+select *
+from finish();
+
+rollback;
+
diff --git a/test/down_payment.sql b/test/down_payment.sql
index 9a52aa7..b3a6eb7 100644
--- a/test/down_payment.sql
+++ b/test/down_payment.sql
@@ -46,14 +46,14 @@ insert into campsite_type (campsite_type_id, slug, company_id, name, media_id, m
values (12, 'c1b6f4fc-32c1-4cd5-b796-0c5059152a52', 2, 'Plots', 10, 6, '[1, 7]', true)
;
-insert into payment (payment_id, company_id, campsite_type_id, arrival_date, departure_date, subtotal_nights, number_adults, subtotal_adults, number_teenagers, subtotal_teenagers, number_children, subtotal_children, number_dogs, subtotal_dogs, subtotal_tourist_tax, total, currency_code, down_payment_percent, zone_preferences)
-values (22, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EUR', 1.0, '')
- , (23, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EUR', 0.5, '')
- , (24, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2500, 'EUR', 0.75, '')
- , (25, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1234, 'EUR', 0.99, '')
- , (26, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'EUR', 0.5, '')
- , (27, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 987654, 'EUR', 0.33, '')
- , (28, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 987654, 'EUR', 0.19, '')
+insert into payment (payment_id, company_id, campsite_type_id, arrival_date, departure_date, subtotal_nights, number_adults, subtotal_adults, number_teenagers, subtotal_teenagers, number_children, subtotal_children, number_dogs, subtotal_dogs, subtotal_tourist_tax, total, currency_code, down_payment_percent, zone_preferences, acsi_card)
+values (22, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EUR', 1.0, '', false)
+ , (23, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EUR', 0.5, '', false)
+ , (24, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2500, 'EUR', 0.75, '', false)
+ , (25, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1234, 'EUR', 0.99, '', false)
+ , (26, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'EUR', 0.5, '', false)
+ , (27, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 987654, 'EUR', 0.33, '', false)
+ , (28, 2, 12, '2024-08-28', '2024-09-03', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 987654, 'EUR', 0.19, '', false)
;
select bag_eq(
diff --git a/test/draft_payment.sql b/test/draft_payment.sql
index 985d4ea..80b6425 100644
--- a/test/draft_payment.sql
+++ b/test/draft_payment.sql
@@ -5,22 +5,25 @@ reset client_min_messages;
begin;
-select plan(16);
+select plan(17);
set search_path to camper, public;
-select has_function('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]']);
-select function_lang_is('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]'], 'plpgsql');
-select function_returns('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]'], 'payment');
-select isnt_definer('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]']);
-select volatility_is('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]'], 'volatile');
-select function_privs_are('camper', 'draft_payment', array ['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]'], 'guest', array['EXECUTE']);
-select function_privs_are('camper', 'draft_payment', array ['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]'], 'employee', array['EXECUTE']);
-select function_privs_are('camper', 'draft_payment', array ['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]'], 'admin', array['EXECUTE']);
-select function_privs_are('camper', 'draft_payment', array ['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'option_units[]'], 'authenticator', array[]::text[]);
+select has_function('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]']);
+select function_lang_is('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]'], 'plpgsql');
+select function_returns('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]'], 'payment');
+select isnt_definer('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]']);
+select volatility_is('camper', 'draft_payment', array['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]'], 'volatile');
+select function_privs_are('camper', 'draft_payment', array ['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]'], 'guest', array['EXECUTE']);
+select function_privs_are('camper', 'draft_payment', array ['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]'], 'employee', array['EXECUTE']);
+select function_privs_are('camper', 'draft_payment', array ['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]'], 'admin', array['EXECUTE']);
+select function_privs_are('camper', 'draft_payment', array ['uuid', 'date', 'date', 'uuid', 'integer', 'integer', 'integer', 'integer', 'text', 'boolean', 'option_units[]'], 'authenticator', array[]::text[]);
set client_min_messages to warning;
+truncate acsi_option cascade;
+truncate acsi_calendar cascade;
+truncate acsi cascade;
truncate payment_option cascade;
truncate payment cascade;
truncate campsite_type_option_cost cascade;
@@ -95,9 +98,9 @@ values (16, 4, 800)
, (20, 8, 590)
;
-insert into payment (payment_id, slug, company_id, campsite_type_id, arrival_date, departure_date, subtotal_nights, number_adults, subtotal_adults, number_teenagers, subtotal_teenagers, number_children, subtotal_children, number_dogs, subtotal_dogs, subtotal_tourist_tax, total, currency_code, zone_preferences, payment_status, created_at, updated_at)
-values (22, '7cccfe16-695e-486d-a6a5-1162fb85cafb', 2, 12, current_date + 60, current_date + 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'USD', '', 'draft', '2024-01-01 01:01:01', '2024-01-01 01:01:01')
- , (24, '6eeae04c-2fea-4d67-97dc-a4b8a83df99f', 2, 12, current_date + 61, current_date + 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'USD', '', 'pending', '2024-01-01 02:02:02', '2024-01-01 02:02:02')
+insert into payment (payment_id, slug, company_id, campsite_type_id, arrival_date, departure_date, subtotal_nights, number_adults, subtotal_adults, number_teenagers, subtotal_teenagers, number_children, subtotal_children, number_dogs, subtotal_dogs, subtotal_tourist_tax, total, currency_code, zone_preferences, acsi_card, payment_status, created_at, updated_at)
+values (22, '7cccfe16-695e-486d-a6a5-1162fb85cafb', 2, 12, current_date + 60, current_date + 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'USD', '', false, 'draft', '2024-01-01 01:01:01', '2024-01-01 01:01:01')
+ , (24, '6eeae04c-2fea-4d67-97dc-a4b8a83df99f', 2, 12, current_date + 61, current_date + 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'USD', '', false, 'pending', '2024-01-01 02:02:02', '2024-01-01 02:02:02')
;
insert into payment_option (payment_id, campsite_type_option_id, units, subtotal)
@@ -106,31 +109,50 @@ values (22, 16, 1, 0)
, (24, 16, 2, 0)
;
+insert into acsi (campsite_type_id, number_adults, number_teenagers, number_children, number_dogs, cost_per_night)
+values (12, 2, 0, 0, 1, 2300);
+
+insert into acsi_calendar (campsite_type_id, acsi_range)
+values (12, daterange(current_date + 60, current_date + 61))
+ , (12, daterange(current_date + 64, current_date + 65))
+;
+
+insert into acsi_option (campsite_type_id, campsite_type_option_id, units)
+values (12, 16, 1)
+ , (12, 18, 1)
+;
+
select lives_ok(
- $$ select draft_payment(null, current_date + 59, current_date + 64, 'b065f4e3-2cc8-491d-a413-d015d7d00183', 1, 2, 3, 0, null, null) $$,
+ $$ select draft_payment(null, current_date + 59, current_date + 64, 'b065f4e3-2cc8-491d-a413-d015d7d00183', 1, 2, 3, 0, null, true, null) $$,
'Should be able to create a new draft for Bungalows'
);
select lives_ok(
- $$ select draft_payment(null, current_date + 6, current_date + 11, 'b065f4e3-2cc8-491d-a413-d015d7d00183', 1, 2, 3, 0, null, null) $$,
+ $$ select draft_payment(null, current_date + 6, current_date + 11, 'b065f4e3-2cc8-491d-a413-d015d7d00183', 1, 2, 3, 0, null, true, null) $$,
'A payment for a reservation in less than a week has a 100 % of downpayment'
);
select lives_ok(
- $$ select draft_payment(null, current_date + 10, current_date + 58, 'b065f4e3-2cc8-491d-a413-d015d7d00183', 2, 3, 4, 0, null, null) $$,
+ $$ select draft_payment(null, current_date + 10, current_date + 58, 'b065f4e3-2cc8-491d-a413-d015d7d00183', 2, 3, 4, 0, null, true, null) $$,
'All reservations incur a tourist tax for the first tourist_tax_max_days days'
);
select lives_ok(
- $$ select draft_payment('7cccfe16-695e-486d-a6a5-1162fb85cafb', current_date + 58, current_date + 65, 'c1b6f4fc-32c1-4cd5-b796-0c5059152a52', 2, 4, 6, 3, 'pref I before E', array[(16, 2), (20, 3)]::option_units[]) $$,
+ $$ select draft_payment('7cccfe16-695e-486d-a6a5-1162fb85cafb', current_date + 58, current_date + 65, 'c1b6f4fc-32c1-4cd5-b796-0c5059152a52', 2, 4, 6, 3, 'pref I before E', false, array[(16, 2), (20, 3)]::option_units[]) $$,
'Should be able to update the draft for Plots'
);
select results_ne(
- $$ select slug::text from draft_payment('6eeae04c-2fea-4d67-97dc-a4b8a83df99f', current_date + 31, current_date + 36, 'b065f4e3-2cc8-491d-a413-d015d7d00183', 2, 1, 1, 1, 'under a tree', array[(16, 1), (18, 1)]::option_units[]) $$,
+ $$ select slug::text from draft_payment('6eeae04c-2fea-4d67-97dc-a4b8a83df99f', current_date + 31, current_date + 36, 'b065f4e3-2cc8-491d-a413-d015d7d00183', 2, 1, 1, 1, 'under a tree', true, array[(16, 1), (18, 1)]::option_units[]) $$,
$$ values ('6eeae04c-2fea-4d67-97dc-a4b8a83df99f') $$,
'When trying to draft a payment already pending, completed, failed, or refunded, create a new instead'
);
+select lives_ok(
+ $$ select draft_payment(null, current_date + 58, current_date + 65, 'c1b6f4fc-32c1-4cd5-b796-0c5059152a52', 3, 1, 1, 1, '', true, array[(16, 2), (18, 3), (20, 4)]::option_units[]) $$,
+ 'Should be able to draft a payment for plots with ACSI discount during the days that is valid'
+);
+
+
select bag_eq(
$$ select company_id, campsite_type_id, arrival_date, departure_date, subtotal_nights, number_adults, subtotal_adults, number_teenagers, subtotal_teenagers, number_children, subtotal_children, number_dogs, subtotal_dogs, subtotal_tourist_tax, total, currency_code, down_payment_percent, zone_preferences, payment_status, created_at, updated_at from payment $$,
$$ values (2, 12, current_date + 58, current_date + 65, 3200, 2, 10420, 4, 20840, 6, 25080, 3, 2450, 4900, 79160, 'EUR', 0.3, 'pref I before E', 'draft', '2024-01-01 01:01:01', current_timestamp)
@@ -139,6 +161,7 @@ select bag_eq(
, (2, 14, current_date + 6, current_date + 11, 85000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 86750, 'EUR', 1.0, '', 'draft', current_timestamp, current_timestamp)
, (2, 12, current_date + 61, current_date + 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'USD', 1.0, '', 'pending', '2024-01-01 02:02:02', '2024-01-01 02:02:02')
, (2, 14, current_date + 31, current_date + 36, 85000, 2, 0, 1, 0, 1, 0, 1, 0, 3500, 96000, 'EUR', 0.3, 'under a tree', 'draft', current_timestamp, current_timestamp)
+ , (2, 12, current_date + 58, current_date + 65, 6000, 3, 12830, 1, 5210, 1, 4180, 1, 1750, 7350, 61130, 'EUR', 0.3, '', 'draft', current_timestamp, current_timestamp)
$$,
'Should have added and updated payments'
);
@@ -146,10 +169,13 @@ select bag_eq(
select bag_eq(
$$ select case payment_id when 22 then 'a' when 24 then 'b' else 'c' end, campsite_type_option_id, units, subtotal from payment_option $$,
$$ values ('a', 16, 2, 10200)
- , ('a', 20, 3, 2070)
- , ('b', 16, 2, 0)
- , ('c', 16, 1, 4000)
- , ('c', 18, 1, 3500)
+ , ('a', 20, 3, 2070)
+ , ('b', 16, 2, 0)
+ , ('c', 16, 1, 4000)
+ , ('c', 18, 1, 3500)
+ , ('c', 16, 2, 8860)
+ , ('c', 18, 3, 12190)
+ , ('c', 20, 4, 2760)
$$,
'Should have added, updated, and removed payment options'
);
diff --git a/test/flush_payments.sql b/test/flush_payments.sql
index 0c4cfe6..68de022 100644
--- a/test/flush_payments.sql
+++ b/test/flush_payments.sql
@@ -51,16 +51,16 @@ insert into campsite_type_option (campsite_type_option_id, campsite_type_id, nam
values (16, 12, 'Big tent', '[0, 4)', true)
;
-insert into payment (payment_id, company_id, campsite_type_id, arrival_date, departure_date, subtotal_nights, number_adults, subtotal_adults, number_teenagers, subtotal_teenagers, number_children, subtotal_children, number_dogs, subtotal_dogs, subtotal_tourist_tax, total, currency_code, zone_preferences, payment_status, created_at, updated_at)
-values (22, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'draft', '2024-01-01 01:01:01', current_timestamp - interval '1 day, -1 second')
- , (24, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'draft', '2024-01-01 01:01:01', current_timestamp - interval '1 day, 1 second')
- , (26, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'pending', '2024-01-02 02:02:02', current_timestamp - interval '1 hour, -1 second')
- , (28, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'pending', '2024-01-03 03:03:03', current_timestamp - interval '1 hour, 1 second')
- , (30, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'preauth', '2024-01-04 04:04:04', current_timestamp - interval '2 days')
- , (32, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'failed', '2024-01-05 05:05:05', current_timestamp - interval '2 days')
- , (34, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'completed', '2024-01-05 05:05:05', current_timestamp - interval '2 days')
- , (36, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'refunded', '2024-01-05 05:05:05', current_timestamp - interval '2 days')
- , (38, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', 'voided', '2024-01-05 05:05:05', current_timestamp - interval '2 days')
+insert into payment (payment_id, company_id, campsite_type_id, arrival_date, departure_date, subtotal_nights, number_adults, subtotal_adults, number_teenagers, subtotal_teenagers, number_children, subtotal_children, number_dogs, subtotal_dogs, subtotal_tourist_tax, total, currency_code, zone_preferences, acsi_card, payment_status, created_at, updated_at)
+values (22, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'draft', '2024-01-01 01:01:01', current_timestamp - interval '1 day, -1 second')
+ , (24, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'draft', '2024-01-01 01:01:01', current_timestamp - interval '1 day, 1 second')
+ , (26, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'pending', '2024-01-02 02:02:02', current_timestamp - interval '1 hour, -1 second')
+ , (28, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'pending', '2024-01-03 03:03:03', current_timestamp - interval '1 hour, 1 second')
+ , (30, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'preauth', '2024-01-04 04:04:04', current_timestamp - interval '2 days')
+ , (32, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'failed', '2024-01-05 05:05:05', current_timestamp - interval '2 days')
+ , (34, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'completed', '2024-01-05 05:05:05', current_timestamp - interval '2 days')
+ , (36, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'refunded', '2024-01-05 05:05:05', current_timestamp - interval '2 days')
+ , (38, 2, 12, '2024-08-29', '2024-09-03', 71000, 1, 0, 2, 0, 3, 0, 0, 0, 1750, 72750, 'EUR', '', false, 'voided', '2024-01-05 05:05:05', current_timestamp - interval '2 days')
;
insert into payment_option (payment_id, campsite_type_option_id, units, subtotal)
diff --git a/test/payment.sql b/test/payment.sql
index 8bbffd1..d381d78 100644
--- a/test/payment.sql
+++ b/test/payment.sql
@@ -5,7 +5,7 @@ reset client_min_messages;
begin;
-select plan(114);
+select plan(118);
set search_path to camper, public;
@@ -126,6 +126,11 @@ select col_type_is('payment', 'zone_preferences', 'text');
select col_not_null('payment', 'zone_preferences');
select col_hasnt_default('payment', 'zone_preferences');
+select has_column('payment', 'acsi_card');
+select col_type_is('payment', 'acsi_card', 'boolean');
+select col_not_null('payment', 'acsi_card');
+select col_hasnt_default('payment', 'acsi_card');
+
select has_column('payment', 'payment_status');
select col_is_fk('payment', 'payment_status');
select fk_ok('payment', 'payment_status', 'payment_status', 'payment_status');
@@ -173,7 +178,7 @@ values (10, 1, 2, 'Type A', '
{{- if lt .DownPaymentPercent 100 -}}
{{ printf (gettext "By down paying the %d %% of the total, you are pre-booking your preferences. We will respond within 24 hours and this percentage will be charged if accepted.") .DownPaymentPercent }}
@@ -266,6 +263,13 @@
{{ ( printf ( gettext "See <%s>our conditions%s> for more information.") (printf "a target=\"_blank\" href=\"/%s/%s\"" currentLocale "legal/reservation") "a") | raw }}