@gr4vy/sdk 1.1.37 → 1.1.39

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 (53) hide show
  1. package/README.md +2 -0
  2. package/docs/sdks/transactions/README.md +94 -0
  3. package/funcs/transactionsCancel.d.ts +18 -0
  4. package/funcs/transactionsCancel.d.ts.map +1 -0
  5. package/funcs/transactionsCancel.js +144 -0
  6. package/funcs/transactionsCancel.js.map +1 -0
  7. package/jsr.json +1 -1
  8. package/lib/config.d.ts +3 -3
  9. package/lib/config.js +3 -3
  10. package/lib/config.js.map +1 -1
  11. package/models/components/braintreedynamicdatafieldsoptions.d.ts +25 -0
  12. package/models/components/braintreedynamicdatafieldsoptions.d.ts.map +1 -1
  13. package/models/components/braintreedynamicdatafieldsoptions.js +32 -1
  14. package/models/components/braintreedynamicdatafieldsoptions.js.map +1 -1
  15. package/models/components/cancelstatus.d.ts +23 -0
  16. package/models/components/cancelstatus.d.ts.map +1 -0
  17. package/models/components/cancelstatus.js +69 -0
  18. package/models/components/cancelstatus.js.map +1 -0
  19. package/models/components/index.d.ts +2 -0
  20. package/models/components/index.d.ts.map +1 -1
  21. package/models/components/index.js +2 -0
  22. package/models/components/index.js.map +1 -1
  23. package/models/components/transactioncancel.d.ts +56 -0
  24. package/models/components/transactioncancel.d.ts.map +1 -0
  25. package/models/components/transactioncancel.js +92 -0
  26. package/models/components/transactioncancel.js.map +1 -0
  27. package/models/components/transactionevent.d.ts +1 -0
  28. package/models/components/transactionevent.d.ts.map +1 -1
  29. package/models/components/transactionevent.js +1 -0
  30. package/models/components/transactionevent.js.map +1 -1
  31. package/models/operations/canceltransaction.d.ts +62 -0
  32. package/models/operations/canceltransaction.d.ts.map +1 -0
  33. package/models/operations/canceltransaction.js +107 -0
  34. package/models/operations/canceltransaction.js.map +1 -0
  35. package/models/operations/index.d.ts +1 -0
  36. package/models/operations/index.d.ts.map +1 -1
  37. package/models/operations/index.js +1 -0
  38. package/models/operations/index.js.map +1 -1
  39. package/package.json +1 -1
  40. package/sdk/transactions.d.ts +7 -0
  41. package/sdk/transactions.d.ts.map +1 -1
  42. package/sdk/transactions.js +10 -0
  43. package/sdk/transactions.js.map +1 -1
  44. package/src/funcs/transactionsCancel.ts +248 -0
  45. package/src/lib/config.ts +3 -3
  46. package/src/models/components/braintreedynamicdatafieldsoptions.ts +58 -0
  47. package/src/models/components/cancelstatus.ts +49 -0
  48. package/src/models/components/index.ts +2 -0
  49. package/src/models/components/transactioncancel.ts +123 -0
  50. package/src/models/components/transactionevent.ts +2 -0
  51. package/src/models/operations/canceltransaction.ts +143 -0
  52. package/src/models/operations/index.ts +1 -0
  53. package/src/sdk/transactions.ts +20 -0
