Skip to content

Commit e1b683f

Browse files
add sandbox flag to PaymentReceivedInputSchema
1 parent 83acea1 commit e1b683f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/contracts/checkout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const PaymentReceivedInputSchema = z.object({
5757
z.object({
5858
paymentHash: z.string(),
5959
amountSats: z.number(),
60+
sandbox: z.boolean().default(false),
6061
}),
6162
),
6263
});

tests/contracts/checkout.test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,20 @@ describe('Checkout Contracts', () => {
270270
expect(result.success).toBe(true);
271271
});
272272

273+
test('should allow sandbox flag on payment', () => {
274+
const input = {
275+
payments: [{
276+
paymentHash: 'hash-sandbox',
277+
amountSats: 1500,
278+
sandbox: true,
279+
}],
280+
};
281+
282+
const result = PaymentReceivedInputSchema.safeParse(input);
283+
expect(result.success).toBe(true);
284+
expect(result.success && result.data.payments[0]?.sandbox).toBe(true);
285+
});
286+
273287
test('should reject without paymentHash', () => {
274288
const input = {
275289
amountSats: 1500,
@@ -364,4 +378,4 @@ describe('Checkout Contracts', () => {
364378
expect(PaymentReceivedInputSchema.safeParse(paymentInput).success).toBe(true);
365379
});
366380
});
367-
});
381+
});

0 commit comments

Comments
 (0)