Payment status checks for notifications that never arrive

- src/payments/status.js: open checkouts, checkCheckouts and the
  payment-status job (every 15 min, checkouts 10 min - 3 days old). Found
  payments are settled exactly as their webhook would be (settlePayment,
  extracted from the webhook handler: amount check, record, emails).
- PayFast: signed API client (alphabetical signature, testing=true in
  sandbox), findPayments from the transaction history CSV matched on
  M Payment ID, and testConnection (signed /ping). Verified against a
  real sandbox account.
- Yoco documents no checkout lookup, so its checkouts are "can't check".
- Payments -> Reconcile: "Waiting for payment" with Check status /
  Check all; PayFast card: Test connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 15:28:28 +02:00
co-authored by Claude Opus 5.5
parent 67730d3eb0
commit 2064ba2e42
22 changed files with 654 additions and 38 deletions
+9
View File
@@ -43,6 +43,15 @@ test.describe("PayFast", () => {
await page.waitForURL(/sandbox\.payfast\.co\.za/, { timeout: 30_000 });
await expect(page.locator("body")).not.toContainText(/signature/i);
await expect(page.locator("body")).toContainText(/150[.,]00/);
// Not paid at PayFast: the status check asks PayFast's API (signed) and says so
await loginAs(page, "supervisor");
await page.goto("/dashboard/supervisor/payments");
await page.getByText("Reconcile", { exact: true }).click();
const row = page.getByRole("row").filter({ hasText: "PayFast" }).filter({ hasText: "R 150.00" }).first();
await row.getByRole("button", { name: "Check status" }).click();
await expect(row.getByText("Not paid (yet)")).toBeVisible({ timeout: 30_000 });
await expect(page.getByText("No new payments found.")).toBeVisible();
} finally {
await api(page, "admin", "PUT", "/api/payments/providers/settings", { providers: [{ id: "yoco", enabled: true }, { id: "payfast", enabled: false }] });
await api(page, "admin", "PUT", "/api/payfast/config", { merchantId: "", merchantKey: "", passphrase: "" });