Skip to content

Commit b4f7355

Browse files
committed
add node id to create checkout
1 parent 71048a8 commit b4f7355

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/contracts/checkout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { z } from "zod";
33
import { CheckoutSchema } from "../schemas/checkout";
44

55
export const CreateCheckoutInputSchema = z.object({
6+
nodeId: z.string(),
67
amount: z.number().optional(),
78
currency: z.string().optional(),
89
products: z.array(z.string()).optional(),

tests/contracts/checkout.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ describe('Checkout Contracts', () => {
4747

4848
describe('CreateCheckoutInputSchema', () => {
4949
test('should validate minimal create checkout input', () => {
50-
const input = {};
50+
const input = {
51+
nodeId: 'node_123',
52+
};
5153
const result = CreateCheckoutInputSchema.safeParse(input);
5254
expect(result.success).toBe(true);
5355
});
5456

5557
test('should validate create checkout input with all fields', () => {
5658
const input = {
59+
nodeId: 'node_123',
5760
amount: 1000,
5861
currency: 'USD',
5962
products: ['product_1', 'product_2'],
@@ -112,6 +115,7 @@ describe('Checkout Contracts', () => {
112115

113116
test('should validate IPv4 address', () => {
114117
const input = {
118+
nodeId: 'node_123',
115119
customerIpAddress: '192.168.1.1',
116120
};
117121

@@ -121,6 +125,7 @@ describe('Checkout Contracts', () => {
121125

122126
test('should validate IPv6 address', () => {
123127
const input = {
128+
nodeId: 'node_123',
124129
customerIpAddress: '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
125130
};
126131

@@ -325,6 +330,7 @@ describe('Checkout Contracts', () => {
325330
test('should have consistent types between input schemas and exported types', () => {
326331
// This test ensures that the exported types match the actual schemas
327332
const createInput = {
333+
nodeId: 'node_123',
328334
amount: 1000,
329335
currency: 'USD',
330336
customerEmail: 'test@example.com',

tests/index.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ describe('API Contract Index', () => {
119119
test('should be able to use exported types', () => {
120120
// This test ensures that the types are properly exported and can be used
121121
const createCheckout: CreateCheckout = {
122+
nodeId: 'node_123',
122123
amount: 1000,
123124
currency: 'USD',
124125
customerEmail: 'test@example.com',
@@ -159,6 +160,7 @@ describe('API Contract Index', () => {
159160

160161
// 1. Create valid input objects
161162
const createInput: CreateCheckout = {
163+
nodeId: 'node_123',
162164
amount: 1000,
163165
currency: 'USD',
164166
products: ['product_1'],

0 commit comments

Comments
 (0)