@gr4vy/sdk 1.9.19 → 1.10.0

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 (116) hide show
  1. package/README.md +11 -0
  2. package/examples/package-lock.json +1 -1
  3. package/funcs/merchantAccountsThreeDsConfigurationCreate.d.ts +18 -0
  4. package/funcs/merchantAccountsThreeDsConfigurationCreate.d.ts.map +1 -0
  5. package/funcs/merchantAccountsThreeDsConfigurationCreate.js +141 -0
  6. package/funcs/merchantAccountsThreeDsConfigurationCreate.js.map +1 -0
  7. package/funcs/merchantAccountsThreeDsConfigurationDelete.d.ts +17 -0
  8. package/funcs/merchantAccountsThreeDsConfigurationDelete.d.ts.map +1 -0
  9. package/funcs/merchantAccountsThreeDsConfigurationDelete.js +141 -0
  10. package/funcs/merchantAccountsThreeDsConfigurationDelete.js.map +1 -0
  11. package/funcs/merchantAccountsThreeDsConfigurationList.d.ts +18 -0
  12. package/funcs/merchantAccountsThreeDsConfigurationList.d.ts.map +1 -0
  13. package/funcs/merchantAccountsThreeDsConfigurationList.js +154 -0
  14. package/funcs/merchantAccountsThreeDsConfigurationList.js.map +1 -0
  15. package/funcs/merchantAccountsThreeDsConfigurationUpdate.d.ts +18 -0
  16. package/funcs/merchantAccountsThreeDsConfigurationUpdate.d.ts.map +1 -0
  17. package/funcs/merchantAccountsThreeDsConfigurationUpdate.js +143 -0
  18. package/funcs/merchantAccountsThreeDsConfigurationUpdate.js.map +1 -0
  19. package/funcs/transactionsCapture.d.ts +1 -2
  20. package/funcs/transactionsCapture.d.ts.map +1 -1
  21. package/funcs/transactionsCapture.js +6 -11
  22. package/funcs/transactionsCapture.js.map +1 -1
  23. package/funcs/transactionsVoid.d.ts +1 -1
  24. package/funcs/transactionsVoid.d.ts.map +1 -1
  25. package/funcs/transactionsVoid.js +6 -4
  26. package/funcs/transactionsVoid.js.map +1 -1
  27. package/jsr.json +1 -1
  28. package/lib/config.d.ts +3 -3
  29. package/lib/config.js +3 -3
  30. package/models/components/index.d.ts +4 -0
  31. package/models/components/index.d.ts.map +1 -1
  32. package/models/components/index.js +4 -0
  33. package/models/components/index.js.map +1 -1
  34. package/models/components/merchantaccountthreedsconfiguration.d.ts +62 -0
  35. package/models/components/merchantaccountthreedsconfiguration.d.ts.map +1 -0
  36. package/models/components/merchantaccountthreedsconfiguration.js +77 -0
  37. package/models/components/merchantaccountthreedsconfiguration.js.map +1 -0
  38. package/models/components/merchantaccountthreedsconfigurationcreate.d.ts +54 -0
  39. package/models/components/merchantaccountthreedsconfigurationcreate.d.ts.map +1 -0
  40. package/models/components/merchantaccountthreedsconfigurationcreate.js +68 -0
  41. package/models/components/merchantaccountthreedsconfigurationcreate.js.map +1 -0
  42. package/models/components/merchantaccountthreedsconfigurations.d.ts +14 -0
  43. package/models/components/merchantaccountthreedsconfigurations.d.ts.map +1 -0
  44. package/models/components/merchantaccountthreedsconfigurations.js +51 -0
  45. package/models/components/merchantaccountthreedsconfigurations.js.map +1 -0
  46. package/models/components/merchantaccountthreedsconfigurationupdate.d.ts +57 -0
  47. package/models/components/merchantaccountthreedsconfigurationupdate.d.ts.map +1 -0
  48. package/models/components/merchantaccountthreedsconfigurationupdate.js +68 -0
  49. package/models/components/merchantaccountthreedsconfigurationupdate.js.map +1 -0
  50. package/models/operations/capturetransaction.d.ts +8 -3
  51. package/models/operations/capturetransaction.d.ts.map +1 -1
  52. package/models/operations/capturetransaction.js +7 -5
  53. package/models/operations/capturetransaction.js.map +1 -1
  54. package/models/operations/createthreedsconfiguration.d.ts +18 -0
  55. package/models/operations/createthreedsconfiguration.d.ts.map +1 -0
  56. package/models/operations/createthreedsconfiguration.js +57 -0
  57. package/models/operations/createthreedsconfiguration.js.map +1 -0
  58. package/models/operations/deletethreedsconfiguration.d.ts +20 -0
  59. package/models/operations/deletethreedsconfiguration.d.ts.map +1 -0
  60. package/models/operations/deletethreedsconfiguration.js +56 -0
  61. package/models/operations/deletethreedsconfiguration.js.map +1 -0
  62. package/models/operations/editthreedsconfiguration.d.ts +23 -0
  63. package/models/operations/editthreedsconfiguration.d.ts.map +1 -0
  64. package/models/operations/editthreedsconfiguration.js +59 -0
  65. package/models/operations/editthreedsconfiguration.js.map +1 -0
  66. package/models/operations/getmerchantaccount.d.ts +1 -1
  67. package/models/operations/index.d.ts +4 -0
  68. package/models/operations/index.d.ts.map +1 -1
  69. package/models/operations/index.js +4 -0
  70. package/models/operations/index.js.map +1 -1
  71. package/models/operations/listthreedsconfigurations.d.ts +20 -0
  72. package/models/operations/listthreedsconfigurations.d.ts.map +1 -0
  73. package/models/operations/listthreedsconfigurations.js +55 -0
  74. package/models/operations/listthreedsconfigurations.js.map +1 -0
  75. package/models/operations/updatemerchantaccount.d.ts +1 -1
  76. package/models/operations/voidtransaction.d.ts +8 -3
  77. package/models/operations/voidtransaction.d.ts.map +1 -1
  78. package/models/operations/voidtransaction.js +7 -5
  79. package/models/operations/voidtransaction.js.map +1 -1
  80. package/package.json +1 -1
  81. package/sdk/merchantaccounts.d.ts +3 -0
  82. package/sdk/merchantaccounts.d.ts.map +1 -1
  83. package/sdk/merchantaccounts.js +4 -0
  84. package/sdk/merchantaccounts.js.map +1 -1
  85. package/sdk/threedsconfiguration.d.ts +33 -0
  86. package/sdk/threedsconfiguration.d.ts.map +1 -0
  87. package/sdk/threedsconfiguration.js +52 -0
  88. package/sdk/threedsconfiguration.js.map +1 -0
  89. package/sdk/transactions.d.ts +2 -2
  90. package/sdk/transactions.d.ts.map +1 -1
  91. package/sdk/transactions.js +4 -4
  92. package/sdk/transactions.js.map +1 -1
  93. package/src/funcs/merchantAccountsThreeDsConfigurationCreate.ts +255 -0
  94. package/src/funcs/merchantAccountsThreeDsConfigurationDelete.ts +252 -0
  95. package/src/funcs/merchantAccountsThreeDsConfigurationList.ts +262 -0
  96. package/src/funcs/merchantAccountsThreeDsConfigurationUpdate.ts +264 -0
  97. package/src/funcs/transactionsCapture.ts +13 -25
  98. package/src/funcs/transactionsVoid.ts +13 -4
  99. package/src/lib/config.ts +3 -3
  100. package/src/models/components/index.ts +4 -0
  101. package/src/models/components/merchantaccountthreedsconfiguration.ts +110 -0
  102. package/src/models/components/merchantaccountthreedsconfigurationcreate.ts +91 -0
  103. package/src/models/components/merchantaccountthreedsconfigurations.ts +39 -0
  104. package/src/models/components/merchantaccountthreedsconfigurationupdate.ts +94 -0
  105. package/src/models/operations/capturetransaction.ts +14 -7
  106. package/src/models/operations/createthreedsconfiguration.ts +50 -0
  107. package/src/models/operations/deletethreedsconfiguration.ts +48 -0
  108. package/src/models/operations/editthreedsconfiguration.ts +57 -0
  109. package/src/models/operations/getmerchantaccount.ts +1 -1
  110. package/src/models/operations/index.ts +4 -0
  111. package/src/models/operations/listthreedsconfigurations.ts +47 -0
  112. package/src/models/operations/updatemerchantaccount.ts +1 -1
  113. package/src/models/operations/voidtransaction.ts +19 -7
  114. package/src/sdk/merchantaccounts.ts +8 -0
  115. package/src/sdk/threedsconfiguration.ts +93 -0
  116. package/src/sdk/transactions.ts +6 -10
