@gr4vy/sdk 1.1.38 → 1.1.40
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/transactionsCancel.d.ts +18 -0
- package/funcs/transactionsCancel.d.ts.map +1 -0
- package/funcs/transactionsCancel.js +144 -0
- package/funcs/transactionsCancel.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/cancelstatus.d.ts +23 -0
- package/models/components/cancelstatus.d.ts.map +1 -0
- package/models/components/cancelstatus.js +69 -0
- package/models/components/cancelstatus.js.map +1 -0
- package/models/components/index.d.ts +2 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +2 -0
- package/models/components/index.js.map +1 -1
- package/models/components/settlement.d.ts +15 -15
- package/models/components/settlement.d.ts.map +1 -1
- package/models/components/settlement.js +2 -2
- package/models/components/settlement.js.map +1 -1
- package/models/components/transactioncancel.d.ts +56 -0
- package/models/components/transactioncancel.d.ts.map +1 -0
- package/models/components/transactioncancel.js +92 -0
- package/models/components/transactioncancel.js.map +1 -0
- package/models/components/transactionevent.d.ts +1 -0
- package/models/components/transactionevent.d.ts.map +1 -1
- package/models/components/transactionevent.js +1 -0
- package/models/components/transactionevent.js.map +1 -1
- package/models/operations/canceltransaction.d.ts +62 -0
- package/models/operations/canceltransaction.d.ts.map +1 -0
- package/models/operations/canceltransaction.js +107 -0
- package/models/operations/canceltransaction.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/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/transactionsCancel.ts +248 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/cancelstatus.ts +49 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/settlement.ts +17 -17
- package/src/models/components/transactioncancel.ts +123 -0
- package/src/models/components/transactionevent.ts +2 -0
- package/src/models/operations/canceltransaction.ts +143 -0
- package/src/models/operations/index.ts +1 -0
- package/src/sdk/transactions.ts +20 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Gr4vyCore } from "../core.js";
|
|
6
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { Gr4vyError } from "../models/errors/gr4vyerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Cancel transaction
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Cancels a pending transaction. If the transaction was successfully authorized, or was already captured, the cancel will not be processed.
|
|
34
|
+
*/
|
|
35
|
+
export function transactionsCancel(
|
|
36
|
+
client: Gr4vyCore,
|
|
37
|
+
transactionId: string,
|
|
38
|
+
merchantAccountId?: string | null | undefined,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
components.TransactionCancel,
|
|
43
|
+
| errors.Error400
|
|
44
|
+
| errors.Error401
|
|
45
|
+
| errors.Error403
|
|
46
|
+
| errors.Error404
|
|
47
|
+
| errors.Error405
|
|
48
|
+
| errors.Error409
|
|
49
|
+
| errors.HTTPValidationError
|
|
50
|
+
| errors.Error425
|
|
51
|
+
| errors.Error429
|
|
52
|
+
| errors.Error500
|
|
53
|
+
| errors.Error502
|
|
54
|
+
| errors.Error504
|
|
55
|
+
| Gr4vyError
|
|
56
|
+
| ResponseValidationError
|
|
57
|
+
| ConnectionError
|
|
58
|
+
| RequestAbortedError
|
|
59
|
+
| RequestTimeoutError
|
|
60
|
+
| InvalidRequestError
|
|
61
|
+
| UnexpectedClientError
|
|
62
|
+
| SDKValidationError
|
|
63
|
+
>
|
|
64
|
+
> {
|
|
65
|
+
return new APIPromise($do(
|
|
66
|
+
client,
|
|
67
|
+
transactionId,
|
|
68
|
+
merchantAccountId,
|
|
69
|
+
options,
|
|
70
|
+
));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function $do(
|
|
74
|
+
client: Gr4vyCore,
|
|
75
|
+
transactionId: string,
|
|
76
|
+
merchantAccountId?: string | null | undefined,
|
|
77
|
+
options?: RequestOptions,
|
|
78
|
+
): Promise<
|
|
79
|
+
[
|
|
80
|
+
Result<
|
|
81
|
+
components.TransactionCancel,
|
|
82
|
+
| errors.Error400
|
|
83
|
+
| errors.Error401
|
|
84
|
+
| errors.Error403
|
|
85
|
+
| errors.Error404
|
|
86
|
+
| errors.Error405
|
|
87
|
+
| errors.Error409
|
|
88
|
+
| errors.HTTPValidationError
|
|
89
|
+
| errors.Error425
|
|
90
|
+
| errors.Error429
|
|
91
|
+
| errors.Error500
|
|
92
|
+
| errors.Error502
|
|
93
|
+
| errors.Error504
|
|
94
|
+
| Gr4vyError
|
|
95
|
+
| ResponseValidationError
|
|
96
|
+
| ConnectionError
|
|
97
|
+
| RequestAbortedError
|
|
98
|
+
| RequestTimeoutError
|
|
99
|
+
| InvalidRequestError
|
|
100
|
+
| UnexpectedClientError
|
|
101
|
+
| SDKValidationError
|
|
102
|
+
>,
|
|
103
|
+
APICall,
|
|
104
|
+
]
|
|
105
|
+
> {
|
|
106
|
+
const input: operations.CancelTransactionRequest = {
|
|
107
|
+
transactionId: transactionId,
|
|
108
|
+
merchantAccountId: merchantAccountId,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const parsed = safeParse(
|
|
112
|
+
input,
|
|
113
|
+
(value) => operations.CancelTransactionRequest$outboundSchema.parse(value),
|
|
114
|
+
"Input validation failed",
|
|
115
|
+
);
|
|
116
|
+
if (!parsed.ok) {
|
|
117
|
+
return [parsed, { status: "invalid" }];
|
|
118
|
+
}
|
|
119
|
+
const payload = parsed.value;
|
|
120
|
+
const body = null;
|
|
121
|
+
|
|
122
|
+
const pathParams = {
|
|
123
|
+
transaction_id: encodeSimple("transaction_id", payload.transaction_id, {
|
|
124
|
+
explode: false,
|
|
125
|
+
charEncoding: "percent",
|
|
126
|
+
}),
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const path = pathToFunc("/transactions/{transaction_id}/cancel")(pathParams);
|
|
130
|
+
|
|
131
|
+
const headers = new Headers(compactMap({
|
|
132
|
+
Accept: "application/json",
|
|
133
|
+
"x-gr4vy-merchant-account-id": encodeSimple(
|
|
134
|
+
"x-gr4vy-merchant-account-id",
|
|
135
|
+
payload.merchantAccountId ?? client._options.merchantAccountId,
|
|
136
|
+
{ explode: false, charEncoding: "none" },
|
|
137
|
+
),
|
|
138
|
+
}));
|
|
139
|
+
|
|
140
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
141
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
142
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
143
|
+
|
|
144
|
+
const context = {
|
|
145
|
+
options: client._options,
|
|
146
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
147
|
+
operationID: "cancel_transaction",
|
|
148
|
+
oAuth2Scopes: [],
|
|
149
|
+
|
|
150
|
+
resolvedSecurity: requestSecurity,
|
|
151
|
+
|
|
152
|
+
securitySource: client._options.bearerAuth,
|
|
153
|
+
retryConfig: options?.retries
|
|
154
|
+
|| client._options.retryConfig
|
|
155
|
+
|| { strategy: "none" },
|
|
156
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const requestRes = client._createRequest(context, {
|
|
160
|
+
security: requestSecurity,
|
|
161
|
+
method: "POST",
|
|
162
|
+
baseURL: options?.serverURL,
|
|
163
|
+
path: path,
|
|
164
|
+
headers: headers,
|
|
165
|
+
body: body,
|
|
166
|
+
userAgent: client._options.userAgent,
|
|
167
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
168
|
+
}, options);
|
|
169
|
+
if (!requestRes.ok) {
|
|
170
|
+
return [requestRes, { status: "invalid" }];
|
|
171
|
+
}
|
|
172
|
+
const req = requestRes.value;
|
|
173
|
+
|
|
174
|
+
const doResult = await client._do(req, {
|
|
175
|
+
context,
|
|
176
|
+
errorCodes: [
|
|
177
|
+
"400",
|
|
178
|
+
"401",
|
|
179
|
+
"403",
|
|
180
|
+
"404",
|
|
181
|
+
"405",
|
|
182
|
+
"409",
|
|
183
|
+
"422",
|
|
184
|
+
"425",
|
|
185
|
+
"429",
|
|
186
|
+
"4XX",
|
|
187
|
+
"500",
|
|
188
|
+
"502",
|
|
189
|
+
"504",
|
|
190
|
+
"5XX",
|
|
191
|
+
],
|
|
192
|
+
retryConfig: context.retryConfig,
|
|
193
|
+
retryCodes: context.retryCodes,
|
|
194
|
+
});
|
|
195
|
+
if (!doResult.ok) {
|
|
196
|
+
return [doResult, { status: "request-error", request: req }];
|
|
197
|
+
}
|
|
198
|
+
const response = doResult.value;
|
|
199
|
+
|
|
200
|
+
const responseFields = {
|
|
201
|
+
HttpMeta: { Response: response, Request: req },
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const [result] = await M.match<
|
|
205
|
+
components.TransactionCancel,
|
|
206
|
+
| errors.Error400
|
|
207
|
+
| errors.Error401
|
|
208
|
+
| errors.Error403
|
|
209
|
+
| errors.Error404
|
|
210
|
+
| errors.Error405
|
|
211
|
+
| errors.Error409
|
|
212
|
+
| errors.HTTPValidationError
|
|
213
|
+
| errors.Error425
|
|
214
|
+
| errors.Error429
|
|
215
|
+
| errors.Error500
|
|
216
|
+
| errors.Error502
|
|
217
|
+
| errors.Error504
|
|
218
|
+
| Gr4vyError
|
|
219
|
+
| ResponseValidationError
|
|
220
|
+
| ConnectionError
|
|
221
|
+
| RequestAbortedError
|
|
222
|
+
| RequestTimeoutError
|
|
223
|
+
| InvalidRequestError
|
|
224
|
+
| UnexpectedClientError
|
|
225
|
+
| SDKValidationError
|
|
226
|
+
>(
|
|
227
|
+
M.json(200, components.TransactionCancel$inboundSchema),
|
|
228
|
+
M.jsonErr(400, errors.Error400$inboundSchema),
|
|
229
|
+
M.jsonErr(401, errors.Error401$inboundSchema),
|
|
230
|
+
M.jsonErr(403, errors.Error403$inboundSchema),
|
|
231
|
+
M.jsonErr(404, errors.Error404$inboundSchema),
|
|
232
|
+
M.jsonErr(405, errors.Error405$inboundSchema),
|
|
233
|
+
M.jsonErr(409, errors.Error409$inboundSchema),
|
|
234
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
235
|
+
M.jsonErr(425, errors.Error425$inboundSchema),
|
|
236
|
+
M.jsonErr(429, errors.Error429$inboundSchema),
|
|
237
|
+
M.jsonErr(500, errors.Error500$inboundSchema),
|
|
238
|
+
M.jsonErr(502, errors.Error502$inboundSchema),
|
|
239
|
+
M.jsonErr(504, errors.Error504$inboundSchema),
|
|
240
|
+
M.fail("4XX"),
|
|
241
|
+
M.fail("5XX"),
|
|
242
|
+
)(response, req, { extraFields: responseFields });
|
|
243
|
+
if (!result.ok) {
|
|
244
|
+
return [result, { status: "complete", request: req, response }];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return [result, { status: "complete", request: req, response }];
|
|
248
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -77,7 +77,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
77
77
|
export const SDK_METADATA = {
|
|
78
78
|
language: "typescript",
|
|
79
79
|
openapiDocVersion: "1.0.0",
|
|
80
|
-
sdkVersion: "1.1.
|
|
81
|
-
genVersion: "2.
|
|
82
|
-
userAgent: "speakeasy-sdk/typescript 1.1.
|
|
80
|
+
sdkVersion: "1.1.40",
|
|
81
|
+
genVersion: "2.690.1",
|
|
82
|
+
userAgent: "speakeasy-sdk/typescript 1.1.40 2.690.1 1.0.0 @gr4vy/sdk",
|
|
83
83
|
} as const;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import {
|
|
7
|
+
catchUnrecognizedEnum,
|
|
8
|
+
OpenEnum,
|
|
9
|
+
Unrecognized,
|
|
10
|
+
} from "../../types/enums.js";
|
|
11
|
+
|
|
12
|
+
export const CancelStatus = {
|
|
13
|
+
Succeeded: "succeeded",
|
|
14
|
+
Pending: "pending",
|
|
15
|
+
Failed: "failed",
|
|
16
|
+
} as const;
|
|
17
|
+
export type CancelStatus = OpenEnum<typeof CancelStatus>;
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const CancelStatus$inboundSchema: z.ZodType<
|
|
21
|
+
CancelStatus,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
unknown
|
|
24
|
+
> = z
|
|
25
|
+
.union([
|
|
26
|
+
z.nativeEnum(CancelStatus),
|
|
27
|
+
z.string().transform(catchUnrecognizedEnum),
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const CancelStatus$outboundSchema: z.ZodType<
|
|
32
|
+
CancelStatus,
|
|
33
|
+
z.ZodTypeDef,
|
|
34
|
+
CancelStatus
|
|
35
|
+
> = z.union([
|
|
36
|
+
z.nativeEnum(CancelStatus),
|
|
37
|
+
z.string().and(z.custom<Unrecognized<string>>()),
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
43
|
+
*/
|
|
44
|
+
export namespace CancelStatus$ {
|
|
45
|
+
/** @deprecated use `CancelStatus$inboundSchema` instead. */
|
|
46
|
+
export const inboundSchema = CancelStatus$inboundSchema;
|
|
47
|
+
/** @deprecated use `CancelStatus$outboundSchema` instead. */
|
|
48
|
+
export const outboundSchema = CancelStatus$outboundSchema;
|
|
49
|
+
}
|
|
@@ -38,6 +38,7 @@ export * from "./buyer.js";
|
|
|
38
38
|
export * from "./buyercreate.js";
|
|
39
39
|
export * from "./buyers.js";
|
|
40
40
|
export * from "./buyerupdate.js";
|
|
41
|
+
export * from "./cancelstatus.js";
|
|
41
42
|
export * from "./capturestatus.js";
|
|
42
43
|
export * from "./cardpaymentmethodcreate.js";
|
|
43
44
|
export * from "./cardscheme.js";
|
|
@@ -220,6 +221,7 @@ export * from "./threedsecurev2.js";
|
|
|
220
221
|
export * from "./tokenpaymentmethodcreate.js";
|
|
221
222
|
export * from "./transaction.js";
|
|
222
223
|
export * from "./transactionbuyer.js";
|
|
224
|
+
export * from "./transactioncancel.js";
|
|
223
225
|
export * from "./transactioncapture.js";
|
|
224
226
|
export * from "./transactioncapturecreate.js";
|
|
225
227
|
export * from "./transactionconnectionoptions.js";
|
|
@@ -13,43 +13,39 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
13
13
|
*/
|
|
14
14
|
export type Settlement = {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
type?: "settlement" | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* The unique identifier for the settlement.
|
|
16
|
+
* The unique identifier for the record.
|
|
21
17
|
*/
|
|
22
18
|
id: string;
|
|
23
19
|
/**
|
|
24
|
-
* The merchant account this
|
|
20
|
+
* The merchant account this record belongs to.
|
|
25
21
|
*/
|
|
26
22
|
merchantAccountId: string;
|
|
27
23
|
/**
|
|
28
|
-
* The date and time the
|
|
24
|
+
* The date and time the record was created, in ISO 8601 format.
|
|
29
25
|
*/
|
|
30
26
|
createdAt: Date;
|
|
31
27
|
/**
|
|
32
|
-
* The date and time the
|
|
28
|
+
* The date and time the record was last updated, in ISO 8601 format.
|
|
33
29
|
*/
|
|
34
30
|
updatedAt: Date;
|
|
35
31
|
/**
|
|
36
|
-
* The date and time the
|
|
32
|
+
* The date and time the record was posted, in ISO 8601 format.
|
|
37
33
|
*/
|
|
38
34
|
postedAt: Date;
|
|
39
35
|
/**
|
|
40
|
-
* The date and time the
|
|
36
|
+
* The date and time the record was ingested, in ISO 8601 format.
|
|
41
37
|
*/
|
|
42
38
|
ingestedAt: Date;
|
|
43
39
|
/**
|
|
44
|
-
* ISO 4217 currency code
|
|
40
|
+
* ISO 4217 currency code.
|
|
45
41
|
*/
|
|
46
42
|
currency: string;
|
|
47
43
|
/**
|
|
48
|
-
* The total
|
|
44
|
+
* The total amount in the smallest currency unit (e.g. cents).
|
|
49
45
|
*/
|
|
50
46
|
amount: number;
|
|
51
47
|
/**
|
|
52
|
-
* The exchange rate
|
|
48
|
+
* The exchange rate, if applicable.
|
|
53
49
|
*/
|
|
54
50
|
exchangeRate?: number | null | undefined;
|
|
55
51
|
/**
|
|
@@ -77,9 +73,13 @@ export type Settlement = {
|
|
|
77
73
|
*/
|
|
78
74
|
paymentServiceReportFileIds: Array<string>;
|
|
79
75
|
/**
|
|
80
|
-
* The transaction this
|
|
76
|
+
* The transaction this record is associated with.
|
|
81
77
|
*/
|
|
82
78
|
transactionId: string;
|
|
79
|
+
/**
|
|
80
|
+
* Always `settlement`.
|
|
81
|
+
*/
|
|
82
|
+
type?: "settlement" | undefined;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
/** @internal */
|
|
@@ -88,7 +88,6 @@ export const Settlement$inboundSchema: z.ZodType<
|
|
|
88
88
|
z.ZodTypeDef,
|
|
89
89
|
unknown
|
|
90
90
|
> = z.object({
|
|
91
|
-
type: z.literal("settlement").default("settlement"),
|
|
92
91
|
id: z.string(),
|
|
93
92
|
merchant_account_id: z.string(),
|
|
94
93
|
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
@@ -107,6 +106,7 @@ export const Settlement$inboundSchema: z.ZodType<
|
|
|
107
106
|
payment_service_report_id: z.string(),
|
|
108
107
|
payment_service_report_file_ids: z.array(z.string()),
|
|
109
108
|
transaction_id: z.string(),
|
|
109
|
+
type: z.literal("settlement").default("settlement"),
|
|
110
110
|
}).transform((v) => {
|
|
111
111
|
return remap$(v, {
|
|
112
112
|
"merchant_account_id": "merchantAccountId",
|
|
@@ -124,7 +124,6 @@ export const Settlement$inboundSchema: z.ZodType<
|
|
|
124
124
|
|
|
125
125
|
/** @internal */
|
|
126
126
|
export type Settlement$Outbound = {
|
|
127
|
-
type: "settlement";
|
|
128
127
|
id: string;
|
|
129
128
|
merchant_account_id: string;
|
|
130
129
|
created_at: string;
|
|
@@ -141,6 +140,7 @@ export type Settlement$Outbound = {
|
|
|
141
140
|
payment_service_report_id: string;
|
|
142
141
|
payment_service_report_file_ids: Array<string>;
|
|
143
142
|
transaction_id: string;
|
|
143
|
+
type: "settlement";
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
/** @internal */
|
|
@@ -149,7 +149,6 @@ export const Settlement$outboundSchema: z.ZodType<
|
|
|
149
149
|
z.ZodTypeDef,
|
|
150
150
|
Settlement
|
|
151
151
|
> = z.object({
|
|
152
|
-
type: z.literal("settlement").default("settlement" as const),
|
|
153
152
|
id: z.string(),
|
|
154
153
|
merchantAccountId: z.string(),
|
|
155
154
|
createdAt: z.date().transform(v => v.toISOString()),
|
|
@@ -166,6 +165,7 @@ export const Settlement$outboundSchema: z.ZodType<
|
|
|
166
165
|
paymentServiceReportId: z.string(),
|
|
167
166
|
paymentServiceReportFileIds: z.array(z.string()),
|
|
168
167
|
transactionId: z.string(),
|
|
168
|
+
type: z.literal("settlement").default("settlement" as const),
|
|
169
169
|
}).transform((v) => {
|
|
170
170
|
return remap$(v, {
|
|
171
171
|
merchantAccountId: "merchant_account_id",
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
import {
|
|
11
|
+
CancelStatus,
|
|
12
|
+
CancelStatus$inboundSchema,
|
|
13
|
+
CancelStatus$outboundSchema,
|
|
14
|
+
} from "./cancelstatus.js";
|
|
15
|
+
import {
|
|
16
|
+
Transaction,
|
|
17
|
+
Transaction$inboundSchema,
|
|
18
|
+
Transaction$Outbound,
|
|
19
|
+
Transaction$outboundSchema,
|
|
20
|
+
} from "./transaction.js";
|
|
21
|
+
|
|
22
|
+
export type TransactionCancel = {
|
|
23
|
+
/**
|
|
24
|
+
* Always `transaction-cancel`.
|
|
25
|
+
*/
|
|
26
|
+
type?: "transaction-cancel" | undefined;
|
|
27
|
+
status: CancelStatus;
|
|
28
|
+
/**
|
|
29
|
+
* The standardized error code set by Gr4vy.
|
|
30
|
+
*/
|
|
31
|
+
code: string | null;
|
|
32
|
+
/**
|
|
33
|
+
* This is the response code received from the payment service. This can be set to any value and is not standardized across different payment services.
|
|
34
|
+
*/
|
|
35
|
+
rawResponseCode: string | null;
|
|
36
|
+
/**
|
|
37
|
+
* This is the response description received from the payment service. This can be set to any value and is not standardized across different payment services.
|
|
38
|
+
*/
|
|
39
|
+
rawResponseDescription: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* A full transaction resource.
|
|
42
|
+
*/
|
|
43
|
+
transaction: Transaction;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const TransactionCancel$inboundSchema: z.ZodType<
|
|
48
|
+
TransactionCancel,
|
|
49
|
+
z.ZodTypeDef,
|
|
50
|
+
unknown
|
|
51
|
+
> = z.object({
|
|
52
|
+
type: z.literal("transaction-cancel").default("transaction-cancel"),
|
|
53
|
+
status: CancelStatus$inboundSchema,
|
|
54
|
+
code: z.nullable(z.string()),
|
|
55
|
+
raw_response_code: z.nullable(z.string()),
|
|
56
|
+
raw_response_description: z.nullable(z.string()),
|
|
57
|
+
transaction: Transaction$inboundSchema,
|
|
58
|
+
}).transform((v) => {
|
|
59
|
+
return remap$(v, {
|
|
60
|
+
"raw_response_code": "rawResponseCode",
|
|
61
|
+
"raw_response_description": "rawResponseDescription",
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/** @internal */
|
|
66
|
+
export type TransactionCancel$Outbound = {
|
|
67
|
+
type: "transaction-cancel";
|
|
68
|
+
status: string;
|
|
69
|
+
code: string | null;
|
|
70
|
+
raw_response_code: string | null;
|
|
71
|
+
raw_response_description: string | null;
|
|
72
|
+
transaction: Transaction$Outbound;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const TransactionCancel$outboundSchema: z.ZodType<
|
|
77
|
+
TransactionCancel$Outbound,
|
|
78
|
+
z.ZodTypeDef,
|
|
79
|
+
TransactionCancel
|
|
80
|
+
> = z.object({
|
|
81
|
+
type: z.literal("transaction-cancel").default("transaction-cancel" as const),
|
|
82
|
+
status: CancelStatus$outboundSchema,
|
|
83
|
+
code: z.nullable(z.string()),
|
|
84
|
+
rawResponseCode: z.nullable(z.string()),
|
|
85
|
+
rawResponseDescription: z.nullable(z.string()),
|
|
86
|
+
transaction: Transaction$outboundSchema,
|
|
87
|
+
}).transform((v) => {
|
|
88
|
+
return remap$(v, {
|
|
89
|
+
rawResponseCode: "raw_response_code",
|
|
90
|
+
rawResponseDescription: "raw_response_description",
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @internal
|
|
96
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
97
|
+
*/
|
|
98
|
+
export namespace TransactionCancel$ {
|
|
99
|
+
/** @deprecated use `TransactionCancel$inboundSchema` instead. */
|
|
100
|
+
export const inboundSchema = TransactionCancel$inboundSchema;
|
|
101
|
+
/** @deprecated use `TransactionCancel$outboundSchema` instead. */
|
|
102
|
+
export const outboundSchema = TransactionCancel$outboundSchema;
|
|
103
|
+
/** @deprecated use `TransactionCancel$Outbound` instead. */
|
|
104
|
+
export type Outbound = TransactionCancel$Outbound;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function transactionCancelToJSON(
|
|
108
|
+
transactionCancel: TransactionCancel,
|
|
109
|
+
): string {
|
|
110
|
+
return JSON.stringify(
|
|
111
|
+
TransactionCancel$outboundSchema.parse(transactionCancel),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function transactionCancelFromJSON(
|
|
116
|
+
jsonString: string,
|
|
117
|
+
): SafeParseResult<TransactionCancel, SDKValidationError> {
|
|
118
|
+
return safeParse(
|
|
119
|
+
jsonString,
|
|
120
|
+
(x) => TransactionCancel$inboundSchema.parse(JSON.parse(x)),
|
|
121
|
+
`Failed to parse 'TransactionCancel' from JSON`,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
@@ -57,6 +57,8 @@ export const Name = {
|
|
|
57
57
|
"payment-connector-response-transaction-capture-declined",
|
|
58
58
|
PaymentConnectorResponseTransactionCancelSucceeded:
|
|
59
59
|
"payment-connector-response-transaction-cancel-succeeded",
|
|
60
|
+
PaymentConnectorResponseTransactionCancelPending:
|
|
61
|
+
"payment-connector-response-transaction-cancel-pending",
|
|
60
62
|
PaymentConnectorResponseTransactionCancelFailed:
|
|
61
63
|
"payment-connector-response-transaction-cancel-failed",
|
|
62
64
|
PaymentConnectorResponseTransactionVoidSucceeded:
|