mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 17:24:48 +00:00
fix(coinpay): settle paid Hire Us checkouts from the signed webhook
The CoinPay webhook only logged. It now verifies X-CoinPay-Signature (t=,v1= over t.rawBody), reads the nested payload (data.payment_id, not the top-level event id), and records a confirmed/forwarded Hire Us payment once in hire_us_payments (payment_id primary key), mapped to the buyer via metadata.account_id/email. Unknown or pending payments are a 200 no-op. Hire Us checkout now sends property, account_id (CoinPay session) and email in metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7171c2cdeb
commit
a5db866624
7 changed files with 292 additions and 16 deletions
|
|
@ -199,6 +199,8 @@ describe("POST /api/hire-us/coinpay-checkout", () => {
|
|||
hours: 10,
|
||||
rate_usd_per_hour: 400,
|
||||
source: "logicsrc.com/hire-us",
|
||||
property: "logicsrc.com",
|
||||
email: "buyer@example.com",
|
||||
buyer_email: "buyer@example.com"
|
||||
}
|
||||
});
|
||||
|
|
@ -556,6 +558,7 @@ describe("POST /api/webhooks/coinpay", () => {
|
|||
const body = await response.json();
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(body).toEqual({ received: true, complete: true, payment_id: "pay_123" });
|
||||
// No Hire Us metadata: acknowledged as a handled no-op, nothing recorded.
|
||||
expect(body).toEqual({ received: true, handled: true, settled: false, reason: "unknown payment", payment_id: "pay_123" });
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue