@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
92 lines • 4.33 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidateResponseSchema = exports.ValidateParamsSchema = exports.SurchargeResponseSchema = exports.SurchargeDataSchema = exports.SurchargeParamsSchema = exports.CardInfoResponseSchema = exports.CardInfoDataSchema = exports.CardInfoParamsSchema = exports.BillingUpdateResponseSchema = exports.BillingUpdateParamsSchema = exports.AccountQueryResponseSchema = exports.AccountQueryDataSchema = exports.AccountQueryParamsSchema = exports.TransactionSetupResponseSchema = exports.TransactionSetupDataSchema = exports.TransactionSetupParamsSchema = void 0;
const zod_1 = require("zod");
const schemas_1 = require("../../../core/schemas");
// Common parameter schemas
const ApiModeSchema = zod_1.z.enum(['dev', 'live']).optional();
// Transaction Setup Schemas
exports.TransactionSetupParamsSchema = schemas_1.BaseGetParamsSchema.extend({
customerId: zod_1.z.string(),
mode: ApiModeSchema,
});
exports.TransactionSetupDataSchema = zod_1.z.object({
uiEndpoint: zod_1.z.string(),
transactionSetupId: zod_1.z.string(),
});
exports.TransactionSetupResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.TransactionSetupDataSchema);
// Account Query Schemas
exports.AccountQueryParamsSchema = schemas_1.BaseGetParamsSchema.extend({
customerId: zod_1.z.string(),
transactionSetupId: zod_1.z.string(),
mode: ApiModeSchema,
});
exports.AccountQueryDataSchema = zod_1.z.object({
ExpressResponseCode: zod_1.z.string(),
ExpressResponseMessage: zod_1.z.string(),
ExpressTransactionDate: zod_1.z.string(),
ExpressTransactionTime: zod_1.z.string(),
ExpressTransactionTimezone: zod_1.z.string(),
ExpirationMonth: zod_1.z.string(),
ExpirationYear: zod_1.z.string(),
PaymentAccountID: zod_1.z.string(),
PaymentAccountType: zod_1.z.string(),
PaymentAccountReferenceNumber: zod_1.z.string(),
PaymentBrand: zod_1.z.string(),
PASSUpdaterBatchStatus: zod_1.z.string(),
PASSUpdaterStatus: zod_1.z.string(),
TransactionSetupID: zod_1.z.string(),
TruncatedCardNumber: zod_1.z.string(),
});
exports.AccountQueryResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.union([exports.AccountQueryDataSchema, zod_1.z.literal(false)]));
// Billing Update Schemas
exports.BillingUpdateParamsSchema = schemas_1.BaseGetParamsSchema.extend({
transactionSetupId: zod_1.z.string(),
address1: zod_1.z.string(),
address2: zod_1.z.string().optional(),
city: zod_1.z.string(),
state: zod_1.z.string(),
zip: zod_1.z.string(),
mode: ApiModeSchema,
});
exports.BillingUpdateResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.boolean());
// Card Info Schemas
exports.CardInfoParamsSchema = schemas_1.BaseGetParamsSchema.extend({
transactionSetupId: zod_1.z.string(),
mode: ApiModeSchema,
});
exports.CardInfoDataSchema = zod_1.z.object({
cardNumber: zod_1.z.string(),
expMonth: zod_1.z.string(),
expYear: zod_1.z.string(),
transactionSetupId: zod_1.z.string(),
});
exports.CardInfoResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.union([exports.CardInfoDataSchema, zod_1.z.record(zod_1.z.never())]));
// Surcharge Schemas
exports.SurchargeParamsSchema = schemas_1.BaseGetParamsSchema.extend({
customerId: zod_1.z.string(),
paymentAccountId: zod_1.z.string(),
amount: zod_1.z.string(),
fromState: zod_1.z.string(),
toState: zod_1.z.string(),
country: zod_1.z.string(),
mode: ApiModeSchema,
});
exports.SurchargeDataSchema = zod_1.z.object({
expressResponseCode: zod_1.z.string(),
surchargeAllowed: zod_1.z.boolean(),
surchargePercent: zod_1.z.string(),
message: zod_1.z.string(),
success: zod_1.z.boolean(),
surchargeDescription: zod_1.z.string(),
lumpSumTotalSurchargeAmount: zod_1.z.string(),
});
exports.SurchargeResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.union([exports.SurchargeDataSchema, zod_1.z.record(zod_1.z.never())]));
// Transaction Validation Schemas
exports.ValidateParamsSchema = schemas_1.BaseGetParamsSchema.extend({
customerId: zod_1.z.string(),
transactionSetupId: zod_1.z.string(),
mode: ApiModeSchema,
});
exports.ValidateResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.boolean());
//# sourceMappingURL=unified.js.map