@gr4vy/sdk 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,11 +5,6 @@
5
5
  import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
- import {
9
- catchUnrecognizedEnum,
10
- OpenEnum,
11
- Unrecognized,
12
- } from "../../types/enums.js";
13
8
  import { Result as SafeParseResult } from "../../types/fp.js";
14
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
15
10
  import {
@@ -107,6 +102,11 @@ import {
107
102
  TransactionPaymentService$Outbound,
108
103
  TransactionPaymentService$outboundSchema,
109
104
  } from "./transactionpaymentservice.js";
105
+ import {
106
+ TransactionPaymentSource,
107
+ TransactionPaymentSource$inboundSchema,
108
+ TransactionPaymentSource$outboundSchema,
109
+ } from "./transactionpaymentsource.js";
110
110
  import {
111
111
  TransactionStatus,
112
112
  TransactionStatus$inboundSchema,
@@ -119,23 +119,6 @@ import {
119
119
  TransactionThreeDSecureSummary$outboundSchema,
120
120
  } from "./transactionthreedsecuresummary.js";
121
121
 
122
- /**
123
- * The source of the transaction.
124
- */
125
- export const TransactionPaymentSource1 = {
126
- Ecommerce: "ecommerce",
127
- Moto: "moto",
128
- Recurring: "recurring",
129
- Installment: "installment",
130
- CardOnFile: "card_on_file",
131
- } as const;
132
- /**
133
- * The source of the transaction.
134
- */
135
- export type TransactionPaymentSource1 = OpenEnum<
136
- typeof TransactionPaymentSource1
137
- >;
138
-
139
122
  /**
140
123
  * A full transaction resource.
141
124
  */
@@ -279,9 +262,9 @@ export type Transaction = {
279
262
  */
280
263
  antiFraudDecision?: AntiFraudDecision | null | undefined;
281
264
  /**
282
- * The source of the transaction.
265
+ * The way payment method information made it to this transaction.
283
266
  */
284
- paymentSource: TransactionPaymentSource1;
267
+ paymentSource: TransactionPaymentSource;
285
268
  /**
286
269
  * Indicates whether the transaction was initiated by the merchant or the customer.
287
270
  */
@@ -361,38 +344,6 @@ export type Transaction = {
361
344
  installmentCount?: number | null | undefined;
362
345
  };
363
346
 
364
- /** @internal */
365
- export const TransactionPaymentSource1$inboundSchema: z.ZodType<
366
- TransactionPaymentSource1,
367
- z.ZodTypeDef,
368
- unknown
369
- > = z
370
- .union([
371
- z.nativeEnum(TransactionPaymentSource1),
372
- z.string().transform(catchUnrecognizedEnum),
373
- ]);
374
-
375
- /** @internal */
376
- export const TransactionPaymentSource1$outboundSchema: z.ZodType<
377
- TransactionPaymentSource1,
378
- z.ZodTypeDef,
379
- TransactionPaymentSource1
380
- > = z.union([
381
- z.nativeEnum(TransactionPaymentSource1),
382
- z.string().and(z.custom<Unrecognized<string>>()),
383
- ]);
384
-
385
- /**
386
- * @internal
387
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
388
- */
389
- export namespace TransactionPaymentSource1$ {
390
- /** @deprecated use `TransactionPaymentSource1$inboundSchema` instead. */
391
- export const inboundSchema = TransactionPaymentSource1$inboundSchema;
392
- /** @deprecated use `TransactionPaymentSource1$outboundSchema` instead. */
393
- export const outboundSchema = TransactionPaymentSource1$outboundSchema;
394
- }
395
-
396
347
  /** @internal */
397
348
  export const Transaction$inboundSchema: z.ZodType<
398
349
  Transaction,
@@ -436,7 +387,7 @@ export const Transaction$inboundSchema: z.ZodType<
436
387
  avs_response_code: z.nullable(AVSResponseCode$inboundSchema).optional(),
437
388
  cvv_response_code: z.nullable(CVVResponseCode$inboundSchema).optional(),
438
389
  anti_fraud_decision: z.nullable(AntiFraudDecision$inboundSchema).optional(),
439
- payment_source: TransactionPaymentSource1$inboundSchema,
390
+ payment_source: TransactionPaymentSource$inboundSchema,
440
391
  merchant_initiated: z.boolean(),
441
392
  is_subsequent_payment: z.boolean(),
442
393
  cart_items: z.nullable(z.array(CartItem$inboundSchema)).optional(),
@@ -622,7 +573,7 @@ export const Transaction$outboundSchema: z.ZodType<
622
573
  avsResponseCode: z.nullable(AVSResponseCode$outboundSchema).optional(),
623
574
  cvvResponseCode: z.nullable(CVVResponseCode$outboundSchema).optional(),
624
575
  antiFraudDecision: z.nullable(AntiFraudDecision$outboundSchema).optional(),
625
- paymentSource: TransactionPaymentSource1$outboundSchema,
576
+ paymentSource: TransactionPaymentSource$outboundSchema,
626
577
  merchantInitiated: z.boolean(),
627
578
  isSubsequentPayment: z.boolean(),
628
579
  cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(),
@@ -5,11 +5,6 @@
5
5
  import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
- import {
9
- catchUnrecognizedEnum,
10
- OpenEnum,
11
- Unrecognized,
12
- } from "../../types/enums.js";
13
8
  import { Result as SafeParseResult } from "../../types/fp.js";
14
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
15
10
  import {
@@ -137,6 +132,11 @@ import {
137
132
  TransactionIntent$inboundSchema,
138
133
  TransactionIntent$outboundSchema,
139
134
  } from "./transactionintent.js";
135
+ import {
136
+ TransactionPaymentSource,
137
+ TransactionPaymentSource$inboundSchema,
138
+ TransactionPaymentSource$outboundSchema,
139
+ } from "./transactionpaymentsource.js";
140
140
 
141
141
  /**
142
142
  * The optional payment method to use for this transaction. This field is required if no `gift_cards` have been added.
@@ -162,21 +162,6 @@ export type TransactionCreateGiftCards =
162
162
  */
163
163
  export type ThreeDSecureData = ThreeDSecureDataV1 | ThreeDSecureDataV2;
164
164
 
165
- /**
166
- * The use-case for the the transaction.
167
- */
168
- export const PaymentSource = {
169
- Ecommerce: "ecommerce",
170
- Moto: "moto",
171
- Recurring: "recurring",
172
- Installment: "installment",
173
- CardOnFile: "card_on_file",
174
- } as const;
175
- /**
176
- * The use-case for the the transaction.
177
- */
178
- export type PaymentSource = OpenEnum<typeof PaymentSource>;
179
-
180
165
  export type TransactionCreate = {
181
166
  /**
182
167
  * The monetary amount for this transaction, in the smallest currency unit for the given currency, for example `1299` cents to create an authorization for `$12.99`. If the `intent` is set to `capture`, an amount greater than zero must be supplied. All gift card amounts are subtracted from this amount before the remainder is charged to the provided `payment_method`.
@@ -268,9 +253,9 @@ export type TransactionCreate = {
268
253
  */
269
254
  merchantInitiated?: boolean | undefined;
270
255
  /**
271
- * The use-case for the the transaction.
256
+ * The way payment method information made it to this transaction.
272
257
  */
273
- paymentSource?: PaymentSource | undefined;
258
+ paymentSource?: TransactionPaymentSource | undefined;
274
259
  /**
275
260
  * The airline addendum data which describes the airline booking associated with this transaction.
276
261
  */
@@ -530,38 +515,6 @@ export function threeDSecureDataFromJSON(
530
515
  );
531
516
  }
532
517
 
533
- /** @internal */
534
- export const PaymentSource$inboundSchema: z.ZodType<
535
- PaymentSource,
536
- z.ZodTypeDef,
537
- unknown
538
- > = z
539
- .union([
540
- z.nativeEnum(PaymentSource),
541
- z.string().transform(catchUnrecognizedEnum),
542
- ]);
543
-
544
- /** @internal */
545
- export const PaymentSource$outboundSchema: z.ZodType<
546
- PaymentSource,
547
- z.ZodTypeDef,
548
- PaymentSource
549
- > = z.union([
550
- z.nativeEnum(PaymentSource),
551
- z.string().and(z.custom<Unrecognized<string>>()),
552
- ]);
553
-
554
- /**
555
- * @internal
556
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
557
- */
558
- export namespace PaymentSource$ {
559
- /** @deprecated use `PaymentSource$inboundSchema` instead. */
560
- export const inboundSchema = PaymentSource$inboundSchema;
561
- /** @deprecated use `PaymentSource$outboundSchema` instead. */
562
- export const outboundSchema = PaymentSource$outboundSchema;
563
- }
564
-
565
518
  /** @internal */
566
519
  export const TransactionCreate$inboundSchema: z.ZodType<
567
520
  TransactionCreate,
@@ -608,7 +561,7 @@ export const TransactionCreate$inboundSchema: z.ZodType<
608
561
  metadata: z.nullable(z.record(z.string())).optional(),
609
562
  is_subsequent_payment: z.boolean().default(false),
610
563
  merchant_initiated: z.boolean().default(false),
611
- payment_source: PaymentSource$inboundSchema.default("ecommerce"),
564
+ payment_source: TransactionPaymentSource$inboundSchema.optional(),
612
565
  airline: z.nullable(Airline$inboundSchema).optional(),
613
566
  cart_items: z.nullable(z.array(CartItem$inboundSchema)).optional(),
614
567
  statement_descriptor: z.nullable(StatementDescriptor$inboundSchema)
@@ -689,7 +642,7 @@ export type TransactionCreate$Outbound = {
689
642
  metadata?: { [k: string]: string } | null | undefined;
690
643
  is_subsequent_payment: boolean;
691
644
  merchant_initiated: boolean;
692
- payment_source: string;
645
+ payment_source?: string | undefined;
693
646
  airline?: Airline$Outbound | null | undefined;
694
647
  cart_items?: Array<CartItem$Outbound> | null | undefined;
695
648
  statement_descriptor?: StatementDescriptor$Outbound | null | undefined;
@@ -752,7 +705,7 @@ export const TransactionCreate$outboundSchema: z.ZodType<
752
705
  metadata: z.nullable(z.record(z.string())).optional(),
753
706
  isSubsequentPayment: z.boolean().default(false),
754
707
  merchantInitiated: z.boolean().default(false),
755
- paymentSource: PaymentSource$outboundSchema.default("ecommerce"),
708
+ paymentSource: TransactionPaymentSource$outboundSchema.optional(),
756
709
  airline: z.nullable(Airline$outboundSchema).optional(),
757
710
  cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(),
758
711
  statementDescriptor: z.nullable(StatementDescriptor$outboundSchema)