@gr4vy/sdk 1.1.7 → 1.1.8
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/README.md +2 -0
- package/docs/sdks/transactions/README.md +94 -0
- package/funcs/transactionsUpdate.d.ts +18 -0
- package/funcs/transactionsUpdate.d.ts.map +1 -0
- package/funcs/transactionsUpdate.js +136 -0
- package/funcs/transactionsUpdate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/index.d.ts +1 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +1 -0
- package/models/components/index.js.map +1 -1
- package/models/components/transactionupdate.d.ts +54 -0
- package/models/components/transactionupdate.d.ts.map +1 -0
- package/models/components/transactionupdate.js +74 -0
- package/models/components/transactionupdate.js.map +1 -0
- package/models/operations/index.d.ts +1 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/updatetransaction.d.ts +65 -0
- package/models/operations/updatetransaction.d.ts.map +1 -0
- package/models/operations/updatetransaction.js +102 -0
- package/models/operations/updatetransaction.js.map +1 -0
- package/package.json +1 -1
- package/sdk/transactions.d.ts +7 -0
- package/sdk/transactions.d.ts.map +1 -1
- package/sdk/transactions.js +10 -0
- package/sdk/transactions.js.map +1 -1
- package/src/funcs/transactionsUpdate.ts +253 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/index.ts +1 -0
- package/src/models/components/transactionupdate.ts +94 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/updatetransaction.ts +150 -0
- package/src/sdk/transactions.ts +22 -0
|
@@ -0,0 +1,150 @@
|
|
|
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 * as components from "../components/index.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export type UpdateTransactionGlobals = {
|
|
13
|
+
merchantAccountId?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type UpdateTransactionRequest = {
|
|
17
|
+
/**
|
|
18
|
+
* The ID of the transaction
|
|
19
|
+
*/
|
|
20
|
+
transactionId: string;
|
|
21
|
+
/**
|
|
22
|
+
* The ID of the merchant account to use for this request.
|
|
23
|
+
*/
|
|
24
|
+
merchantAccountId?: string | null | undefined;
|
|
25
|
+
transactionUpdate: components.TransactionUpdate;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const UpdateTransactionGlobals$inboundSchema: z.ZodType<
|
|
30
|
+
UpdateTransactionGlobals,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
unknown
|
|
33
|
+
> = z.object({
|
|
34
|
+
merchantAccountId: z.string().optional(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type UpdateTransactionGlobals$Outbound = {
|
|
39
|
+
merchantAccountId?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const UpdateTransactionGlobals$outboundSchema: z.ZodType<
|
|
44
|
+
UpdateTransactionGlobals$Outbound,
|
|
45
|
+
z.ZodTypeDef,
|
|
46
|
+
UpdateTransactionGlobals
|
|
47
|
+
> = z.object({
|
|
48
|
+
merchantAccountId: z.string().optional(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
54
|
+
*/
|
|
55
|
+
export namespace UpdateTransactionGlobals$ {
|
|
56
|
+
/** @deprecated use `UpdateTransactionGlobals$inboundSchema` instead. */
|
|
57
|
+
export const inboundSchema = UpdateTransactionGlobals$inboundSchema;
|
|
58
|
+
/** @deprecated use `UpdateTransactionGlobals$outboundSchema` instead. */
|
|
59
|
+
export const outboundSchema = UpdateTransactionGlobals$outboundSchema;
|
|
60
|
+
/** @deprecated use `UpdateTransactionGlobals$Outbound` instead. */
|
|
61
|
+
export type Outbound = UpdateTransactionGlobals$Outbound;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function updateTransactionGlobalsToJSON(
|
|
65
|
+
updateTransactionGlobals: UpdateTransactionGlobals,
|
|
66
|
+
): string {
|
|
67
|
+
return JSON.stringify(
|
|
68
|
+
UpdateTransactionGlobals$outboundSchema.parse(updateTransactionGlobals),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function updateTransactionGlobalsFromJSON(
|
|
73
|
+
jsonString: string,
|
|
74
|
+
): SafeParseResult<UpdateTransactionGlobals, SDKValidationError> {
|
|
75
|
+
return safeParse(
|
|
76
|
+
jsonString,
|
|
77
|
+
(x) => UpdateTransactionGlobals$inboundSchema.parse(JSON.parse(x)),
|
|
78
|
+
`Failed to parse 'UpdateTransactionGlobals' from JSON`,
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** @internal */
|
|
83
|
+
export const UpdateTransactionRequest$inboundSchema: z.ZodType<
|
|
84
|
+
UpdateTransactionRequest,
|
|
85
|
+
z.ZodTypeDef,
|
|
86
|
+
unknown
|
|
87
|
+
> = z.object({
|
|
88
|
+
transaction_id: z.string(),
|
|
89
|
+
merchantAccountId: z.nullable(z.string()).optional(),
|
|
90
|
+
TransactionUpdate: components.TransactionUpdate$inboundSchema,
|
|
91
|
+
}).transform((v) => {
|
|
92
|
+
return remap$(v, {
|
|
93
|
+
"transaction_id": "transactionId",
|
|
94
|
+
"TransactionUpdate": "transactionUpdate",
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
/** @internal */
|
|
99
|
+
export type UpdateTransactionRequest$Outbound = {
|
|
100
|
+
transaction_id: string;
|
|
101
|
+
merchantAccountId?: string | null | undefined;
|
|
102
|
+
TransactionUpdate: components.TransactionUpdate$Outbound;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/** @internal */
|
|
106
|
+
export const UpdateTransactionRequest$outboundSchema: z.ZodType<
|
|
107
|
+
UpdateTransactionRequest$Outbound,
|
|
108
|
+
z.ZodTypeDef,
|
|
109
|
+
UpdateTransactionRequest
|
|
110
|
+
> = z.object({
|
|
111
|
+
transactionId: z.string(),
|
|
112
|
+
merchantAccountId: z.nullable(z.string()).optional(),
|
|
113
|
+
transactionUpdate: components.TransactionUpdate$outboundSchema,
|
|
114
|
+
}).transform((v) => {
|
|
115
|
+
return remap$(v, {
|
|
116
|
+
transactionId: "transaction_id",
|
|
117
|
+
transactionUpdate: "TransactionUpdate",
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @internal
|
|
123
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
124
|
+
*/
|
|
125
|
+
export namespace UpdateTransactionRequest$ {
|
|
126
|
+
/** @deprecated use `UpdateTransactionRequest$inboundSchema` instead. */
|
|
127
|
+
export const inboundSchema = UpdateTransactionRequest$inboundSchema;
|
|
128
|
+
/** @deprecated use `UpdateTransactionRequest$outboundSchema` instead. */
|
|
129
|
+
export const outboundSchema = UpdateTransactionRequest$outboundSchema;
|
|
130
|
+
/** @deprecated use `UpdateTransactionRequest$Outbound` instead. */
|
|
131
|
+
export type Outbound = UpdateTransactionRequest$Outbound;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function updateTransactionRequestToJSON(
|
|
135
|
+
updateTransactionRequest: UpdateTransactionRequest,
|
|
136
|
+
): string {
|
|
137
|
+
return JSON.stringify(
|
|
138
|
+
UpdateTransactionRequest$outboundSchema.parse(updateTransactionRequest),
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function updateTransactionRequestFromJSON(
|
|
143
|
+
jsonString: string,
|
|
144
|
+
): SafeParseResult<UpdateTransactionRequest, SDKValidationError> {
|
|
145
|
+
return safeParse(
|
|
146
|
+
jsonString,
|
|
147
|
+
(x) => UpdateTransactionRequest$inboundSchema.parse(JSON.parse(x)),
|
|
148
|
+
`Failed to parse 'UpdateTransactionRequest' from JSON`,
|
|
149
|
+
);
|
|
150
|
+
}
|
package/src/sdk/transactions.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { transactionsCreate } from "../funcs/transactionsCreate.js";
|
|
|
7
7
|
import { transactionsGet } from "../funcs/transactionsGet.js";
|
|
8
8
|
import { transactionsList } from "../funcs/transactionsList.js";
|
|
9
9
|
import { transactionsSync } from "../funcs/transactionsSync.js";
|
|
10
|
+
import { transactionsUpdate } from "../funcs/transactionsUpdate.js";
|
|
10
11
|
import { transactionsVoid } from "../funcs/transactionsVoid.js";
|
|
11
12
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
12
13
|
import * as components from "../models/components/index.js";
|
|
@@ -94,6 +95,27 @@ export class Transactions extends ClientSDK {
|
|
|
94
95
|
));
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Manually update a transaction
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* Manually updates a transaction.
|
|
103
|
+
*/
|
|
104
|
+
async update(
|
|
105
|
+
transactionUpdate: components.TransactionUpdate,
|
|
106
|
+
transactionId: string,
|
|
107
|
+
merchantAccountId?: string | null | undefined,
|
|
108
|
+
options?: RequestOptions,
|
|
109
|
+
): Promise<components.Transaction> {
|
|
110
|
+
return unwrapAsync(transactionsUpdate(
|
|
111
|
+
this,
|
|
112
|
+
transactionUpdate,
|
|
113
|
+
transactionId,
|
|
114
|
+
merchantAccountId,
|
|
115
|
+
options,
|
|
116
|
+
));
|
|
117
|
+
}
|
|
118
|
+
|
|
97
119
|
/**
|
|
98
120
|
* Capture transaction
|
|
99
121
|
*
|