Kijan pou m estoke tranzaksyon MonCash ak NatCash yo nan baz done a?
poze 3 months ago627 gadeht
7
Mwen vle kenbe istwa tout peman yo pou kontablite ak pou lè kliyan gen plent. Ki estrikti tab ou konseye pou plizyè founisè?
Dyagnostik IA
Se IA ki fè l. Se pa yon repons — kominote a anba a konfime oswa korije l. Toujou verifye anvan ou fye l.
poze 3 months ago
James Étienne 2.3k
1 Repons
3
✓✓ Repons yo aksepte
Yon estrikti ki mache byen: kòmand → tantativ peman → evènman.
CREATE TABLE payment_attempts (
id text PRIMARY KEY, -- ID ou voye bay founisè a (inik)
order_id text NOT NULL REFERENCES orders(id),
provider text NOT NULL CHECK (provider IN ('MONCASH','NATCASH','MANUAL')),
amount_htg_cents bigint NOT NULL CHECK (amount_htg_cents > 0),
status text NOT NULL DEFAULT 'PENDING', -- PENDING | SUCCEEDED | FAILED | EXPIRED
provider_reference text, -- transactionId founisè a
paid_at timestamptz,
created_at timestamptz NOT NULL DEFAULT now(),
UNIQUE (provider, provider_reference) -- yon tranzaksyon = yon sèl peman
);
CREATE TABLE payment_events (
id bigserial PRIMARY KEY,
attempt_id text NOT NULL REFERENCES payment_attempts(id),
kind text NOT NULL, -- created | redirected | callback | status_checked | paid | expired
payload jsonb, -- repons founisè a (san done sansib)
created_at timestamptz NOT NULL DEFAULT now()
);
Poukisa se konsa:
payment_attemptsbay estati aktyèl la vit (pou afiche, pou rapò).payment_eventsse istwa konplè a: lè yon kliyan di "mwen te peye", ou wè chak etap ak repons founisè a.UNIQUE (provider, provider_reference)anpeche menm tranzaksyon an sèvi de fwa.- Montan yo an santim antye (
bigint), pafloat.
Sa pou w pa estoke: PIN, kòd OTP, oswa kle API. Pou nimewo telefòn moun ki peye a, kenbe l sèlman si w bezwen l, epi limite ki moun ki ka wè l.
Konekte pou di lòt moun si li te mache.
answered 3 months ago
Jean Pierre 5.1k
Sign in and verify your email to post an answer.