@@ -0,0 +1,143 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type CancelTransactionGlobals = {
12
+ merchantAccountId?: string | undefined;
13
+ };
14
+
15
+ export type CancelTransactionRequest = {
16
+ /**
17
+ * The ID of the transaction
18
+ */
19
+ transactionId: string;
20
+ /**
21
+ * The ID of the merchant account to use for this request.
22
+ */
23
+ merchantAccountId?: string | null | undefined;
24
+ };
25
+
26
+ /** @internal */
27
+ export const CancelTransactionGlobals$inboundSchema: z.ZodType<
28
+ CancelTransactionGlobals,
29
+ z.ZodTypeDef,
30
+ unknown
31
+ > = z.object({
32
+ merchantAccountId: z.string().optional(),
33
+ });
34
+
35
+ /** @internal */
36
+ export type CancelTransactionGlobals$Outbound = {
37
+ merchantAccountId?: string | undefined;
38
+ };
39
+
40
+ /** @internal */
41
+ export const CancelTransactionGlobals$outboundSchema: z.ZodType<
42
+ CancelTransactionGlobals$Outbound,
43
+ z.ZodTypeDef,
44
+ CancelTransactionGlobals
45
+ > = z.object({
46
+ merchantAccountId: z.string().optional(),
47
+ });
48
+
49
+ /**
50
+ * @internal
51
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
52
+ */
53
+ export namespace CancelTransactionGlobals$ {
54
+ /** @deprecated use `CancelTransactionGlobals$inboundSchema` instead. */
55
+ export const inboundSchema = CancelTransactionGlobals$inboundSchema;
56
+ /** @deprecated use `CancelTransactionGlobals$outboundSchema` instead. */
57
+ export const outboundSchema = CancelTransactionGlobals$outboundSchema;
58
+ /** @deprecated use `CancelTransactionGlobals$Outbound` instead. */
59
+ export type Outbound = CancelTransactionGlobals$Outbound;
60
+ }
61
+
62
+ export function cancelTransactionGlobalsToJSON(
63
+ cancelTransactionGlobals: CancelTransactionGlobals,
64
+ ): string {
65
+ return JSON.stringify(
66
+ CancelTransactionGlobals$outboundSchema.parse(cancelTransactionGlobals),
67
+ );
68
+ }
69
+
70
+ export function cancelTransactionGlobalsFromJSON(
71
+ jsonString: string,
72
+ ): SafeParseResult<CancelTransactionGlobals, SDKValidationError> {
73
+ return safeParse(
74
+ jsonString,
75
+ (x) => CancelTransactionGlobals$inboundSchema.parse(JSON.parse(x)),
76
+ `Failed to parse 'CancelTransactionGlobals' from JSON`,
77
+ );
78
+ }
79
+
80
+ /** @internal */
81
+ export const CancelTransactionRequest$inboundSchema: z.ZodType<
82
+ CancelTransactionRequest,
83
+ z.ZodTypeDef,
84
+ unknown
85
+ > = z.object({
86
+ transaction_id: z.string(),
87
+ merchantAccountId: z.nullable(z.string()).optional(),
88
+ }).transform((v) => {
89
+ return remap$(v, {
90
+ "transaction_id": "transactionId",
91
+ });
92
+ });
93
+
94
+ /** @internal */
95
+ export type CancelTransactionRequest$Outbound = {
96
+ transaction_id: string;
97
+ merchantAccountId?: string | null | undefined;
98
+ };
99
+
100
+ /** @internal */
101
+ export const CancelTransactionRequest$outboundSchema: z.ZodType<
102
+ CancelTransactionRequest$Outbound,
103
+ z.ZodTypeDef,
104
+ CancelTransactionRequest
105
+ > = z.object({
106
+ transactionId: z.string(),
107
+ merchantAccountId: z.nullable(z.string()).optional(),
108
+ }).transform((v) => {
109
+ return remap$(v, {
110
+ transactionId: "transaction_id",
111
+ });
112
+ });
113
+
114
+ /**
115
+ * @internal
116
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
117
+ */
118
+ export namespace CancelTransactionRequest$ {
119
+ /** @deprecated use `CancelTransactionRequest$inboundSchema` instead. */
120
+ export const inboundSchema = CancelTransactionRequest$inboundSchema;
121
+ /** @deprecated use `CancelTransactionRequest$outboundSchema` instead. */
122
+ export const outboundSchema = CancelTransactionRequest$outboundSchema;
123
+ /** @deprecated use `CancelTransactionRequest$Outbound` instead. */
124
+ export type Outbound = CancelTransactionRequest$Outbound;
125
+ }
126
+
127
+ export function cancelTransactionRequestToJSON(
128
+ cancelTransactionRequest: CancelTransactionRequest,
129
+ ): string {
130
+ return JSON.stringify(
131
+ CancelTransactionRequest$outboundSchema.parse(cancelTransactionRequest),
132
+ );
133
+ }
134
+
135
+ export function cancelTransactionRequestFromJSON(
136
+ jsonString: string,
137
+ ): SafeParseResult<CancelTransactionRequest, SDKValidationError> {
138
+ return safeParse(
139
+ jsonString,
140
+ (x) => CancelTransactionRequest$inboundSchema.parse(JSON.parse(x)),
141
+ `Failed to parse 'CancelTransactionRequest' from JSON`,
142
+ );
143
+ }
@@ -6,6 +6,7 @@ export * from "./addbuyer.js";
6
6
  export * from "./addbuyershippingdetails.js";
7
7
  export * from "./addpaymentlink.js";
8
8
  export * from "./addreport.js";
9
+ export * from "./canceltransaction.js";
9
10
  export * from "./capturetransaction.js";
10
11
  export * from "./configuredigitalwallet.js";
11
12
  export * from "./createaccountupdaterjob.js";
@@ -2,6 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { transactionsCancel } from "../funcs/transactionsCancel.js";
5
6
  import { transactionsCapture } from "../funcs/transactionsCapture.js";
6
7
  import { transactionsCreate } from "../funcs/transactionsCreate.js";
7
8
  import { transactionsGet } from "../funcs/transactionsGet.js";
@@ -160,6 +161,25 @@ export class Transactions extends ClientSDK {
160
161
  ));
161
162
  }
162
163
 
164
+ /**
165
+ * Cancel transaction
166
+ *
167
+ * @remarks
168
+ * Cancels a pending transaction. If the transaction was successfully authorized, or was already captured, the cancel will not be processed.
169
+ */
170
+ async cancel(
171
+ transactionId: string,
172
+ merchantAccountId?: string | null | undefined,
173
+ options?: RequestOptions,
174
+ ): Promise<components.TransactionCancel> {
175
+ return unwrapAsync(transactionsCancel(
176
+ this,
177
+ transactionId,
178
+ merchantAccountId,
179
+ options,
180
+ ));
181
+ }
182
+
163
183
  /**
164
184
  * Sync transaction
165
185
  *