@gr4vy/sdk 1.1.3 → 1.1.4
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.
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/paymentlink.d.ts +31 -3
- package/models/components/paymentlink.d.ts.map +1 -1
- package/models/components/paymentlink.js +36 -4
- package/models/components/paymentlink.js.map +1 -1
- package/models/components/paymentlinkcreate.d.ts +31 -4
- package/models/components/paymentlinkcreate.d.ts.map +1 -1
- package/models/components/paymentlinkcreate.js +35 -4
- package/models/components/paymentlinkcreate.js.map +1 -1
- package/models/components/transaction.d.ts +31 -3
- package/models/components/transaction.d.ts.map +1 -1
- package/models/components/transaction.js +36 -4
- package/models/components/transaction.js.map +1 -1
- package/models/components/transactioncreate.d.ts +32 -4
- package/models/components/transactioncreate.d.ts.map +1 -1
- package/models/components/transactioncreate.js +36 -4
- package/models/components/transactioncreate.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/models/components/paymentlink.ts +58 -9
- package/src/models/components/paymentlinkcreate.ts +58 -10
- package/src/models/components/transaction.ts +58 -9
- package/src/models/components/transactioncreate.ts +57 -10
|
@@ -5,6 +5,11 @@
|
|
|
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";
|
|
8
13
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
14
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
15
|
import {
|
|
@@ -102,11 +107,6 @@ import {
|
|
|
102
107
|
TransactionPaymentService$Outbound,
|
|
103
108
|
TransactionPaymentService$outboundSchema,
|
|
104
109
|
} 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,6 +119,23 @@ 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
|
+
|
|
122
139
|
/**
|
|
123
140
|
* A full transaction resource.
|
|
124
141
|
*/
|
|
@@ -262,9 +279,9 @@ export type Transaction = {
|
|
|
262
279
|
*/
|
|
263
280
|
antiFraudDecision?: AntiFraudDecision | null | undefined;
|
|
264
281
|
/**
|
|
265
|
-
* The
|
|
282
|
+
* The source of the transaction.
|
|
266
283
|
*/
|
|
267
|
-
paymentSource:
|
|
284
|
+
paymentSource: TransactionPaymentSource1;
|
|
268
285
|
/**
|
|
269
286
|
* Indicates whether the transaction was initiated by the merchant or the customer.
|
|
270
287
|
*/
|
|
@@ -344,6 +361,38 @@ export type Transaction = {
|
|
|
344
361
|
installmentCount?: number | null | undefined;
|
|
345
362
|
};
|
|
346
363
|
|
|
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
|
+
|
|
347
396
|
/** @internal */
|
|
348
397
|
export const Transaction$inboundSchema: z.ZodType<
|
|
349
398
|
Transaction,
|
|
@@ -387,7 +436,7 @@ export const Transaction$inboundSchema: z.ZodType<
|
|
|
387
436
|
avs_response_code: z.nullable(AVSResponseCode$inboundSchema).optional(),
|
|
388
437
|
cvv_response_code: z.nullable(CVVResponseCode$inboundSchema).optional(),
|
|
389
438
|
anti_fraud_decision: z.nullable(AntiFraudDecision$inboundSchema).optional(),
|
|
390
|
-
payment_source:
|
|
439
|
+
payment_source: TransactionPaymentSource1$inboundSchema,
|
|
391
440
|
merchant_initiated: z.boolean(),
|
|
392
441
|
is_subsequent_payment: z.boolean(),
|
|
393
442
|
cart_items: z.nullable(z.array(CartItem$inboundSchema)).optional(),
|
|
@@ -573,7 +622,7 @@ export const Transaction$outboundSchema: z.ZodType<
|
|
|
573
622
|
avsResponseCode: z.nullable(AVSResponseCode$outboundSchema).optional(),
|
|
574
623
|
cvvResponseCode: z.nullable(CVVResponseCode$outboundSchema).optional(),
|
|
575
624
|
antiFraudDecision: z.nullable(AntiFraudDecision$outboundSchema).optional(),
|
|
576
|
-
paymentSource:
|
|
625
|
+
paymentSource: TransactionPaymentSource1$outboundSchema,
|
|
577
626
|
merchantInitiated: z.boolean(),
|
|
578
627
|
isSubsequentPayment: z.boolean(),
|
|
579
628
|
cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(),
|
|
@@ -5,6 +5,11 @@
|
|
|
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";
|
|
8
13
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
14
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
15
|
import {
|
|
@@ -132,11 +137,6 @@ import {
|
|
|
132
137
|
TransactionIntent$inboundSchema,
|
|
133
138
|
TransactionIntent$outboundSchema,
|
|
134
139
|
} 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,6 +162,21 @@ 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
|
+
|
|
165
180
|
export type TransactionCreate = {
|
|
166
181
|
/**
|
|
167
182
|
* 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`.
|
|
@@ -253,9 +268,9 @@ export type TransactionCreate = {
|
|
|
253
268
|
*/
|
|
254
269
|
merchantInitiated?: boolean | undefined;
|
|
255
270
|
/**
|
|
256
|
-
* The
|
|
271
|
+
* The use-case for the the transaction.
|
|
257
272
|
*/
|
|
258
|
-
paymentSource?:
|
|
273
|
+
paymentSource?: PaymentSource | undefined;
|
|
259
274
|
/**
|
|
260
275
|
* The airline addendum data which describes the airline booking associated with this transaction.
|
|
261
276
|
*/
|
|
@@ -515,6 +530,38 @@ export function threeDSecureDataFromJSON(
|
|
|
515
530
|
);
|
|
516
531
|
}
|
|
517
532
|
|
|
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
|
+
|
|
518
565
|
/** @internal */
|
|
519
566
|
export const TransactionCreate$inboundSchema: z.ZodType<
|
|
520
567
|
TransactionCreate,
|
|
@@ -561,7 +608,7 @@ export const TransactionCreate$inboundSchema: z.ZodType<
|
|
|
561
608
|
metadata: z.nullable(z.record(z.string())).optional(),
|
|
562
609
|
is_subsequent_payment: z.boolean().default(false),
|
|
563
610
|
merchant_initiated: z.boolean().default(false),
|
|
564
|
-
payment_source:
|
|
611
|
+
payment_source: PaymentSource$inboundSchema.default("ecommerce"),
|
|
565
612
|
airline: z.nullable(Airline$inboundSchema).optional(),
|
|
566
613
|
cart_items: z.nullable(z.array(CartItem$inboundSchema)).optional(),
|
|
567
614
|
statement_descriptor: z.nullable(StatementDescriptor$inboundSchema)
|
|
@@ -642,7 +689,7 @@ export type TransactionCreate$Outbound = {
|
|
|
642
689
|
metadata?: { [k: string]: string } | null | undefined;
|
|
643
690
|
is_subsequent_payment: boolean;
|
|
644
691
|
merchant_initiated: boolean;
|
|
645
|
-
payment_source
|
|
692
|
+
payment_source: string;
|
|
646
693
|
airline?: Airline$Outbound | null | undefined;
|
|
647
694
|
cart_items?: Array<CartItem$Outbound> | null | undefined;
|
|
648
695
|
statement_descriptor?: StatementDescriptor$Outbound | null | undefined;
|
|
@@ -705,7 +752,7 @@ export const TransactionCreate$outboundSchema: z.ZodType<
|
|
|
705
752
|
metadata: z.nullable(z.record(z.string())).optional(),
|
|
706
753
|
isSubsequentPayment: z.boolean().default(false),
|
|
707
754
|
merchantInitiated: z.boolean().default(false),
|
|
708
|
-
paymentSource:
|
|
755
|
+
paymentSource: PaymentSource$outboundSchema.default("ecommerce"),
|
|
709
756
|
airline: z.nullable(Airline$outboundSchema).optional(),
|
|
710
757
|
cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(),
|
|
711
758
|
statementDescriptor: z.nullable(StatementDescriptor$outboundSchema)
|