@gr4vy/sdk 2.0.3 → 2.0.5

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.
Files changed (45) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +3 -3
  3. package/lib/config.js +3 -3
  4. package/models/components/achbankpaymentmethodcreate.d.ts +79 -0
  5. package/models/components/achbankpaymentmethodcreate.d.ts.map +1 -0
  6. package/models/components/achbankpaymentmethodcreate.js +81 -0
  7. package/models/components/achbankpaymentmethodcreate.js.map +1 -0
  8. package/models/components/bacsbankpaymentmethodcreate.d.ts +55 -0
  9. package/models/components/bacsbankpaymentmethodcreate.d.ts.map +1 -0
  10. package/models/components/bacsbankpaymentmethodcreate.js +67 -0
  11. package/models/components/bacsbankpaymentmethodcreate.js.map +1 -0
  12. package/models/components/bankaccountholder.d.ts +25 -0
  13. package/models/components/bankaccountholder.d.ts.map +1 -0
  14. package/models/components/bankaccountholder.js +58 -0
  15. package/models/components/bankaccountholder.js.map +1 -0
  16. package/models/components/index.d.ts +4 -0
  17. package/models/components/index.d.ts.map +1 -1
  18. package/models/components/index.js +4 -0
  19. package/models/components/index.js.map +1 -1
  20. package/models/components/sepabankpaymentmethodcreate.d.ts +55 -0
  21. package/models/components/sepabankpaymentmethodcreate.d.ts.map +1 -0
  22. package/models/components/sepabankpaymentmethodcreate.js +67 -0
  23. package/models/components/sepabankpaymentmethodcreate.js.map +1 -0
  24. package/models/components/threedsecurescenariooutcome.d.ts +2 -2
  25. package/models/components/threedsecurescenariooutcome.d.ts.map +1 -1
  26. package/models/components/threedsecurescenariooutcome.js +2 -2
  27. package/models/components/threedsecurescenariooutcome.js.map +1 -1
  28. package/models/operations/createpaymentmethod.d.ts +4 -4
  29. package/models/operations/createpaymentmethod.d.ts.map +1 -1
  30. package/models/operations/createpaymentmethod.js +6 -0
  31. package/models/operations/createpaymentmethod.js.map +1 -1
  32. package/models/operations/listbuyerpaymentmethods.d.ts +18 -3
  33. package/models/operations/listbuyerpaymentmethods.d.ts.map +1 -1
  34. package/models/operations/listbuyerpaymentmethods.js +14 -2
  35. package/models/operations/listbuyerpaymentmethods.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/lib/config.ts +3 -3
  38. package/src/models/components/achbankpaymentmethodcreate.ts +130 -0
  39. package/src/models/components/bacsbankpaymentmethodcreate.ts +97 -0
  40. package/src/models/components/bankaccountholder.ts +53 -0
  41. package/src/models/components/index.ts +4 -0
  42. package/src/models/components/sepabankpaymentmethodcreate.ts +97 -0
  43. package/src/models/components/threedsecurescenariooutcome.ts +4 -4
  44. package/src/models/operations/createpaymentmethod.ts +18 -0
  45. package/src/models/operations/listbuyerpaymentmethods.ts +22 -4
