@gr4vy/sdk 2.3.28 → 2.4.0
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 +5 -0
- package/funcs/giftCardsIssuancesCreate.d.ts +18 -0
- package/funcs/giftCardsIssuancesCreate.d.ts.map +1 -0
- package/funcs/giftCardsIssuancesCreate.js +129 -0
- package/funcs/giftCardsIssuancesCreate.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/giftcardissuance.d.ts +51 -0
- package/models/components/giftcardissuance.d.ts.map +1 -0
- package/models/components/giftcardissuance.js +71 -0
- package/models/components/giftcardissuance.js.map +1 -0
- package/models/components/giftcardissuancecreate.d.ts +33 -0
- package/models/components/giftcardissuancecreate.d.ts.map +1 -0
- package/models/components/giftcardissuancecreate.js +57 -0
- package/models/components/giftcardissuancecreate.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/merchantaccount.d.ts +12 -0
- package/models/components/merchantaccount.d.ts.map +1 -1
- package/models/components/merchantaccount.js.map +1 -1
- package/models/components/merchantaccountcreate.d.ts +12 -0
- package/models/components/merchantaccountcreate.d.ts.map +1 -1
- package/models/components/merchantaccountcreate.js.map +1 -1
- package/models/components/merchantaccountupdate.d.ts +12 -0
- package/models/components/merchantaccountupdate.d.ts.map +1 -1
- package/models/components/merchantaccountupdate.js.map +1 -1
- package/models/components/transactionevent.d.ts +2 -0
- package/models/components/transactionevent.d.ts.map +1 -1
- package/models/components/transactionevent.js +2 -0
- package/models/components/transactionevent.js.map +1 -1
- 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/issuegiftcard.d.ts +26 -0
- package/models/operations/issuegiftcard.d.ts.map +1 -0
- package/models/operations/issuegiftcard.js +58 -0
- package/models/operations/issuegiftcard.js.map +1 -0
- package/package.json +1 -1
- package/sdk/giftcards.d.ts +3 -0
- package/sdk/giftcards.d.ts.map +1 -1
- package/sdk/giftcards.js +4 -0
- package/sdk/giftcards.js.map +1 -1
- package/sdk/issuances.d.ts +12 -0
- package/sdk/issuances.d.ts.map +1 -0
- package/sdk/issuances.js +22 -0
- package/sdk/issuances.js.map +1 -0
- package/src/funcs/giftCardsIssuancesCreate.ts +240 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/giftcardissuance.ts +95 -0
- package/src/models/components/giftcardissuancecreate.ts +60 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/merchantaccount.ts +12 -0
- package/src/models/components/merchantaccountcreate.ts +12 -0
- package/src/models/components/merchantaccountupdate.ts +12 -0
- package/src/models/components/transactionevent.ts +2 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/issuegiftcard.ts +54 -0
- package/src/sdk/giftcards.ts +6 -0
- package/src/sdk/issuances.ts +31 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Gr4vyCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import * as components from "../models/components/index.js";
|
|
15
|
+
import { Gr4vyError } from "../models/errors/gr4vyerror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Issue a gift card
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Issue a new virtual gift card through the primary gift card service.
|
|
35
|
+
*/
|
|
36
|
+
export function giftCardsIssuancesCreate(
|
|
37
|
+
client: Gr4vyCore,
|
|
38
|
+
giftCardIssuanceCreate: components.GiftCardIssuanceCreate,
|
|
39
|
+
idempotencyKey?: string | null | undefined,
|
|
40
|
+
merchantAccountId?: string | null | undefined,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
components.GiftCardIssuance,
|
|
45
|
+
| errors.Error400
|
|
46
|
+
| errors.Error401
|
|
47
|
+
| errors.Error403
|
|
48
|
+
| errors.Error404
|
|
49
|
+
| errors.Error405
|
|
50
|
+
| errors.Error409
|
|
51
|
+
| errors.HTTPValidationError
|
|
52
|
+
| errors.Error425
|
|
53
|
+
| errors.Error429
|
|
54
|
+
| errors.Error500
|
|
55
|
+
| errors.Error502
|
|
56
|
+
| errors.Error504
|
|
57
|
+
| Gr4vyError
|
|
58
|
+
| ResponseValidationError
|
|
59
|
+
| ConnectionError
|
|
60
|
+
| RequestAbortedError
|
|
61
|
+
| RequestTimeoutError
|
|
62
|
+
| InvalidRequestError
|
|
63
|
+
| UnexpectedClientError
|
|
64
|
+
| SDKValidationError
|
|
65
|
+
>
|
|
66
|
+
> {
|
|
67
|
+
return new APIPromise($do(
|
|
68
|
+
client,
|
|
69
|
+
giftCardIssuanceCreate,
|
|
70
|
+
idempotencyKey,
|
|
71
|
+
merchantAccountId,
|
|
72
|
+
options,
|
|
73
|
+
));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function $do(
|
|
77
|
+
client: Gr4vyCore,
|
|
78
|
+
giftCardIssuanceCreate: components.GiftCardIssuanceCreate,
|
|
79
|
+
idempotencyKey?: string | null | undefined,
|
|
80
|
+
merchantAccountId?: string | null | undefined,
|
|
81
|
+
options?: RequestOptions,
|
|
82
|
+
): Promise<
|
|
83
|
+
[
|
|
84
|
+
Result<
|
|
85
|
+
components.GiftCardIssuance,
|
|
86
|
+
| errors.Error400
|
|
87
|
+
| errors.Error401
|
|
88
|
+
| errors.Error403
|
|
89
|
+
| errors.Error404
|
|
90
|
+
| errors.Error405
|
|
91
|
+
| errors.Error409
|
|
92
|
+
| errors.HTTPValidationError
|
|
93
|
+
| errors.Error425
|
|
94
|
+
| errors.Error429
|
|
95
|
+
| errors.Error500
|
|
96
|
+
| errors.Error502
|
|
97
|
+
| errors.Error504
|
|
98
|
+
| Gr4vyError
|
|
99
|
+
| ResponseValidationError
|
|
100
|
+
| ConnectionError
|
|
101
|
+
| RequestAbortedError
|
|
102
|
+
| RequestTimeoutError
|
|
103
|
+
| InvalidRequestError
|
|
104
|
+
| UnexpectedClientError
|
|
105
|
+
| SDKValidationError
|
|
106
|
+
>,
|
|
107
|
+
APICall,
|
|
108
|
+
]
|
|
109
|
+
> {
|
|
110
|
+
const input: operations.IssueGiftCardRequest = {
|
|
111
|
+
giftCardIssuanceCreate: giftCardIssuanceCreate,
|
|
112
|
+
idempotencyKey: idempotencyKey,
|
|
113
|
+
merchantAccountId: merchantAccountId,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const parsed = safeParse(
|
|
117
|
+
input,
|
|
118
|
+
(value) => operations.IssueGiftCardRequest$outboundSchema.parse(value),
|
|
119
|
+
"Input validation failed",
|
|
120
|
+
);
|
|
121
|
+
if (!parsed.ok) {
|
|
122
|
+
return [parsed, { status: "invalid" }];
|
|
123
|
+
}
|
|
124
|
+
const payload = parsed.value;
|
|
125
|
+
const body = encodeJSON("body", payload.GiftCardIssuanceCreate, {
|
|
126
|
+
explode: true,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const path = pathToFunc("/gift-cards/issuances")();
|
|
130
|
+
|
|
131
|
+
const headers = new Headers(compactMap({
|
|
132
|
+
"Content-Type": "application/json",
|
|
133
|
+
Accept: "application/json",
|
|
134
|
+
"idempotency-key": encodeSimple(
|
|
135
|
+
"idempotency-key",
|
|
136
|
+
payload["idempotency-key"],
|
|
137
|
+
{ explode: false, charEncoding: "none" },
|
|
138
|
+
),
|
|
139
|
+
"x-gr4vy-merchant-account-id": encodeSimple(
|
|
140
|
+
"x-gr4vy-merchant-account-id",
|
|
141
|
+
payload.merchantAccountId ?? client._options.merchantAccountId,
|
|
142
|
+
{ explode: false, charEncoding: "none" },
|
|
143
|
+
),
|
|
144
|
+
}));
|
|
145
|
+
|
|
146
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
147
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
148
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
149
|
+
|
|
150
|
+
const context = {
|
|
151
|
+
options: client._options,
|
|
152
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
153
|
+
operationID: "issue_gift_card",
|
|
154
|
+
oAuth2Scopes: null,
|
|
155
|
+
|
|
156
|
+
resolvedSecurity: requestSecurity,
|
|
157
|
+
|
|
158
|
+
securitySource: client._options.bearerAuth,
|
|
159
|
+
retryConfig: options?.retries
|
|
160
|
+
|| client._options.retryConfig
|
|
161
|
+
|| { strategy: "none" },
|
|
162
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const requestRes = client._createRequest(context, {
|
|
166
|
+
security: requestSecurity,
|
|
167
|
+
method: "POST",
|
|
168
|
+
baseURL: options?.serverURL,
|
|
169
|
+
path: path,
|
|
170
|
+
headers: headers,
|
|
171
|
+
body: body,
|
|
172
|
+
userAgent: client._options.userAgent,
|
|
173
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
174
|
+
}, options);
|
|
175
|
+
if (!requestRes.ok) {
|
|
176
|
+
return [requestRes, { status: "invalid" }];
|
|
177
|
+
}
|
|
178
|
+
const req = requestRes.value;
|
|
179
|
+
|
|
180
|
+
const doResult = await client._do(req, {
|
|
181
|
+
context,
|
|
182
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
183
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
184
|
+
retryConfig: context.retryConfig,
|
|
185
|
+
retryCodes: context.retryCodes,
|
|
186
|
+
});
|
|
187
|
+
if (!doResult.ok) {
|
|
188
|
+
return [doResult, { status: "request-error", request: req }];
|
|
189
|
+
}
|
|
190
|
+
const response = doResult.value;
|
|
191
|
+
|
|
192
|
+
const responseFields = {
|
|
193
|
+
HttpMeta: { Response: response, Request: req },
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const [result] = await M.match<
|
|
197
|
+
components.GiftCardIssuance,
|
|
198
|
+
| errors.Error400
|
|
199
|
+
| errors.Error401
|
|
200
|
+
| errors.Error403
|
|
201
|
+
| errors.Error404
|
|
202
|
+
| errors.Error405
|
|
203
|
+
| errors.Error409
|
|
204
|
+
| errors.HTTPValidationError
|
|
205
|
+
| errors.Error425
|
|
206
|
+
| errors.Error429
|
|
207
|
+
| errors.Error500
|
|
208
|
+
| errors.Error502
|
|
209
|
+
| errors.Error504
|
|
210
|
+
| Gr4vyError
|
|
211
|
+
| ResponseValidationError
|
|
212
|
+
| ConnectionError
|
|
213
|
+
| RequestAbortedError
|
|
214
|
+
| RequestTimeoutError
|
|
215
|
+
| InvalidRequestError
|
|
216
|
+
| UnexpectedClientError
|
|
217
|
+
| SDKValidationError
|
|
218
|
+
>(
|
|
219
|
+
M.json(201, components.GiftCardIssuance$inboundSchema),
|
|
220
|
+
M.jsonErr(400, errors.Error400$inboundSchema),
|
|
221
|
+
M.jsonErr(401, errors.Error401$inboundSchema),
|
|
222
|
+
M.jsonErr(403, errors.Error403$inboundSchema),
|
|
223
|
+
M.jsonErr(404, errors.Error404$inboundSchema),
|
|
224
|
+
M.jsonErr(405, errors.Error405$inboundSchema),
|
|
225
|
+
M.jsonErr(409, errors.Error409$inboundSchema),
|
|
226
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
227
|
+
M.jsonErr(425, errors.Error425$inboundSchema),
|
|
228
|
+
M.jsonErr(429, errors.Error429$inboundSchema),
|
|
229
|
+
M.jsonErr(500, errors.Error500$inboundSchema),
|
|
230
|
+
M.jsonErr(502, errors.Error502$inboundSchema),
|
|
231
|
+
M.jsonErr(504, errors.Error504$inboundSchema),
|
|
232
|
+
M.fail("4XX"),
|
|
233
|
+
M.fail("5XX"),
|
|
234
|
+
)(response, req, { extraFields: responseFields });
|
|
235
|
+
if (!result.ok) {
|
|
236
|
+
return [result, { status: "complete", request: req, response }];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return [result, { status: "complete", request: req, response }];
|
|
240
|
+
}
|
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: "2.
|
|
81
|
-
genVersion: "2.
|
|
82
|
-
userAgent: "speakeasy-sdk/typescript 2.
|
|
80
|
+
sdkVersion: "2.4.0",
|
|
81
|
+
genVersion: "2.924.0",
|
|
82
|
+
userAgent: "speakeasy-sdk/typescript 2.4.0 2.924.0 1.0.0 @gr4vy/sdk",
|
|
83
83
|
} as const;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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
|
+
GiftCardService,
|
|
12
|
+
GiftCardService$inboundSchema,
|
|
13
|
+
} from "./giftcardservice.js";
|
|
14
|
+
|
|
15
|
+
export type GiftCardIssuance = {
|
|
16
|
+
/**
|
|
17
|
+
* Always `gift-card-issuance`.
|
|
18
|
+
*/
|
|
19
|
+
type: "gift-card-issuance";
|
|
20
|
+
/**
|
|
21
|
+
* The ID for the gift card issuance.
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* The ID of the merchant account this gift card issuance belongs to.
|
|
26
|
+
*/
|
|
27
|
+
merchantAccountId: string;
|
|
28
|
+
giftCardService: GiftCardService;
|
|
29
|
+
/**
|
|
30
|
+
* The identifier for this issuance as provided by the gift card service.
|
|
31
|
+
*/
|
|
32
|
+
giftCardServicePaymentIssuanceId: string;
|
|
33
|
+
/**
|
|
34
|
+
* The URL for the issued gift card.
|
|
35
|
+
*/
|
|
36
|
+
url: string;
|
|
37
|
+
/**
|
|
38
|
+
* The amount loaded onto the gift card, in the smallest denomination for the currency.
|
|
39
|
+
*/
|
|
40
|
+
amount: number;
|
|
41
|
+
/**
|
|
42
|
+
* The ISO-4217 currency code for the `amount`.
|
|
43
|
+
*/
|
|
44
|
+
currency: string;
|
|
45
|
+
/**
|
|
46
|
+
* The external identifier provided when issuing the gift card.
|
|
47
|
+
*/
|
|
48
|
+
externalIdentifier?: string | null | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The date and time when this gift card was issued.
|
|
51
|
+
*/
|
|
52
|
+
createdAt: Date;
|
|
53
|
+
/**
|
|
54
|
+
* The date and time when this gift card issuance was last updated.
|
|
55
|
+
*/
|
|
56
|
+
updatedAt: Date;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** @internal */
|
|
60
|
+
export const GiftCardIssuance$inboundSchema: z.ZodType<
|
|
61
|
+
GiftCardIssuance,
|
|
62
|
+
z.ZodTypeDef,
|
|
63
|
+
unknown
|
|
64
|
+
> = z.object({
|
|
65
|
+
type: z.literal("gift-card-issuance").default("gift-card-issuance"),
|
|
66
|
+
id: z.string(),
|
|
67
|
+
merchant_account_id: z.string(),
|
|
68
|
+
gift_card_service: GiftCardService$inboundSchema,
|
|
69
|
+
gift_card_service_payment_issuance_id: z.string(),
|
|
70
|
+
url: z.string(),
|
|
71
|
+
amount: z.number().int(),
|
|
72
|
+
currency: z.string(),
|
|
73
|
+
external_identifier: z.nullable(z.string()).optional(),
|
|
74
|
+
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
75
|
+
updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
76
|
+
}).transform((v) => {
|
|
77
|
+
return remap$(v, {
|
|
78
|
+
"merchant_account_id": "merchantAccountId",
|
|
79
|
+
"gift_card_service": "giftCardService",
|
|
80
|
+
"gift_card_service_payment_issuance_id": "giftCardServicePaymentIssuanceId",
|
|
81
|
+
"external_identifier": "externalIdentifier",
|
|
82
|
+
"created_at": "createdAt",
|
|
83
|
+
"updated_at": "updatedAt",
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export function giftCardIssuanceFromJSON(
|
|
88
|
+
jsonString: string,
|
|
89
|
+
): SafeParseResult<GiftCardIssuance, SDKValidationError> {
|
|
90
|
+
return safeParse(
|
|
91
|
+
jsonString,
|
|
92
|
+
(x) => GiftCardIssuance$inboundSchema.parse(JSON.parse(x)),
|
|
93
|
+
`Failed to parse 'GiftCardIssuance' from JSON`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The details used to issue a new virtual gift card.
|
|
10
|
+
*/
|
|
11
|
+
export type GiftCardIssuanceCreate = {
|
|
12
|
+
/**
|
|
13
|
+
* The provider theme code to issue the gift card against.
|
|
14
|
+
*/
|
|
15
|
+
theme: string;
|
|
16
|
+
/**
|
|
17
|
+
* The amount to load onto the gift card, in the smallest denomination for the currency.
|
|
18
|
+
*/
|
|
19
|
+
amount: number;
|
|
20
|
+
/**
|
|
21
|
+
* The ISO-4217 currency code for the `amount`.
|
|
22
|
+
*/
|
|
23
|
+
currency: string;
|
|
24
|
+
/**
|
|
25
|
+
* An optional external identifier for this issuance.
|
|
26
|
+
*/
|
|
27
|
+
externalIdentifier?: string | null | undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export type GiftCardIssuanceCreate$Outbound = {
|
|
32
|
+
theme: string;
|
|
33
|
+
amount: number;
|
|
34
|
+
currency: string;
|
|
35
|
+
external_identifier?: string | null | undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const GiftCardIssuanceCreate$outboundSchema: z.ZodType<
|
|
40
|
+
GiftCardIssuanceCreate$Outbound,
|
|
41
|
+
z.ZodTypeDef,
|
|
42
|
+
GiftCardIssuanceCreate
|
|
43
|
+
> = z.object({
|
|
44
|
+
theme: z.string(),
|
|
45
|
+
amount: z.number().int(),
|
|
46
|
+
currency: z.string(),
|
|
47
|
+
externalIdentifier: z.nullable(z.string()).optional(),
|
|
48
|
+
}).transform((v) => {
|
|
49
|
+
return remap$(v, {
|
|
50
|
+
externalIdentifier: "external_identifier",
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export function giftCardIssuanceCreateToJSON(
|
|
55
|
+
giftCardIssuanceCreate: GiftCardIssuanceCreate,
|
|
56
|
+
): string {
|
|
57
|
+
return JSON.stringify(
|
|
58
|
+
GiftCardIssuanceCreate$outboundSchema.parse(giftCardIssuanceCreate),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -124,6 +124,8 @@ export * from "./giftcardactivationcreate.js";
|
|
|
124
124
|
export * from "./giftcardbalancerequest.js";
|
|
125
125
|
export * from "./giftcardcreate.js";
|
|
126
126
|
export * from "./giftcarderrorcode.js";
|
|
127
|
+
export * from "./giftcardissuance.js";
|
|
128
|
+
export * from "./giftcardissuancecreate.js";
|
|
127
129
|
export * from "./giftcardredemption.js";
|
|
128
130
|
export * from "./giftcardredemptionstatus.js";
|
|
129
131
|
export * from "./giftcardrequest.js";
|
|
@@ -24,10 +24,14 @@ export type MerchantAccount = {
|
|
|
24
24
|
displayName: string;
|
|
25
25
|
/**
|
|
26
26
|
* Client key provided by Pagos to authenticate to the Loon API. Loon is the Account Updater service we use and if the field is not set or if it's set to null, the Account Updater service doesn't get configured. If the field is set to `null`, the other `loon_*` fields must be set to null as well.
|
|
27
|
+
*
|
|
28
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
27
29
|
*/
|
|
28
30
|
loonClientKey?: string | null | undefined;
|
|
29
31
|
/**
|
|
30
32
|
* Secret key provided by Pagos to authenticate to the Loon API. Loon is the Account Updater service we use and if the field is not set or if it's set to null, the Account Updater service doesn't get configured. If the field is set to `null`, the other `loon_*` fields must be set to null as well.
|
|
33
|
+
*
|
|
34
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
31
35
|
*/
|
|
32
36
|
loonSecretKey?: string | null | undefined;
|
|
33
37
|
/**
|
|
@@ -40,18 +44,26 @@ export type MerchantAccount = {
|
|
|
40
44
|
loonMerchantAccountId?: string | null | undefined;
|
|
41
45
|
/**
|
|
42
46
|
* The public key used to encrypt the request to the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
47
|
+
*
|
|
48
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
43
49
|
*/
|
|
44
50
|
accountUpdaterRequestEncryptionKey?: string | null | undefined;
|
|
45
51
|
/**
|
|
46
52
|
* The ID of the key used to encrypt the request to the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
53
|
+
*
|
|
54
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
47
55
|
*/
|
|
48
56
|
accountUpdaterRequestEncryptionKeyId?: string | null | undefined;
|
|
49
57
|
/**
|
|
50
58
|
* The key used to decrypt the response from the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
59
|
+
*
|
|
60
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
51
61
|
*/
|
|
52
62
|
accountUpdaterResponseDecryptionKey?: string | null | undefined;
|
|
53
63
|
/**
|
|
54
64
|
* The ID of the key used to decrypt the request from the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
65
|
+
*
|
|
66
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
55
67
|
*/
|
|
56
68
|
accountUpdaterResponseDecryptionKeyId?: string | null | undefined;
|
|
57
69
|
/**
|
|
@@ -13,18 +13,26 @@ export type MerchantAccountCreate = {
|
|
|
13
13
|
accountUpdaterEnabled?: boolean | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* The public key used to encrypt the request to the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
16
18
|
*/
|
|
17
19
|
accountUpdaterRequestEncryptionKey?: string | null | undefined;
|
|
18
20
|
/**
|
|
19
21
|
* The ID of the key used to encrypt the request to the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
22
|
+
*
|
|
23
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
20
24
|
*/
|
|
21
25
|
accountUpdaterRequestEncryptionKeyId?: string | null | undefined;
|
|
22
26
|
/**
|
|
23
27
|
* The key used to decrypt the response from the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
28
|
+
*
|
|
29
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
24
30
|
*/
|
|
25
31
|
accountUpdaterResponseDecryptionKey?: string | null | undefined;
|
|
26
32
|
/**
|
|
27
33
|
* The ID of the key used to decrypt the request from the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
34
|
+
*
|
|
35
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
28
36
|
*/
|
|
29
37
|
accountUpdaterResponseDecryptionKeyId?: string | null | undefined;
|
|
30
38
|
/**
|
|
@@ -37,10 +45,14 @@ export type MerchantAccountCreate = {
|
|
|
37
45
|
overCapturePercentage?: number | null | undefined;
|
|
38
46
|
/**
|
|
39
47
|
* Client key provided by Pagos to authenticate to the Loon API. Loon is the Account Updater service we use and if the field is not set or if it's set to null, the Account Updater service doesn't get configured. If the field is set to `null`, the other `loon_*` fields must be set to null as well.
|
|
48
|
+
*
|
|
49
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
40
50
|
*/
|
|
41
51
|
loonClientKey?: string | null | undefined;
|
|
42
52
|
/**
|
|
43
53
|
* Secret key provided by Pagos to authenticate to the Loon API. Loon is the Account Updater service we use and if the field is not set or if it's set to null, the Account Updater service doesn't get configured. If the field is set to `null`, the other `loon_*` fields must be set to null as well.
|
|
54
|
+
*
|
|
55
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
44
56
|
*/
|
|
45
57
|
loonSecretKey?: string | null | undefined;
|
|
46
58
|
/**
|
|
@@ -13,18 +13,26 @@ export type MerchantAccountUpdate = {
|
|
|
13
13
|
accountUpdaterEnabled?: boolean | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* The public key used to encrypt the request to the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
16
18
|
*/
|
|
17
19
|
accountUpdaterRequestEncryptionKey?: string | null | undefined;
|
|
18
20
|
/**
|
|
19
21
|
* The ID of the key used to encrypt the request to the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
22
|
+
*
|
|
23
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
20
24
|
*/
|
|
21
25
|
accountUpdaterRequestEncryptionKeyId?: string | null | undefined;
|
|
22
26
|
/**
|
|
23
27
|
* The key used to decrypt the response from the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
28
|
+
*
|
|
29
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
24
30
|
*/
|
|
25
31
|
accountUpdaterResponseDecryptionKey?: string | null | undefined;
|
|
26
32
|
/**
|
|
27
33
|
* The ID of the key used to decrypt the request from the Real-Time Account Updater service. The Account Updater service is used to update card details when cards are lost, stolen or expired. If the field is not set or if it's set to `null`, the Account Updater service doesn't get called. If the field is set, the other `account_updater_*` fields must be set as well.
|
|
34
|
+
*
|
|
35
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
28
36
|
*/
|
|
29
37
|
accountUpdaterResponseDecryptionKeyId?: string | null | undefined;
|
|
30
38
|
/**
|
|
@@ -37,10 +45,14 @@ export type MerchantAccountUpdate = {
|
|
|
37
45
|
overCapturePercentage?: number | null | undefined;
|
|
38
46
|
/**
|
|
39
47
|
* Client key provided by Pagos to authenticate to the Loon API. Loon is the Account Updater service we use and if the field is not set or if it's set to null, the Account Updater service doesn't get configured. If the field is set to `null`, the other `loon_*` fields must be set to null as well.
|
|
48
|
+
*
|
|
49
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
40
50
|
*/
|
|
41
51
|
loonClientKey?: string | null | undefined;
|
|
42
52
|
/**
|
|
43
53
|
* Secret key provided by Pagos to authenticate to the Loon API. Loon is the Account Updater service we use and if the field is not set or if it's set to null, the Account Updater service doesn't get configured. If the field is set to `null`, the other `loon_*` fields must be set to null as well.
|
|
54
|
+
*
|
|
55
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
44
56
|
*/
|
|
45
57
|
loonSecretKey?: string | null | undefined;
|
|
46
58
|
/**
|
|
@@ -40,6 +40,8 @@ export const Name = {
|
|
|
40
40
|
GiftCardRefundSucceeded: "gift-card-refund-succeeded",
|
|
41
41
|
GiftCardRefundFailed: "gift-card-refund-failed",
|
|
42
42
|
GiftCardReversalSucceeded: "gift-card-reversal-succeeded",
|
|
43
|
+
ReauthorizationAttempted: "reauthorization-attempted",
|
|
44
|
+
ReauthorizationCreated: "reauthorization-created",
|
|
43
45
|
PaymentConnectorResponseTransactionAuthorizationSucceeded:
|
|
44
46
|
"payment-connector-response-transaction-authorization-succeeded",
|
|
45
47
|
PaymentConnectorResponseTransactionCaptureSucceeded:
|
|
@@ -67,6 +67,7 @@ export * from "./gettransactioncapture.js";
|
|
|
67
67
|
export * from "./gettransactionrefund.js";
|
|
68
68
|
export * from "./gettransactionrefundsettlement.js";
|
|
69
69
|
export * from "./gettransactionsettlement.js";
|
|
70
|
+
export * from "./issuegiftcard.js";
|
|
70
71
|
export * from "./listallreportexecutions.js";
|
|
71
72
|
export * from "./listapikeypairs.js";
|
|
72
73
|
export * from "./listauditlogs.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import * as components from "../components/index.js";
|
|
8
|
+
|
|
9
|
+
export type IssueGiftCardGlobals = {
|
|
10
|
+
merchantAccountId?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type IssueGiftCardRequest = {
|
|
14
|
+
/**
|
|
15
|
+
* A unique key forwarded to the gift card service to make the issuance idempotent.
|
|
16
|
+
*/
|
|
17
|
+
idempotencyKey?: string | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The ID of the merchant account to use for this request.
|
|
20
|
+
*/
|
|
21
|
+
merchantAccountId?: string | null | undefined;
|
|
22
|
+
giftCardIssuanceCreate: components.GiftCardIssuanceCreate;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export type IssueGiftCardRequest$Outbound = {
|
|
27
|
+
"idempotency-key"?: string | null | undefined;
|
|
28
|
+
merchantAccountId?: string | null | undefined;
|
|
29
|
+
GiftCardIssuanceCreate: components.GiftCardIssuanceCreate$Outbound;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const IssueGiftCardRequest$outboundSchema: z.ZodType<
|
|
34
|
+
IssueGiftCardRequest$Outbound,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
IssueGiftCardRequest
|
|
37
|
+
> = z.object({
|
|
38
|
+
idempotencyKey: z.nullable(z.string()).optional(),
|
|
39
|
+
merchantAccountId: z.nullable(z.string()).optional(),
|
|
40
|
+
giftCardIssuanceCreate: components.GiftCardIssuanceCreate$outboundSchema,
|
|
41
|
+
}).transform((v) => {
|
|
42
|
+
return remap$(v, {
|
|
43
|
+
idempotencyKey: "idempotency-key",
|
|
44
|
+
giftCardIssuanceCreate: "GiftCardIssuanceCreate",
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export function issueGiftCardRequestToJSON(
|
|
49
|
+
issueGiftCardRequest: IssueGiftCardRequest,
|
|
50
|
+
): string {
|
|
51
|
+
return JSON.stringify(
|
|
52
|
+
IssueGiftCardRequest$outboundSchema.parse(issueGiftCardRequest),
|
|
53
|
+
);
|
|
54
|
+
}
|
package/src/sdk/giftcards.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { unwrapAsync } from "../types/fp.js";
|
|
|
13
13
|
import { PageIterator, unwrapResultIterator } from "../types/operations.js";
|
|
14
14
|
import { Activations } from "./activations.js";
|
|
15
15
|
import { Balances } from "./balances.js";
|
|
16
|
+
import { Issuances } from "./issuances.js";
|
|
16
17
|
|
|
17
18
|
export class GiftCards extends ClientSDK {
|
|
18
19
|
private _balances?: Balances;
|
|
@@ -25,6 +26,11 @@ export class GiftCards extends ClientSDK {
|
|
|
25
26
|
return (this._activations ??= new Activations(this._options));
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
private _issuances?: Issuances;
|
|
30
|
+
get issuances(): Issuances {
|
|
31
|
+
return (this._issuances ??= new Issuances(this._options));
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
/**
|
|
29
35
|
* Get gift card
|
|
30
36
|
*
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { giftCardsIssuancesCreate } from "../funcs/giftCardsIssuancesCreate.js";
|
|
6
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
7
|
+
import * as components from "../models/components/index.js";
|
|
8
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
9
|
+
|
|
10
|
+
export class Issuances extends ClientSDK {
|
|
11
|
+
/**
|
|
12
|
+
* Issue a gift card
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Issue a new virtual gift card through the primary gift card service.
|
|
16
|
+
*/
|
|
17
|
+
async create(
|
|
18
|
+
giftCardIssuanceCreate: components.GiftCardIssuanceCreate,
|
|
19
|
+
idempotencyKey?: string | null | undefined,
|
|
20
|
+
merchantAccountId?: string | null | undefined,
|
|
21
|
+
options?: RequestOptions,
|
|
22
|
+
): Promise<components.GiftCardIssuance> {
|
|
23
|
+
return unwrapAsync(giftCardsIssuancesCreate(
|
|
24
|
+
this,
|
|
25
|
+
giftCardIssuanceCreate,
|
|
26
|
+
idempotencyKey,
|
|
27
|
+
merchantAccountId,
|
|
28
|
+
options,
|
|
29
|
+
));
|
|
30
|
+
}
|
|
31
|
+
}
|