createOrderSchema (validators/payment-gateway.validator.ts)

openvyapar · packages/backend/src/validators/payment-gateway.validator.ts · typescript · Apache-2.0
payments

Zod schemas for validating payment gateway order creation, manual verification, and webhook payloads.

// Source: https://github.com/vijayg10/openvyapar | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from 'zod';

export const createOrderSchema = z.object({
  sale_id: z.string().uuid(),
  amount: z.number().positive(),
});

export const manualVerifySchema = z.object({
  reference_number: z.string().min(1, 'Reference number is required'),
  notes: z.string().optional(),
});

export const webhookPayloadSchema = z.object({
  event: z.string(),
  payload: z.object({
    payment: z.object({
      entity: z.object({
        id: z.string(),
        order_id: z.string(),
        status: z.string(),
        amount: z.number(),
      }),
    }),
  }),
});

export type CreateOrde

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key