@@ -26,12 +26,16 @@ export type VoidTransactionRequest = {
26
26
  * The ID of the merchant account to use for this request.
27
27
  */
28
28
  merchantAccountId?: string | null | undefined;
29
+ /**
30
+ * A unique key that identifies this request. Providing this header will make this an idempotent request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions.
31
+ */
32
+ idempotencyKey?: string | null | undefined;
29
33
  };
30
34
 
31
35
  /**
32
36
  * Successful Response
33
37
  */
34
- export type VoidTransactionResponseVoidTransaction =
38
+ export type VoidTransactionResponse200VoidTransaction =
35
39
  | components.Transaction
36
40
  | components.TransactionVoid;
37
41
 
@@ -40,6 +44,7 @@ export type VoidTransactionRequest$Outbound = {
40
44
  transaction_id: string;
41
45
  prefer?: Array<string> | null | undefined;
42
46
  merchantAccountId?: string | null | undefined;
47
+ "idempotency-key"?: string | null | undefined;
43
48
  };
44
49
 
45
50
  /** @internal */
@@ -51,9 +56,11 @@ export const VoidTransactionRequest$outboundSchema: z.ZodType<
51
56
  transactionId: z.string(),
52
57
  prefer: z.nullable(z.array(z.string())).optional(),
