Update billing system to support single and recurring payments

This update modifies the billing system to properly handle both single and recurring payment plans. Logic is introduced to determine whether the selected plan is recurring or a one-time payment and adjust the interface accordingly. The naming of some components and variables has been changed to more accurately reflect their purpose. Additionally, a
This commit is contained in:
giancarlo
2024-04-01 20:58:26 +08:00
parent 6b72206b00
commit 84a4b45bcd
22 changed files with 291 additions and 119 deletions

View File

@@ -1249,7 +1249,7 @@ select
create or replace function public.upsert_order(
target_account_id uuid,
target_customer_id varchar(255),
order_id text,
target_order_id text,
status public.payment_status,
billing_provider public.billing_provider,
total_amount numeric,
@@ -1261,7 +1261,7 @@ declare
new_billing_customer_id int;
begin
insert into public.billing_customers(account_id, provider, customer_id)
values (target_account_id, target_billing_provider, target_customer_id)
values (target_account_id, billing_provider, target_customer_id)
on conflict (account_id, provider, customer_id) do update
set provider = excluded.provider
returning id into new_billing_customer_id;
@@ -1277,7 +1277,7 @@ begin
values (
target_account_id,
new_billing_customer_id,
order_id,
target_order_id,
status,
billing_provider,
total_amount,