Skip to content

Commit 5e3f5ce

Browse files
authored
Pillin/paid transaction (#327)
1 parent 856e5a5 commit 5e3f5ce

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/integration_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
file-coverage-mode: "changes"
5858

5959
- name: Archive production artifacts
60-
uses: actions/upload-artifact@v3
60+
uses: actions/upload-artifact@v4
6161
with:
6262
name: dist-without-markdown
6363
path: |

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,6 @@
111111
"stripe": "^14.2.0",
112112
"worker-auth-providers": "^0.0.13-beta.4",
113113
"zod": "^3.21.4"
114-
}
114+
},
115+
"packageManager": "pnpm@10.9.0+sha512.0486e394640d3c1fb3c9d43d49cf92879ff74f8516959c235308f5a8f62e2e19528a65cdc2a3058f587cde71eba3d5b56327c8c33a97e4c4051ca48a10ca2d5f"
115116
}

src/datasources/db/paymentLogs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ export const paymentLogsSchema = pgTable(
3030
withTimezone: true,
3131
}),
3232
currencyId: text("currency_id").notNull(),
33-
originalResponseBlob: jsonb("original_response_blob").notNull(),
33+
originalResponseBlob: jsonb("original_response_blob").default({
34+
payment_status: "pending",
35+
status: "pending",
36+
}),
3437
...createdAndUpdatedAtFields,
3538
},
3639
(t) => ({

src/schema/money/queries.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import {
1010
PaymentLogRef,
1111
} from "~/schema/shared/refs";
1212

13+
type PaymentResponseBlob = {
14+
payment_status?: string;
15+
status?: string;
16+
};
17+
1318
const SearchPaymentLogsInput = builder.inputType("SearchPaymentLogsInput", {
1419
fields: (t) => ({
1520
startDate: t.field({
@@ -89,7 +94,12 @@ builder.queryFields((t) => ({
8994

9095
paymentLogs.forEach((p) => {
9196
const key = `${p.platform}-${p.currencyId}`;
92-
const isPaid = p.originalResponseBlob.payment_status === "paid" || p.originalResponseBlob.status === "approved";
97+
const blob = p.originalResponseBlob as
98+
| PaymentResponseBlob
99+
| null
100+
| undefined;
101+
const isPaid =
102+
blob?.payment_status === "paid" || blob?.status === "approved";
93103

94104
if (!consolidatedPayments[key] || !isPaid) {
95105
consolidatedPayments[key] = {

0 commit comments

Comments
 (0)