Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
file-coverage-mode: "changes"

- name: Archive production artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist-without-markdown
path: |
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,6 @@
"stripe": "^14.2.0",
"worker-auth-providers": "^0.0.13-beta.4",
"zod": "^3.21.4"
}
},
"packageManager": "pnpm@10.9.0+sha512.0486e394640d3c1fb3c9d43d49cf92879ff74f8516959c235308f5a8f62e2e19528a65cdc2a3058f587cde71eba3d5b56327c8c33a97e4c4051ca48a10ca2d5f"
}
5 changes: 4 additions & 1 deletion src/datasources/db/paymentLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export const paymentLogsSchema = pgTable(
withTimezone: true,
}),
currencyId: text("currency_id").notNull(),
originalResponseBlob: jsonb("original_response_blob").notNull(),
originalResponseBlob: jsonb("original_response_blob").default({
payment_status: "pending",
status: "pending",
}),
...createdAndUpdatedAtFields,
},
(t) => ({
Expand Down
12 changes: 11 additions & 1 deletion src/schema/money/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import {
PaymentLogRef,
} from "~/schema/shared/refs";

type PaymentResponseBlob = {
payment_status?: string;
status?: string;
};

const SearchPaymentLogsInput = builder.inputType("SearchPaymentLogsInput", {
fields: (t) => ({
startDate: t.field({
Expand Down Expand Up @@ -89,7 +94,12 @@ builder.queryFields((t) => ({

paymentLogs.forEach((p) => {
const key = `${p.platform}-${p.currencyId}`;
const isPaid = p.originalResponseBlob.payment_status === "paid" || p.originalResponseBlob.status === "approved";
const blob = p.originalResponseBlob as
| PaymentResponseBlob
| null
| undefined;
const isPaid =
blob?.payment_status === "paid" || blob?.status === "approved";

if (!consolidatedPayments[key] || !isPaid) {
consolidatedPayments[key] = {
Expand Down
Loading