chargebee
Version:
A library for integrating with Chargebee.
105 lines (104 loc) • 4.9 kB
JavaScript
"use strict";
// Generated Zod schemas: LedgerOperation
// Actions: listLedgerOperations, capture, authorize, captureAuthorization, releaseAuthorization
// Do not edit manually – regenerate via sdk-generator
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReleaseAuthorizationLedgerOperationBodySchema = exports.CaptureAuthorizationLedgerOperationBodySchema = exports.AuthorizeLedgerOperationBodySchema = exports.CaptureLedgerOperationBodySchema = exports.ListLedgerOperationsLedgerOperationBodySchema = void 0;
const zod_1 = require("zod");
//LedgerOperation.listLedgerOperations
const ListLedgerOperationsLedgerOperationSubscriptionIdSchema = zod_1.z.object({
is: zod_1.z.string().min(1).optional(),
});
const ListLedgerOperationsLedgerOperationUnitIdSchema = zod_1.z.object({
is: zod_1.z.string().min(1).optional(),
});
const ListLedgerOperationsLedgerOperationCreatedAtSchema = zod_1.z.object({
after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
});
const ListLedgerOperationsLedgerOperationTypeSchema = zod_1.z.object({
is: zod_1.z
.enum([
'allocation',
'capture',
'authorize',
'release_authorization',
'capture_authorization',
'expiry',
'void',
'rollover',
'adjustment',
])
.optional(),
in: zod_1.z
.enum([
'allocation',
'capture',
'authorize',
'release_authorization',
'capture_authorization',
'expiry',
'void',
'rollover',
'adjustment',
])
.optional(),
});
const ListLedgerOperationsLedgerOperationSortBySchema = zod_1.z.looseObject({
asc: zod_1.z.enum(['created_at']).optional(),
desc: zod_1.z.enum(['created_at']).optional(),
});
const ListLedgerOperationsLedgerOperationBodySchema = zod_1.z.looseObject({
limit: zod_1.z.number().int().min(1).max(100).optional(),
offset: zod_1.z.string().max(1000).optional(),
subscription_id: ListLedgerOperationsLedgerOperationSubscriptionIdSchema,
unit_id: ListLedgerOperationsLedgerOperationUnitIdSchema.optional(),
created_at: ListLedgerOperationsLedgerOperationCreatedAtSchema.optional(),
type: ListLedgerOperationsLedgerOperationTypeSchema.optional(),
sort_by: ListLedgerOperationsLedgerOperationSortBySchema.optional(),
});
exports.ListLedgerOperationsLedgerOperationBodySchema = ListLedgerOperationsLedgerOperationBodySchema;
//LedgerOperation.capture
const CaptureLedgerOperationMetadataSchema = zod_1.z.looseObject({});
const CaptureLedgerOperationBodySchema = zod_1.z.looseObject({
id: zod_1.z.string().max(50).optional(),
subscription_id: zod_1.z.string().max(50),
unit_id: zod_1.z.string().max(50),
amount: zod_1.z.string().max(36),
ledger_operation_timestamp: zod_1.z.number().int(),
metadata: CaptureLedgerOperationMetadataSchema.optional(),
});
exports.CaptureLedgerOperationBodySchema = CaptureLedgerOperationBodySchema;
//LedgerOperation.authorize
const AuthorizeLedgerOperationMetadataSchema = zod_1.z.looseObject({});
const AuthorizeLedgerOperationBodySchema = zod_1.z.looseObject({
id: zod_1.z.string().max(50).optional(),
subscription_id: zod_1.z.string().max(50),
unit_id: zod_1.z.string().max(50),
amount: zod_1.z.string().max(36),
ledger_operation_timestamp: zod_1.z.number().int(),
auto_release_timestamp: zod_1.z.number().int().optional(),
metadata: AuthorizeLedgerOperationMetadataSchema.optional(),
});
exports.AuthorizeLedgerOperationBodySchema = AuthorizeLedgerOperationBodySchema;
//LedgerOperation.captureAuthorization
const CaptureAuthorizationLedgerOperationMetadataSchema = zod_1.z.looseObject({});
const CaptureAuthorizationLedgerOperationBodySchema = zod_1.z.looseObject({
authorization_id: zod_1.z.string().max(50),
id: zod_1.z.string().max(50).optional(),
amount: zod_1.z.string().max(36),
ledger_operation_timestamp: zod_1.z.number().int(),
metadata: CaptureAuthorizationLedgerOperationMetadataSchema.optional(),
});
exports.CaptureAuthorizationLedgerOperationBodySchema = CaptureAuthorizationLedgerOperationBodySchema;
//LedgerOperation.releaseAuthorization
const ReleaseAuthorizationLedgerOperationMetadataSchema = zod_1.z.looseObject({});
const ReleaseAuthorizationLedgerOperationBodySchema = zod_1.z.looseObject({
authorization_id: zod_1.z.string().max(50),
id: zod_1.z.string().max(50).optional(),
ledger_operation_timestamp: zod_1.z.number().int(),
metadata: ReleaseAuthorizationLedgerOperationMetadataSchema.optional(),
});
exports.ReleaseAuthorizationLedgerOperationBodySchema = ReleaseAuthorizationLedgerOperationBodySchema;