53
58
  merchantAccountId: z.nullable(z.string()).optional(),
59
+ idempotencyKey: z.nullable(z.string()).optional(),
54
60
  }).transform((v) => {
55
61
  return remap$(v, {
56
62
  transactionId: "transaction_id",
63
+ idempotencyKey: "idempotency-key",
57
64
  });
58
65
  });
59
66
 
@@ -66,8 +73,8 @@ export function voidTransactionRequestToJSON(
66
73
  }
67
74
 
68
75
  /** @internal */
69
- export const VoidTransactionResponseVoidTransaction$inboundSchema: z.ZodType<
70
- VoidTransactionResponseVoidTransaction,
76
+ export const VoidTransactionResponse200VoidTransaction$inboundSchema: z.ZodType<
77
+ VoidTransactionResponse200VoidTransaction,
71
78
  z.ZodTypeDef,
72
79
  unknown
73
80
  > = z.union([
@@ -75,13 +82,18 @@ export const VoidTransactionResponseVoidTransaction$inboundSchema: z.ZodType<
75
82
  components.TransactionVoid$inboundSchema,
76
83
  ]);
77
84
 
78
- export function voidTransactionResponseVoidTransactionFromJSON(
85
+ export function voidTransactionResponse200VoidTransactionFromJSON(
79
86
  jsonString: string,
80
- ): SafeParseResult<VoidTransactionResponseVoidTransaction, SDKValidationError> {
87
+ ): SafeParseResult<
88
+ VoidTransactionResponse200VoidTransaction,
89
+ SDKValidationError
90
+ > {
81
91
  return safeParse(
82
92
  jsonString,
83
93
  (x) =>
84
- VoidTransactionResponseVoidTransaction$inboundSchema.parse(JSON.parse(x)),
85
- `Failed to parse 'VoidTransactionResponseVoidTransaction' from JSON`,
94
+ VoidTransactionResponse200VoidTransaction$inboundSchema.parse(
95
+ JSON.parse(x),
96
+ ),
97
+ `Failed to parse 'VoidTransactionResponse200VoidTransaction' from JSON`,
86
98
  );
87
99
  }
@@ -11,8 +11,16 @@ import * as components from "../models/components/index.js";
11
11
  import * as operations from "../models/operations/index.js";
12
12
  import { unwrapAsync } from "../types/fp.js";
13
13
  import { PageIterator, unwrapResultIterator } from "../types/operations.js";
14
+ import { ThreeDsConfiguration } from "./threedsconfiguration.js";
14
15
 
15
16
  export class MerchantAccounts extends ClientSDK {
17
+ private _threeDsConfiguration?: ThreeDsConfiguration;
18
+ get threeDsConfiguration(): ThreeDsConfiguration {
19
+ return (this._threeDsConfiguration ??= new ThreeDsConfiguration(
20
+ this._options,
21
+ ));
22
+ }
23
+
16
24
  /**
17
25
  * List all merchant accounts
18
26
  *
@@ -0,0 +1,93 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { merchantAccountsThreeDsConfigurationCreate } from "../funcs/merchantAccountsThreeDsConfigurationCreate.js";
6
+ import { merchantAccountsThreeDsConfigurationDelete } from "../funcs/merchantAccountsThreeDsConfigurationDelete.js";
7
+ import { merchantAccountsThreeDsConfigurationList } from "../funcs/merchantAccountsThreeDsConfigurationList.js";
8
+ import { merchantAccountsThreeDsConfigurationUpdate } from "../funcs/merchantAccountsThreeDsConfigurationUpdate.js";
9
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
10
+ import * as components from "../models/components/index.js";
11
+ import { unwrapAsync } from "../types/fp.js";
12
+
13
+ export class ThreeDsConfiguration extends ClientSDK {
14
+ /**
15
+ * Create 3DS configuration for merchant
16
+ *
17
+ * @remarks
18
+ * Create a new 3DS configuration for a merchant account.
19
+ */
20
+ async create(
21
+ merchantAccountThreeDSConfigurationCreate:
22
+ components.MerchantAccountThreeDSConfigurationCreate,
23
+ merchantAccountId: string,
24
+ options?: RequestOptions,
25
+ ): Promise<components.MerchantAccountThreeDSConfiguration> {
26
+ return unwrapAsync(merchantAccountsThreeDsConfigurationCreate(
27
+ this,
28
+ merchantAccountThreeDSConfigurationCreate,
29
+ merchantAccountId,
30
+ options,
31
+ ));
32
+ }
33
+
34
+ /**
35
+ * List 3DS configurations for merchant
36
+ *
37
+ * @remarks
38
+ * List all 3DS configurations for a merchant account.
39
+ */
40
+ async list(
41
+ merchantAccountId: string,
42
+ currency?: string | null | undefined,
43
+ options?: RequestOptions,
44
+ ): Promise<components.MerchantAccountThreeDSConfigurations> {
45
+ return unwrapAsync(merchantAccountsThreeDsConfigurationList(
46
+ this,
47
+ merchantAccountId,
48
+ currency,
49
+ options,
50
+ ));
51
+ }
52
+
53
+ /**
54
+ * Edit 3DS configuration
55
+ *
56
+ * @remarks
57
+ * Update the 3DS configuration for a merchant account.
58
+ */
59
+ async update(
60
+ merchantAccountThreeDSConfigurationUpdate:
61
+ components.MerchantAccountThreeDSConfigurationUpdate,
62
+ merchantAccountId: string,
63
+ threeDsConfigurationId: string,
64
+ options?: RequestOptions,
65
+ ): Promise<components.MerchantAccountThreeDSConfiguration> {
66
+ return unwrapAsync(merchantAccountsThreeDsConfigurationUpdate(
67
+ this,
68
+ merchantAccountThreeDSConfigurationUpdate,
69
+ merchantAccountId,
70
+ threeDsConfigurationId,
71
+ options,
72
+ ));
73
+ }
74
+
75
+ /**
76
+ * Delete 3DS configuration for a merchant
77
+ *
78
+ * @remarks
79
+ * Delete a 3DS configuration for a merchant account.
80
+ */
81
+ async delete(
82
+ merchantAccountId: string,
83
+ threeDsConfigurationId: string,
84
+ options?: RequestOptions,
85
+ ): Promise<void> {
86
+ return unwrapAsync(merchantAccountsThreeDsConfigurationDelete(
87
+ this,
88
+ merchantAccountId,
89
+ threeDsConfigurationId,
90
+ options,
91
+ ));
92
+ }
93
+ }
@@ -130,18 +130,12 @@ export class Transactions extends ClientSDK {
130
130
  * Captures a previously authorized transaction. You can capture the full or a partial amount, as long as it does not exceed the authorized amount (unless over-capture is enabled).
131
131
  */
132
132
  async capture(
133
- transactionCaptureCreate: components.TransactionCaptureCreate,
134
- transactionId: string,
135
- prefer?: Array<string> | null | undefined,
136
- merchantAccountId?: string | null | undefined,
133
+ request: operations.CaptureTransactionRequest,
137
134
  options?: RequestOptions,
138
- ): Promise<operations.CaptureTransactionResponseCaptureTransaction> {
135
+ ): Promise<operations.CaptureTransactionResponse200CaptureTransaction> {
139
136
  return unwrapAsync(transactionsCapture(
140
137
  this,
141
- transactionCaptureCreate,
142
- transactionId,
143
- prefer,
144
- merchantAccountId,
138
+ request,
145
139
  options,
146
140
  ));
147
141
  }
@@ -156,13 +150,15 @@ export class Transactions extends ClientSDK {
156
150
  transactionId: string,
157
151
  prefer?: Array<string> | null | undefined,
158
152
  merchantAccountId?: string | null | undefined,
153
+ idempotencyKey?: string | null | undefined,
159
154
  options?: RequestOptions,
160
- ): Promise<operations.VoidTransactionResponseVoidTransaction> {
155
+ ): Promise<operations.VoidTransactionResponse200VoidTransaction> {
161
156
  return unwrapAsync(transactionsVoid(
162
157
  this,
163
158
  transactionId,
164
159
  prefer,
165
160
  merchantAccountId,
161
+ idempotencyKey,
166
162
  options,
167
163
  ));
168
164
  }