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
1 change: 1 addition & 0 deletions src/contracts/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const PaymentReceivedInputSchema = z.object({
z.object({
paymentHash: z.string(),
amountSats: z.number(),
sandbox: z.boolean().default(false),
}),
),
});
Expand Down
16 changes: 15 additions & 1 deletion tests/contracts/checkout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,20 @@ describe('Checkout Contracts', () => {
expect(result.success).toBe(true);
});

test('should allow sandbox flag on payment', () => {
const input = {
payments: [{
paymentHash: 'hash-sandbox',
amountSats: 1500,
sandbox: true,
}],
};

const result = PaymentReceivedInputSchema.safeParse(input);
expect(result.success).toBe(true);
expect(result.success && result.data.payments[0]?.sandbox).toBe(true);
});

test('should reject without paymentHash', () => {
const input = {
amountSats: 1500,
Expand Down Expand Up @@ -364,4 +378,4 @@ describe('Checkout Contracts', () => {
expect(PaymentReceivedInputSchema.safeParse(paymentInput).success).toBe(true);
});
});
});
});