@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.
- 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/lib/config.js.map +1 -1
- package/models/components/braintreedynamicdatafieldsoptions.d.ts +25 -0
- package/models/components/braintreedynamicdatafieldsoptions.d.ts.map +1 -1
- package/models/components/braintreedynamicdatafieldsoptions.js +32 -1
- package/models/components/braintreedynamicdatafieldsoptions.js.map +1 -1
- 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/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/braintreedynamicdatafieldsoptions.ts +58 -0
- package/src/models/components/cancelstatus.ts +49 -0
- package/src/models/components/index.ts +2 -0
- 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.39",
|
|
81
|
+
genVersion: "2.687.13",
|
|
82
|
+
userAgent: "speakeasy-sdk/typescript 1.1.39 2.687.13 1.0.0 @gr4vy/sdk",
|
|
83
83
|
} as const;
|
|
@@ -5,9 +5,22 @@
|
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import {
|
|
9
|
+
catchUnrecognizedEnum,
|
|
10
|
+
OpenEnum,
|
|
11
|
+
Unrecognized,
|
|
12
|
+
} from "../../types/enums.js";
|
|
8
13
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
14
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
15
|
|
|
16
|
+
export const VaultPaymentMethodCriteria = {
|
|
17
|
+
Always: "ALWAYS",
|
|
18
|
+
OnSuccessfulTransaction: "ON_SUCCESSFUL_TRANSACTION",
|
|
19
|
+
} as const;
|
|
20
|
+
export type VaultPaymentMethodCriteria = OpenEnum<
|
|
21
|
+
typeof VaultPaymentMethodCriteria
|
|
22
|
+
>;
|
|
23
|
+
|
|
11
24
|
export type BraintreeDynamicDataFieldsOptions = {
|
|
12
25
|
/**
|
|
13
26
|
* Passes the 3DS status to the Braintree API using `customFields` with the key set to the value of `three_ds_auth_status`
|
|
@@ -17,8 +30,44 @@ export type BraintreeDynamicDataFieldsOptions = {
|
|
|
17
30
|
* Passes the `transaction.purchaseOrderNumber` field when creating a new transaction.
|
|
18
31
|
*/
|
|
19
32
|
purchaseOrderNumber?: string | null | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Passes the `vaultPaymentMethodCriteria` field when creating a new transaction.
|
|
35
|
+
*/
|
|
36
|
+
vaultPaymentMethodCriteria?: VaultPaymentMethodCriteria | null | undefined;
|
|
20
37
|
};
|
|
21
38
|
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const VaultPaymentMethodCriteria$inboundSchema: z.ZodType<
|
|
41
|
+
VaultPaymentMethodCriteria,
|
|
42
|
+
z.ZodTypeDef,
|
|
43
|
+
unknown
|
|
44
|
+
> = z
|
|
45
|
+
.union([
|
|
46
|
+
z.nativeEnum(VaultPaymentMethodCriteria),
|
|
47
|
+
z.string().transform(catchUnrecognizedEnum),
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const VaultPaymentMethodCriteria$outboundSchema: z.ZodType<
|
|
52
|
+
VaultPaymentMethodCriteria,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
VaultPaymentMethodCriteria
|
|
55
|
+
> = z.union([
|
|
56
|
+
z.nativeEnum(VaultPaymentMethodCriteria),
|
|
57
|
+
z.string().and(z.custom<Unrecognized<string>>()),
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
63
|
+
*/
|
|
64
|
+
export namespace VaultPaymentMethodCriteria$ {
|
|
65
|
+
/** @deprecated use `VaultPaymentMethodCriteria$inboundSchema` instead. */
|
|
66
|
+
export const inboundSchema = VaultPaymentMethodCriteria$inboundSchema;
|
|
67
|
+
/** @deprecated use `VaultPaymentMethodCriteria$outboundSchema` instead. */
|
|
68
|
+
export const outboundSchema = VaultPaymentMethodCriteria$outboundSchema;
|
|
69
|
+
}
|
|
70
|
+
|
|
22
71
|
/** @internal */
|
|
23
72
|
export const BraintreeDynamicDataFieldsOptions$inboundSchema: z.ZodType<
|
|
24
73
|
BraintreeDynamicDataFieldsOptions,
|
|
@@ -27,10 +76,14 @@ export const BraintreeDynamicDataFieldsOptions$inboundSchema: z.ZodType<
|
|
|
27
76
|
> = z.object({
|
|
28
77
|
three_ds_auth_status: z.nullable(z.string()).optional(),
|
|
29
78
|
purchase_order_number: z.nullable(z.string()).optional(),
|
|
79
|
+
vault_payment_method_criteria: z.nullable(
|
|
80
|
+
VaultPaymentMethodCriteria$inboundSchema,
|
|
81
|
+
).optional(),
|
|
30
82
|
}).transform((v) => {
|
|
31
83
|
return remap$(v, {
|
|
32
84
|
"three_ds_auth_status": "threeDsAuthStatus",
|
|
33
85
|
"purchase_order_number": "purchaseOrderNumber",
|
|
86
|
+
"vault_payment_method_criteria": "vaultPaymentMethodCriteria",
|
|
34
87
|
});
|
|
35
88
|
});
|
|
36
89
|
|
|
@@ -38,6 +91,7 @@ export const BraintreeDynamicDataFieldsOptions$inboundSchema: z.ZodType<
|
|
|
38
91
|
export type BraintreeDynamicDataFieldsOptions$Outbound = {
|
|
39
92
|
three_ds_auth_status?: string | null | undefined;
|
|
40
93
|
purchase_order_number?: string | null | undefined;
|
|
94
|
+
vault_payment_method_criteria?: string | null | undefined;
|
|
41
95
|
};
|
|
42
96
|
|
|
43
97
|
/** @internal */
|
|
@@ -48,10 +102,14 @@ export const BraintreeDynamicDataFieldsOptions$outboundSchema: z.ZodType<
|
|
|
48
102
|
> = z.object({
|
|
49
103
|
threeDsAuthStatus: z.nullable(z.string()).optional(),
|
|
50
104
|
purchaseOrderNumber: z.nullable(z.string()).optional(),
|
|
105
|
+
vaultPaymentMethodCriteria: z.nullable(
|
|
106
|
+
VaultPaymentMethodCriteria$outboundSchema,
|
|
107
|
+
).optional(),
|
|
51
108
|
}).transform((v) => {
|
|
52
109
|
return remap$(v, {
|
|
53
110
|
threeDsAuthStatus: "three_ds_auth_status",
|
|
54
111
|
purchaseOrderNumber: "purchase_order_number",
|
|
112
|
+
vaultPaymentMethodCriteria: "vault_payment_method_criteria",
|
|
55
113
|
});
|
|
56
114
|
});
|
|
57
115
|
|
|
@@ -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";
|
|
@@ -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:
|