Skip to content

Commit 2059ca2

Browse files
committed
min side: migrate to new recurring api endpoint
1 parent 514a6c0 commit 2059ca2

4 files changed

Lines changed: 7 additions & 24 deletions

File tree

app/donors/[id]/recurring/autogiro/route.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

app/donors/[id]/recurring/avtalegiro/route.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,17 @@ export async function GET(req: Request) {
2525
return Response.json({
2626
status: 200,
2727
content: donations.map((d) => ({
28-
ID: d.id,
29-
status: d.cancelled ? "STOPPED" : "ACTIVE",
30-
donorID: 0,
31-
full_name: null,
32-
KID: d.id,
33-
timestamp_created: d.created_at.toISOString(),
34-
monthly_charge_day: d.monthly_charge_day,
35-
force_charge_date: null,
36-
paused_until_date: null,
28+
id: d.id,
29+
kid: d.gateway_metadata?.bank_msg ?? d.id,
30+
cancelled: d.cancelled,
31+
createdAt: d.created_at.toISOString(),
32+
chargeDay: d.monthly_charge_day,
3733
amount: d.amount,
38-
agreement_url_code: null,
3934
method: d.method,
4035
})),
4136
});
4237
} catch (e) {
43-
logError("donors/[id]/recurring/vipps: ", e);
38+
logError("donors/[id]/recurring: ", e);
4439
return Response.json({ message: "Something went wrong" }, { status: 500 });
4540
} finally {
4641
dbRelease(db);

src/donation/repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ export async function getRecurringDonationsByEmail(
642642
`
643643
select
644644
d.*,
645-
coalesce(extract(day from c.created_at)::int, 0) as monthly_charge_day
645+
extract(day from c.created_at)::int as monthly_charge_day
646646
from donation d
647647
join donor p on p.id = d.donor_id
648648
left join lateral (

0 commit comments

Comments
 (0)