@@ -0,0 +1,97 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import {
8
+ BankAccountHolder,
9
+ BankAccountHolder$Outbound,
10
+ BankAccountHolder$outboundSchema,
11
+ } from "./bankaccountholder.js";
12
+
13
+ /**
14
+ * SEPA Bank Payment Method
15
+ *
16
+ * @remarks
17
+ *
18
+ * Bank Payment Method for SEPA bank accounts.
19
+ */
20
+ export type SEPABankPaymentMethodCreate = {
21
+ /**
22
+ * Always `bank`.
23
+ */
24
+ method?: "bank" | undefined;
25
+ accountHolder: BankAccountHolder;
26
+ /**
27
+ * The ID of the buyer to attach the method to.
28
+ */
29
+ buyerId?: string | null | undefined;
30
+ /**
31
+ * The merchant reference for this payment method.
32
+ */
33
+ buyerExternalIdentifier?: string | null | undefined;
34
+ /**
35
+ * The merchant identifier for this payment method.
36
+ */
37
+ externalIdentifier?: string | null | undefined;
38
+ /**
39
+ * Always `sepa`.
40
+ */
41
+ scheme?: "sepa" | undefined;
42
+ /**
43
+ * The IBAN for this SEPA bank account
44
+ */
45
+ accountNumber: string;
46
+ /**
47
+ * The BIC for this SEPA bank account
48
+ */
49
+ routingNumber?: string | null | undefined;
50
+ };
51
+
52
+ /** @internal */
53
+ export type SEPABankPaymentMethodCreate$Outbound = {
54
+ method: "bank";
55
+ account_holder: BankAccountHolder$Outbound;
56
+ buyer_id?: string | null | undefined;
57
+ buyer_external_identifier?: string | null | undefined;
58
+ external_identifier?: string | null | undefined;
59
+ scheme: "sepa";
60
+ account_number: string;
61
+ routing_number?: string | null | undefined;
62
+ };
63
+
64
+ /** @internal */
65
+ export const SEPABankPaymentMethodCreate$outboundSchema: z.ZodType<
66
+ SEPABankPaymentMethodCreate$Outbound,
67
+ z.ZodTypeDef,
68
+ SEPABankPaymentMethodCreate
69
+ > = z.object({
70
+ method: z.literal("bank").default("bank" as const),
71
+ accountHolder: BankAccountHolder$outboundSchema,
72
+ buyerId: z.nullable(z.string()).optional(),
73
+ buyerExternalIdentifier: z.nullable(z.string()).optional(),
74
+ externalIdentifier: z.nullable(z.string()).optional(),
75
+ scheme: z.literal("sepa").default("sepa" as const),
76
+ accountNumber: z.string(),
77
+ routingNumber: z.nullable(z.string()).optional(),
78
+ }).transform((v) => {
79
+ return remap$(v, {
80
+ accountHolder: "account_holder",
81
+ buyerId: "buyer_id",
82
+ buyerExternalIdentifier: "buyer_external_identifier",
83
+ externalIdentifier: "external_identifier",
84
+ accountNumber: "account_number",
85
+ routingNumber: "routing_number",
86
+ });
87
+ });
88
+
89
+ export function sepaBankPaymentMethodCreateToJSON(
90
+ sepaBankPaymentMethodCreate: SEPABankPaymentMethodCreate,
91
+ ): string {
92
+ return JSON.stringify(
93
+ SEPABankPaymentMethodCreate$outboundSchema.parse(
94
+ sepaBankPaymentMethodCreate,
95
+ ),
96
+ );
97
+ }
@@ -23,7 +23,7 @@ export type ThreeDSecureScenarioOutcome = {
23
23
  /**
24
24
  * The version of 3DS which will be simulated.
25
25
  */
26
- version: string;
26
+ version?: string | null | undefined;
27
27
  authentication: ThreeDSecureScenarioOutcomeAuthentication;
28
28
  /**
29
29
  * 3DS result value. Required if authentication status is "C".
@@ -37,14 +37,14 @@ export const ThreeDSecureScenarioOutcome$inboundSchema: z.ZodType<
37
37
  z.ZodTypeDef,
38
38
  unknown
39
39
  > = z.object({
40
- version: z.string(),
40
+ version: z.nullable(z.string()).optional(),
41
41
  authentication: ThreeDSecureScenarioOutcomeAuthentication$inboundSchema,
42
42
  result: z.nullable(ThreeDSecureScenarioOutcomeResult$inboundSchema)
43
43
  .optional(),
44
44
  });
45
45
  /** @internal */
46
46
  export type ThreeDSecureScenarioOutcome$Outbound = {
47
- version: string;
47
+ version?: string | null | undefined;
48
48
  authentication: ThreeDSecureScenarioOutcomeAuthentication$Outbound;
49
49
  result?: ThreeDSecureScenarioOutcomeResult$Outbound | null | undefined;
50
50
  };
@@ -55,7 +55,7 @@ export const ThreeDSecureScenarioOutcome$outboundSchema: z.ZodType<
55
55
  z.ZodTypeDef,
56
56
  ThreeDSecureScenarioOutcome
57
57
  > = z.object({
58
- version: z.string(),
58
+ version: z.nullable(z.string()).optional(),
59
59
  authentication: ThreeDSecureScenarioOutcomeAuthentication$outboundSchema,
60
60
  result: z.nullable(ThreeDSecureScenarioOutcomeResult$outboundSchema)
61
61
  .optional(),
@@ -12,7 +12,10 @@ export type CreatePaymentMethodGlobals = {
12
12
 
13
13
  export type CreatePaymentMethodBody =
14
14
  | components.RedirectPaymentMethodCreate
15
+ | components.ACHBankPaymentMethodCreate
16
+ | components.BACSBankPaymentMethodCreate
15
17
  | components.CardPaymentMethodCreate
18
+ | components.SEPABankPaymentMethodCreate
16
19
  | components.CheckoutSessionPaymentMethodCreate
17
20
  | components.PlaidPaymentMethodCreate;
18
21
 
@@ -23,7 +26,10 @@ export type CreatePaymentMethodRequest = {
23
26
  merchantAccountId?: string | null | undefined;
24
27
  requestBody:
25
28
  | components.RedirectPaymentMethodCreate
29
+ | components.ACHBankPaymentMethodCreate
30
+ | components.BACSBankPaymentMethodCreate
26
31
  | components.CardPaymentMethodCreate
32
+ | components.SEPABankPaymentMethodCreate
27
33
  | components.CheckoutSessionPaymentMethodCreate
28
34
  | components.PlaidPaymentMethodCreate;
29
35
  };
@@ -31,7 +37,10 @@ export type CreatePaymentMethodRequest = {
31
37
  /** @internal */
32
38
  export type CreatePaymentMethodBody$Outbound =
33
39
  | components.RedirectPaymentMethodCreate$Outbound
40
+ | components.ACHBankPaymentMethodCreate$Outbound
41
+ | components.BACSBankPaymentMethodCreate$Outbound
34
42
  | components.CardPaymentMethodCreate$Outbound
43
+ | components.SEPABankPaymentMethodCreate$Outbound
35
44
  | components.CheckoutSessionPaymentMethodCreate$Outbound
36
45
  | components.PlaidPaymentMethodCreate$Outbound;
37
46
 
@@ -42,7 +51,10 @@ export const CreatePaymentMethodBody$outboundSchema: z.ZodType<
42
51
  CreatePaymentMethodBody
43
52
  > = z.union([
44
53
  components.RedirectPaymentMethodCreate$outboundSchema,
54
+ components.ACHBankPaymentMethodCreate$outboundSchema,
55
+ components.BACSBankPaymentMethodCreate$outboundSchema,
45
56
  components.CardPaymentMethodCreate$outboundSchema,
57
+ components.SEPABankPaymentMethodCreate$outboundSchema,
46
58
  components.CheckoutSessionPaymentMethodCreate$outboundSchema,
47
59
  components.PlaidPaymentMethodCreate$outboundSchema,
48
60
  ]);
@@ -60,7 +72,10 @@ export type CreatePaymentMethodRequest$Outbound = {
60
72
  merchantAccountId?: string | null | undefined;
61
73
  RequestBody:
62
74
  | components.RedirectPaymentMethodCreate$Outbound
75
+ | components.ACHBankPaymentMethodCreate$Outbound
76
+ | components.BACSBankPaymentMethodCreate$Outbound
63
77
  | components.CardPaymentMethodCreate$Outbound
78
+ | components.SEPABankPaymentMethodCreate$Outbound
64
79
  | components.CheckoutSessionPaymentMethodCreate$Outbound
65
80
  | components.PlaidPaymentMethodCreate$Outbound;
66
81
  };
@@ -74,7 +89,10 @@ export const CreatePaymentMethodRequest$outboundSchema: z.ZodType<
74
89
  merchantAccountId: z.nullable(z.string()).optional(),
75
90
  requestBody: z.union([
76
91
  components.RedirectPaymentMethodCreate$outboundSchema,
92
+ components.ACHBankPaymentMethodCreate$outboundSchema,
93
+ components.BACSBankPaymentMethodCreate$outboundSchema,
77
94
  components.CardPaymentMethodCreate$outboundSchema,
95
+ components.SEPABankPaymentMethodCreate$outboundSchema,
78
96
  components.CheckoutSessionPaymentMethodCreate$outboundSchema,
79
97
  components.PlaidPaymentMethodCreate$outboundSchema,
80
98
  ]),
@@ -5,12 +5,26 @@
5
5
  import * as z from "zod/v3";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import * as openEnums from "../../types/enums.js";
8
- import { OpenEnum } from "../../types/enums.js";
8
+ import { ClosedEnum, OpenEnum } from "../../types/enums.js";
9
9
 
10
10
  export type ListBuyerPaymentMethodsGlobals = {
11
11
  merchantAccountId?: string | undefined;
12
12
  };
13
13
 
14
+ /**
15
+ * The field to sort the payment methods by.
16
+ */
17
+ export const SortBy = {
18
+ LastUsedAt: "last_used_at",
19
+ UsageCount: "usage_count",
20
+ CitLastUsedAt: "cit_last_used_at",
21
+ CitUsageCount: "cit_usage_count",
22
+ } as const;
23
+ /**
24
+ * The field to sort the payment methods by.
25
+ */
26
+ export type SortBy = ClosedEnum<typeof SortBy>;
27
+
14
28
  /**
15
29
  * The direction to sort the payment methods in.
16
30
  */
@@ -35,7 +49,7 @@ export type ListBuyerPaymentMethodsRequest = {
35
49
  /**
36
50
  * The field to sort the payment methods by.
37
51
  */
38
- sortBy?: "last_used_at" | null | undefined;
52
+ sortBy?: SortBy | null | undefined;
39
53
  /**
40
54
  * The direction to sort the payment methods in.
41
55
  */
@@ -54,6 +68,10 @@ export type ListBuyerPaymentMethodsRequest = {
54
68
  merchantAccountId?: string | null | undefined;
55
69
  };
56
70
 
71
+ /** @internal */
72
+ export const SortBy$outboundSchema: z.ZodNativeEnum<typeof SortBy> = z
73
+ .nativeEnum(SortBy);
74
+
57
75
  /** @internal */
58
76
  export const OrderBy$outboundSchema: z.ZodType<string, z.ZodTypeDef, OrderBy> =
59
77
  openEnums.outboundSchema(OrderBy);
@@ -62,7 +80,7 @@ export const OrderBy$outboundSchema: z.ZodType<string, z.ZodTypeDef, OrderBy> =
62
80
  export type ListBuyerPaymentMethodsRequest$Outbound = {
63
81
  buyer_id?: string | null | undefined;
64
82
  buyer_external_identifier?: string | null | undefined;
65
- sort_by?: "last_used_at" | null | undefined;
83
+ sort_by?: string | null | undefined;
66
84
  order_by: string;
67
85
  country?: string | null | undefined;
68
86
  currency?: string | null | undefined;
@@ -77,7 +95,7 @@ export const ListBuyerPaymentMethodsRequest$outboundSchema: z.ZodType<
77
95
  > = z.object({
78
96
  buyerId: z.nullable(z.string()).optional(),
79
97
  buyerExternalIdentifier: z.nullable(z.string()).optional(),
80
- sortBy: z.nullable(z.literal("last_used_at")).optional(),
98
+ sortBy: z.nullable(SortBy$outboundSchema).optional(),
81
99
  orderBy: OrderBy$outboundSchema.default("desc"),
82
100
  country: z.nullable(z.string()).optional(),
83
101
  currency: z.nullable(z.string()).optional(),