feat: add telegram group pricing and direct payments
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
-- Direct/manual transfer checkout support.
|
||||
-- Run once in Supabase SQL editor before enabling payment_mode=direct in production.
|
||||
|
||||
alter table public.payment_transactions
|
||||
alter column from_address drop not null;
|
||||
|
||||
alter table public.payment_transactions
|
||||
add column if not exists payment_method text not null default 'wallet';
|
||||
|
||||
do $$
|
||||
begin
|
||||
alter table public.payment_intents
|
||||
drop constraint if exists payment_intents_payment_mode_check;
|
||||
alter table public.payment_intents
|
||||
add constraint payment_intents_payment_mode_check
|
||||
check (payment_mode in ('strict', 'flex', 'direct'));
|
||||
|
||||
alter table public.payment_transactions
|
||||
drop constraint if exists payment_transactions_status_check;
|
||||
alter table public.payment_transactions
|
||||
add constraint payment_transactions_status_check
|
||||
check (status in ('submitted', 'confirmed', 'failed', 'duplicate', 'refund_required'));
|
||||
|
||||
alter table public.payment_transactions
|
||||
drop constraint if exists payment_transactions_payment_method_check;
|
||||
alter table public.payment_transactions
|
||||
add constraint payment_transactions_payment_method_check
|
||||
check (payment_method in ('wallet', 'manual', 'direct'));
|
||||
end $$;
|
||||
@@ -91,7 +91,7 @@ create table if not exists public.payment_intents (
|
||||
token_address text not null,
|
||||
receiver_address text not null,
|
||||
amount_units numeric(78,0) not null,
|
||||
payment_mode text not null default 'strict' check (payment_mode in ('strict', 'flex')),
|
||||
payment_mode text not null default 'strict' check (payment_mode in ('strict', 'flex', 'direct')),
|
||||
allowed_wallet text,
|
||||
order_id_hex text not null unique,
|
||||
status text not null default 'created' check (status in ('created', 'submitted', 'confirmed', 'expired', 'failed', 'cancelled')),
|
||||
@@ -114,10 +114,11 @@ create table if not exists public.payment_transactions (
|
||||
intent_id uuid not null references public.payment_intents(id) on delete cascade,
|
||||
tx_hash text not null unique,
|
||||
chain_id integer not null default 137,
|
||||
from_address text not null,
|
||||
from_address text,
|
||||
to_address text not null,
|
||||
block_number bigint,
|
||||
status text not null default 'submitted' check (status in ('submitted', 'confirmed', 'failed')),
|
||||
payment_method text not null default 'wallet' check (payment_method in ('wallet', 'manual', 'direct')),
|
||||
status text not null default 'submitted' check (status in ('submitted', 'confirmed', 'failed', 'duplicate', 'refund_required')),
|
||||
raw_receipt jsonb not null default '{}'::jsonb,
|
||||
raw_tx jsonb not null default '{}'::jsonb,
|
||||
created_at timestamptz not null default now(),
|
||||
|
||||
Reference in New Issue
Block a user