@gr4vy/sdk 1.1.6 → 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/listtransactions.d.ts +3 -3
- package/models/operations/listtransactions.d.ts.map +1 -1
- package/models/operations/listtransactions.js +2 -2
- package/models/operations/listtransactions.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/listtransactions.ts +5 -5
- package/src/models/operations/updatetransaction.ts +150 -0
- package/src/sdk/transactions.ts +22 -0
|
@@ -0,0 +1,94 @@
|
|
|
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 TransactionUpdate = {
|
|
12
|
+
/**
|
|
13
|
+
* An external identifier that can be used to match the transaction against your own records.
|
|
14
|
+
*/
|
|
15
|
+
externalIdentifier?: string | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Additional information about the transaction stored as key-value pairs. If provided, the whole value will be overridden.
|
|
18
|
+
*/
|
|
19
|
+
metadata?: { [k: string]: string } | null | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Allows for passing optional configuration per connection to take advantage of connection specific features. When provided, the data is only passed to the target connection type to prevent sharing configuration across connections. Please note that each of the keys this object are in kebab-case, for example `cybersource-anti-fraud` as they represent the ID of the connector. All the other keys will be snake case, for example `merchant_defined_data` or camel case to match an external API that the connector uses. If provided, the whole value will be overridden.
|
|
22
|
+
*/
|
|
23
|
+
connectionOptions?: { [k: string]: { [k: string]: any } } | null | undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const TransactionUpdate$inboundSchema: z.ZodType<
|
|
28
|
+
TransactionUpdate,
|
|
29
|
+
z.ZodTypeDef,
|
|
30
|
+
unknown
|
|
31
|
+
> = z.object({
|
|
32
|
+
external_identifier: z.nullable(z.string()).optional(),
|
|
33
|
+
metadata: z.nullable(z.record(z.string())).optional(),
|
|
34
|
+
connection_options: z.nullable(z.record(z.record(z.any()))).optional(),
|
|
35
|
+
}).transform((v) => {
|
|
36
|
+
return remap$(v, {
|
|
37
|
+
"external_identifier": "externalIdentifier",
|
|
38
|
+
"connection_options": "connectionOptions",
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export type TransactionUpdate$Outbound = {
|
|
44
|
+
external_identifier?: string | null | undefined;
|
|
45
|
+
metadata?: { [k: string]: string } | null | undefined;
|
|
46
|
+
connection_options?: { [k: string]: { [k: string]: any } } | null | undefined;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** @internal */
|
|
50
|
+
export const TransactionUpdate$outboundSchema: z.ZodType<
|
|
51
|
+
TransactionUpdate$Outbound,
|
|
52
|
+
z.ZodTypeDef,
|
|
53
|
+
TransactionUpdate
|
|
54
|
+
> = z.object({
|
|
55
|
+
externalIdentifier: z.nullable(z.string()).optional(),
|
|
56
|
+
metadata: z.nullable(z.record(z.string())).optional(),
|
|
57
|
+
connectionOptions: z.nullable(z.record(z.record(z.any()))).optional(),
|
|
58
|
+
}).transform((v) => {
|
|
59
|
+
return remap$(v, {
|
|
60
|
+
externalIdentifier: "external_identifier",
|
|
61
|
+
connectionOptions: "connection_options",
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
68
|
+
*/
|
|
69
|
+
export namespace TransactionUpdate$ {
|
|
70
|
+
/** @deprecated use `TransactionUpdate$inboundSchema` instead. */
|
|
71
|
+
export const inboundSchema = TransactionUpdate$inboundSchema;
|
|
72
|
+
/** @deprecated use `TransactionUpdate$outboundSchema` instead. */
|
|
73
|
+
export const outboundSchema = TransactionUpdate$outboundSchema;
|
|
74
|
+
/** @deprecated use `TransactionUpdate$Outbound` instead. */
|
|
75
|
+
export type Outbound = TransactionUpdate$Outbound;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function transactionUpdateToJSON(
|
|
79
|
+
transactionUpdate: TransactionUpdate,
|
|
80
|
+
): string {
|
|
81
|
+
return JSON.stringify(
|
|
82
|
+
TransactionUpdate$outboundSchema.parse(transactionUpdate),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function transactionUpdateFromJSON(
|
|
87
|
+
jsonString: string,
|
|
88
|
+
): SafeParseResult<TransactionUpdate, SDKValidationError> {
|
|
89
|
+
return safeParse(
|
|
90
|
+
jsonString,
|
|
91
|
+
(x) => TransactionUpdate$inboundSchema.parse(JSON.parse(x)),
|
|
92
|
+
`Failed to parse 'TransactionUpdate' from JSON`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -89,5 +89,6 @@ export * from "./updatedigitalwallet.js";
|
|
|
89
89
|
export * from "./updatemerchantaccount.js";
|
|
90
90
|
export * from "./updatepaymentservice.js";
|
|
91
91
|
export * from "./updatereport.js";
|
|
92
|
+
export * from "./updatetransaction.js";
|
|
92
93
|
export * from "./verifypaymentservicecredentials.js";
|
|
93
94
|
export * from "./voidtransaction.js";
|
|
@@ -85,9 +85,9 @@ export type ListTransactionsRequest = {
|
|
|
85
85
|
paymentMethodId?: string | null | undefined;
|
|
86
86
|
paymentMethodLabel?: string | null | undefined;
|
|
87
87
|
/**
|
|
88
|
-
* Filters for transactions
|
|
88
|
+
* Filters for transactions where the `payment_method_scheme` matches one of the provided values.
|
|
89
89
|
*/
|
|
90
|
-
paymentMethodScheme?: string | null | undefined;
|
|
90
|
+
paymentMethodScheme?: Array<string> | null | undefined;
|
|
91
91
|
/**
|
|
92
92
|
* Filters for transactions that have a payment method with a country that matches with the provided value.
|
|
93
93
|
*/
|
|
@@ -257,7 +257,7 @@ export const ListTransactionsRequest$inboundSchema: z.ZodType<
|
|
|
257
257
|
payment_service_id: z.nullable(z.array(z.string())).optional(),
|
|
258
258
|
payment_method_id: z.nullable(z.string()).optional(),
|
|
259
259
|
payment_method_label: z.nullable(z.string()).optional(),
|
|
260
|
-
payment_method_scheme: z.nullable(z.string()).optional(),
|
|
260
|
+
payment_method_scheme: z.nullable(z.array(z.string())).optional(),
|
|
261
261
|
payment_method_country: z.nullable(z.string()).optional(),
|
|
262
262
|
payment_method_fingerprint: z.nullable(z.string()).optional(),
|
|
263
263
|
method: z.nullable(z.array(components.Method$inboundSchema)).optional(),
|
|
@@ -344,7 +344,7 @@ export type ListTransactionsRequest$Outbound = {
|
|
|
344
344
|
payment_service_id?: Array<string> | null | undefined;
|
|
345
345
|
payment_method_id?: string | null | undefined;
|
|
346
346
|
payment_method_label?: string | null | undefined;
|
|
347
|
-
payment_method_scheme?: string | null | undefined;
|
|
347
|
+
payment_method_scheme?: Array<string> | null | undefined;
|
|
348
348
|
payment_method_country?: string | null | undefined;
|
|
349
349
|
payment_method_fingerprint?: string | null | undefined;
|
|
350
350
|
method?: Array<string> | null | undefined;
|
|
@@ -397,7 +397,7 @@ export const ListTransactionsRequest$outboundSchema: z.ZodType<
|
|
|
397
397
|
paymentServiceId: z.nullable(z.array(z.string())).optional(),
|
|
398
398
|
paymentMethodId: z.nullable(z.string()).optional(),
|
|
399
399
|
paymentMethodLabel: z.nullable(z.string()).optional(),
|
|
400
|
-
paymentMethodScheme: z.nullable(z.string()).optional(),
|
|
400
|
+
paymentMethodScheme: z.nullable(z.array(z.string())).optional(),
|
|
401
401
|
paymentMethodCountry: z.nullable(z.string()).optional(),
|
|
402
402
|
paymentMethodFingerprint: z.nullable(z.string()).optional(),
|
|
403
403
|
method: z.nullable(z.array(components.Method$outboundSchema)).optional(),
|
|
@@ -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
|
*
|