pkg-sdk-test 0.0.15 → 0.0.17
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 +14 -1
- package/dist/cjs/BaseClient.d.ts +2 -1
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +1 -1
- package/dist/cjs/Client.js +1 -1
- package/dist/cjs/api/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/index.js +1 -0
- package/dist/cjs/api/resources/payments/client/Client.d.ts +16 -1
- package/dist/cjs/api/resources/payments/client/Client.js +82 -28
- package/dist/cjs/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.d.ts +1 -1
- package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsRequest.d.ts +3 -2
- package/dist/cjs/api/resources/payments/client/requests/PostV1PaymentsPaymentIdActivateRequest.d.ts +10 -0
- package/dist/cjs/api/resources/payments/client/requests/PostV1PaymentsPaymentIdActivateRequest.js +3 -0
- package/dist/cjs/api/resources/payments/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/payments/types/GetV1PaymentsRequestOrder.d.ts +5 -0
- package/dist/cjs/api/resources/payments/types/GetV1PaymentsRequestOrder.js +8 -0
- package/dist/cjs/api/resources/payments/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/payments/types/index.js +1 -0
- package/dist/cjs/api/resources/staticWallets/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/staticWallets/client/Client.js +64 -43
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.d.ts +2 -1
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.d.ts +12 -2
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.js +10 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.d.ts +2 -1
- package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsRequest.d.ts +13 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsRequest.js +3 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.d.ts +7 -0
- package/dist/cjs/api/resources/staticWallets/client/requests/index.d.ts +2 -1
- package/dist/cjs/api/resources/staticWallets/client/requests/index.js +3 -0
- package/dist/cjs/api/resources/staticWallets/index.d.ts +1 -0
- package/dist/cjs/api/resources/staticWallets/index.js +1 -0
- package/dist/cjs/api/resources/staticWallets/types/GetV1StaticWalletsRequestOrder.d.ts +5 -0
- package/dist/cjs/api/resources/staticWallets/types/GetV1StaticWalletsRequestOrder.js +8 -0
- package/dist/cjs/api/resources/staticWallets/types/GetV1StaticWalletsStaticWalletIdDepositsRequestOrder.d.ts +5 -0
- package/dist/cjs/api/resources/staticWallets/types/GetV1StaticWalletsStaticWalletIdDepositsRequestOrder.js +8 -0
- package/dist/cjs/api/resources/staticWallets/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/staticWallets/types/index.js +18 -0
- package/dist/cjs/api/types/CryptopayAssetId.d.ts +32 -0
- package/dist/cjs/api/types/CryptopayAssetId.js +35 -0
- package/dist/cjs/api/types/CryptopayPaymentResponse.d.ts +1 -1
- package/dist/cjs/api/types/CryptopayPublicPaymentResponse.d.ts +1 -1
- package/dist/cjs/api/types/CryptopayRedirectConfigDto.d.ts +11 -1
- package/dist/cjs/api/types/CryptopayRedirectConfigDto.js +11 -0
- package/dist/cjs/api/types/CryptopayStaticDepositResponse.d.ts +13 -2
- package/dist/cjs/api/types/CryptopayStaticDepositResponse.js +11 -0
- package/dist/cjs/api/types/CryptopayStaticWalletResponse.d.ts +2 -1
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +1 -1
- package/dist/cjs/environments.d.ts +4 -0
- package/dist/cjs/environments.js +7 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +2 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +1 -1
- package/dist/esm/Client.mjs +1 -1
- package/dist/esm/api/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/index.mjs +1 -0
- package/dist/esm/api/resources/payments/client/Client.d.mts +16 -1
- package/dist/esm/api/resources/payments/client/Client.mjs +82 -28
- package/dist/esm/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.d.mts +1 -1
- package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsRequest.d.mts +3 -2
- package/dist/esm/api/resources/payments/client/requests/PostV1PaymentsPaymentIdActivateRequest.d.mts +10 -0
- package/dist/esm/api/resources/payments/client/requests/PostV1PaymentsPaymentIdActivateRequest.mjs +2 -0
- package/dist/esm/api/resources/payments/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/payments/types/GetV1PaymentsRequestOrder.d.mts +5 -0
- package/dist/esm/api/resources/payments/types/GetV1PaymentsRequestOrder.mjs +5 -0
- package/dist/esm/api/resources/payments/types/index.d.mts +1 -0
- package/dist/esm/api/resources/payments/types/index.mjs +1 -0
- package/dist/esm/api/resources/staticWallets/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/staticWallets/client/Client.mjs +64 -43
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.d.mts +2 -1
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.d.mts +12 -2
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.mjs +9 -1
- package/dist/esm/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.d.mts +2 -1
- package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsRequest.d.mts +13 -0
- package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsRequest.mjs +2 -0
- package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.d.mts +7 -0
- package/dist/esm/api/resources/staticWallets/client/requests/index.d.mts +2 -1
- package/dist/esm/api/resources/staticWallets/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/staticWallets/index.d.mts +1 -0
- package/dist/esm/api/resources/staticWallets/index.mjs +1 -0
- package/dist/esm/api/resources/staticWallets/types/GetV1StaticWalletsRequestOrder.d.mts +5 -0
- package/dist/esm/api/resources/staticWallets/types/GetV1StaticWalletsRequestOrder.mjs +5 -0
- package/dist/esm/api/resources/staticWallets/types/GetV1StaticWalletsStaticWalletIdDepositsRequestOrder.d.mts +5 -0
- package/dist/esm/api/resources/staticWallets/types/GetV1StaticWalletsStaticWalletIdDepositsRequestOrder.mjs +5 -0
- package/dist/esm/api/resources/staticWallets/types/index.d.mts +2 -0
- package/dist/esm/api/resources/staticWallets/types/index.mjs +2 -0
- package/dist/esm/api/types/CryptopayAssetId.d.mts +32 -0
- package/dist/esm/api/types/CryptopayAssetId.mjs +32 -0
- package/dist/esm/api/types/CryptopayPaymentResponse.d.mts +1 -1
- package/dist/esm/api/types/CryptopayPublicPaymentResponse.d.mts +1 -1
- package/dist/esm/api/types/CryptopayRedirectConfigDto.d.mts +11 -1
- package/dist/esm/api/types/CryptopayRedirectConfigDto.mjs +10 -1
- package/dist/esm/api/types/CryptopayStaticDepositResponse.d.mts +13 -2
- package/dist/esm/api/types/CryptopayStaticDepositResponse.mjs +10 -1
- package/dist/esm/api/types/CryptopayStaticWalletResponse.d.mts +2 -1
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/auth/HeaderAuthProvider.d.mts +1 -1
- package/dist/esm/environments.d.mts +4 -0
- package/dist/esm/environments.mjs +4 -0
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +74 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ The Suward TypeScript library provides convenient access to the Suward APIs from
|
|
|
10
10
|
- [Installation](#installation)
|
|
11
11
|
- [Reference](#reference)
|
|
12
12
|
- [Usage](#usage)
|
|
13
|
+
- [Environments](#environments)
|
|
13
14
|
- [Request and Response Types](#request-and-response-types)
|
|
14
15
|
- [Exception Handling](#exception-handling)
|
|
15
16
|
- [Advanced](#advanced)
|
|
@@ -42,10 +43,22 @@ Instantiate and use the client with the following:
|
|
|
42
43
|
```typescript
|
|
43
44
|
import { SuwardSDKClient } from "pkg-sdk-test";
|
|
44
45
|
|
|
45
|
-
const client = new SuwardSDKClient({
|
|
46
|
+
const client = new SuwardSDKClient({ apiKey: "YOUR_API_KEY" });
|
|
46
47
|
await client.payments.createPayment();
|
|
47
48
|
```
|
|
48
49
|
|
|
50
|
+
## Environments
|
|
51
|
+
|
|
52
|
+
This SDK allows you to configure different environments for API requests.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { SuwardSDKClient, SuwardSDKEnvironment } from "pkg-sdk-test";
|
|
56
|
+
|
|
57
|
+
const client = new SuwardSDKClient({
|
|
58
|
+
environment: SuwardSDKEnvironment.Default,
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
49
62
|
## Request and Response Types
|
|
50
63
|
|
|
51
64
|
The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
|
package/dist/cjs/BaseClient.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.js";
|
|
2
2
|
import * as core from "./core/index.js";
|
|
3
|
+
import type * as environments from "./environments.js";
|
|
3
4
|
export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | HeaderAuthProvider.AuthOptions;
|
|
4
5
|
export type BaseClientOptions = {
|
|
5
|
-
environment
|
|
6
|
+
environment?: core.Supplier<environments.SuwardSDKEnvironment | string>;
|
|
6
7
|
/** Specify a custom URL to connect the client to. */
|
|
7
8
|
baseUrl?: core.Supplier<string>;
|
|
8
9
|
/** Additional headers to include in requests. */
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "pkg-sdk-test",
|
|
46
|
-
"X-Fern-SDK-Version": "0.0.
|
|
47
|
-
"User-Agent": "pkg-sdk-test/0.0.
|
|
46
|
+
"X-Fern-SDK-Version": "0.0.17",
|
|
47
|
+
"User-Agent": "pkg-sdk-test/0.0.17",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class SuwardSDKClient {
|
|
|
12
12
|
protected readonly _options: NormalizedClientOptionsWithAuth<SuwardSDKClient.Options>;
|
|
13
13
|
protected _payments: PaymentsClient | undefined;
|
|
14
14
|
protected _staticWallets: StaticWalletsClient | undefined;
|
|
15
|
-
constructor(options
|
|
15
|
+
constructor(options?: SuwardSDKClient.Options);
|
|
16
16
|
get payments(): PaymentsClient;
|
|
17
17
|
get staticWallets(): StaticWalletsClient;
|
|
18
18
|
/**
|
package/dist/cjs/Client.js
CHANGED
|
@@ -49,7 +49,7 @@ const Client_js_2 = require("./api/resources/staticWallets/client/Client.js");
|
|
|
49
49
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
50
50
|
const core = __importStar(require("./core/index.js"));
|
|
51
51
|
class SuwardSDKClient {
|
|
52
|
-
constructor(options) {
|
|
52
|
+
constructor(options = {}) {
|
|
53
53
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
54
54
|
}
|
|
55
55
|
get payments() {
|
|
@@ -42,3 +42,4 @@ exports.payments = __importStar(require("./payments/index.js"));
|
|
|
42
42
|
__exportStar(require("./payments/types/index.js"), exports);
|
|
43
43
|
__exportStar(require("./staticWallets/client/requests/index.js"), exports);
|
|
44
44
|
exports.staticWallets = __importStar(require("./staticWallets/index.js"));
|
|
45
|
+
__exportStar(require("./staticWallets/types/index.js"), exports);
|
|
@@ -9,7 +9,7 @@ export declare namespace PaymentsClient {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class PaymentsClient {
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<PaymentsClient.Options>;
|
|
12
|
-
constructor(options
|
|
12
|
+
constructor(options?: PaymentsClient.Options);
|
|
13
13
|
/**
|
|
14
14
|
* List payments for a project
|
|
15
15
|
*
|
|
@@ -56,6 +56,21 @@ export declare class PaymentsClient {
|
|
|
56
56
|
*/
|
|
57
57
|
getPayment(request: SuwardSDK.GetV1PaymentsPaymentIdRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.GetV1PaymentsPaymentIdResponse>;
|
|
58
58
|
private __getPayment;
|
|
59
|
+
/**
|
|
60
|
+
* Activate a payment (public, customer-facing)
|
|
61
|
+
*
|
|
62
|
+
* @param {SuwardSDK.PostV1PaymentsPaymentIdActivateRequest} request
|
|
63
|
+
* @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
|
+
*
|
|
65
|
+
* @throws {@link SuwardSDK.InternalServerError}
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await client.payments.activatePayment({
|
|
69
|
+
* paymentId: "paymentId"
|
|
70
|
+
* })
|
|
71
|
+
*/
|
|
72
|
+
activatePayment(request: SuwardSDK.PostV1PaymentsPaymentIdActivateRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.CryptopayPublicPaymentResponse>;
|
|
73
|
+
private __activatePayment;
|
|
59
74
|
/**
|
|
60
75
|
* Cancel a payment
|
|
61
76
|
*
|
|
@@ -58,11 +58,12 @@ exports.PaymentsClient = void 0;
|
|
|
58
58
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
59
59
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
60
60
|
const core = __importStar(require("../../../../core/index.js"));
|
|
61
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
61
62
|
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
62
63
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
63
64
|
const SuwardSDK = __importStar(require("../../../index.js"));
|
|
64
65
|
class PaymentsClient {
|
|
65
|
-
constructor(options) {
|
|
66
|
+
constructor(options = {}) {
|
|
66
67
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
@@ -83,17 +84,17 @@ class PaymentsClient {
|
|
|
83
84
|
}
|
|
84
85
|
__listPayments() {
|
|
85
86
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
86
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
87
|
-
const {
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
88
|
+
const { order, limit, lastId } = request;
|
|
88
89
|
const _queryParams = {
|
|
89
|
-
|
|
90
|
+
order: order != null ? order : undefined,
|
|
90
91
|
limit,
|
|
91
92
|
lastId,
|
|
92
93
|
};
|
|
93
94
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
94
95
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
95
96
|
const _response = yield core.fetcher({
|
|
96
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "v1/payments"),
|
|
97
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SuwardSDKEnvironment.Default, "v1/payments"),
|
|
97
98
|
method: "GET",
|
|
98
99
|
headers: _headers,
|
|
99
100
|
queryString: core.url
|
|
@@ -101,10 +102,10 @@ class PaymentsClient {
|
|
|
101
102
|
.addMany(_queryParams)
|
|
102
103
|
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
103
104
|
.build(),
|
|
104
|
-
timeoutMs: ((
|
|
105
|
-
maxRetries: (
|
|
105
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
106
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
106
107
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
107
|
-
fetchFn: (
|
|
108
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
108
109
|
logging: this._options.logging,
|
|
109
110
|
});
|
|
110
111
|
if (_response.ok) {
|
|
@@ -150,21 +151,21 @@ class PaymentsClient {
|
|
|
150
151
|
}
|
|
151
152
|
__createPayment() {
|
|
152
153
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
153
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
154
155
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
155
156
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
156
157
|
const _response = yield core.fetcher({
|
|
157
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "v1/payments"),
|
|
158
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SuwardSDKEnvironment.Default, "v1/payments"),
|
|
158
159
|
method: "POST",
|
|
159
160
|
headers: _headers,
|
|
160
161
|
contentType: "application/json",
|
|
161
162
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
162
163
|
requestType: "json",
|
|
163
164
|
body: request,
|
|
164
|
-
timeoutMs: ((
|
|
165
|
-
maxRetries: (
|
|
165
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
166
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
166
167
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
167
|
-
fetchFn: (
|
|
168
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
168
169
|
logging: this._options.logging,
|
|
169
170
|
});
|
|
170
171
|
if (_response.ok) {
|
|
@@ -208,19 +209,19 @@ class PaymentsClient {
|
|
|
208
209
|
}
|
|
209
210
|
__getPayment(request, requestOptions) {
|
|
210
211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
212
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
212
213
|
const { paymentId } = request;
|
|
213
214
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
214
215
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
215
216
|
const _response = yield core.fetcher({
|
|
216
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `v1/payments/${core.url.encodePathParam(paymentId)}`),
|
|
217
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SuwardSDKEnvironment.Default, `v1/payments/${core.url.encodePathParam(paymentId)}`),
|
|
217
218
|
method: "GET",
|
|
218
219
|
headers: _headers,
|
|
219
220
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
220
|
-
timeoutMs: ((
|
|
221
|
-
maxRetries: (
|
|
221
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
222
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
222
223
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
223
|
-
fetchFn: (
|
|
224
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
224
225
|
logging: this._options.logging,
|
|
225
226
|
});
|
|
226
227
|
if (_response.ok) {
|
|
@@ -244,6 +245,59 @@ class PaymentsClient {
|
|
|
244
245
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/payments/{paymentId}");
|
|
245
246
|
});
|
|
246
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Activate a payment (public, customer-facing)
|
|
250
|
+
*
|
|
251
|
+
* @param {SuwardSDK.PostV1PaymentsPaymentIdActivateRequest} request
|
|
252
|
+
* @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
253
|
+
*
|
|
254
|
+
* @throws {@link SuwardSDK.InternalServerError}
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* await client.payments.activatePayment({
|
|
258
|
+
* paymentId: "paymentId"
|
|
259
|
+
* })
|
|
260
|
+
*/
|
|
261
|
+
activatePayment(request, requestOptions) {
|
|
262
|
+
return core.HttpResponsePromise.fromPromise(this.__activatePayment(request, requestOptions));
|
|
263
|
+
}
|
|
264
|
+
__activatePayment(request, requestOptions) {
|
|
265
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
267
|
+
const { paymentId } = request;
|
|
268
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
269
|
+
const _response = yield core.fetcher({
|
|
270
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SuwardSDKEnvironment.Default, `v1/payments/${core.url.encodePathParam(paymentId)}/activate`),
|
|
271
|
+
method: "POST",
|
|
272
|
+
headers: _headers,
|
|
273
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
274
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
275
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
276
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
277
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
278
|
+
logging: this._options.logging,
|
|
279
|
+
});
|
|
280
|
+
if (_response.ok) {
|
|
281
|
+
return {
|
|
282
|
+
data: _response.body,
|
|
283
|
+
rawResponse: _response.rawResponse,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
if (_response.error.reason === "status-code") {
|
|
287
|
+
switch (_response.error.statusCode) {
|
|
288
|
+
case 500:
|
|
289
|
+
throw new SuwardSDK.InternalServerError(_response.error.body, _response.rawResponse);
|
|
290
|
+
default:
|
|
291
|
+
throw new errors.SuwardSDKError({
|
|
292
|
+
statusCode: _response.error.statusCode,
|
|
293
|
+
body: _response.error.body,
|
|
294
|
+
rawResponse: _response.rawResponse,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/payments/{paymentId}/activate");
|
|
299
|
+
});
|
|
300
|
+
}
|
|
247
301
|
/**
|
|
248
302
|
* Cancel a payment
|
|
249
303
|
*
|
|
@@ -263,19 +317,19 @@ class PaymentsClient {
|
|
|
263
317
|
}
|
|
264
318
|
__cancelPayment(request, requestOptions) {
|
|
265
319
|
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
320
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
267
321
|
const { paymentId } = request;
|
|
268
322
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
269
323
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
270
324
|
const _response = yield core.fetcher({
|
|
271
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `v1/payments/${core.url.encodePathParam(paymentId)}/cancel`),
|
|
325
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SuwardSDKEnvironment.Default, `v1/payments/${core.url.encodePathParam(paymentId)}/cancel`),
|
|
272
326
|
method: "POST",
|
|
273
327
|
headers: _headers,
|
|
274
328
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
275
|
-
timeoutMs: ((
|
|
276
|
-
maxRetries: (
|
|
329
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
330
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
277
331
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
278
|
-
fetchFn: (
|
|
332
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
279
333
|
logging: this._options.logging,
|
|
280
334
|
});
|
|
281
335
|
if (_response.ok) {
|
|
@@ -318,22 +372,22 @@ class PaymentsClient {
|
|
|
318
372
|
}
|
|
319
373
|
__simulatePayment(request, requestOptions) {
|
|
320
374
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
375
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
322
376
|
const { paymentId } = request, _body = __rest(request, ["paymentId"]);
|
|
323
377
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
324
378
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
325
379
|
const _response = yield core.fetcher({
|
|
326
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `v1/payments/${core.url.encodePathParam(paymentId)}/simulate`),
|
|
380
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SuwardSDKEnvironment.Default, `v1/payments/${core.url.encodePathParam(paymentId)}/simulate`),
|
|
327
381
|
method: "POST",
|
|
328
382
|
headers: _headers,
|
|
329
383
|
contentType: "application/json",
|
|
330
384
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
331
385
|
requestType: "json",
|
|
332
386
|
body: _body,
|
|
333
|
-
timeoutMs: ((
|
|
334
|
-
maxRetries: (
|
|
387
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
388
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
335
389
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
336
|
-
fetchFn: (
|
|
390
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
337
391
|
logging: this._options.logging,
|
|
338
392
|
});
|
|
339
393
|
if (_response.ok) {
|
|
@@ -6,7 +6,7 @@ import type * as SuwardSDK from "../../../../index.js";
|
|
|
6
6
|
export interface CryptopayCreatePaymentRequest {
|
|
7
7
|
activationFlowSeconds?: number;
|
|
8
8
|
amount?: string;
|
|
9
|
-
asset?:
|
|
9
|
+
asset?: SuwardSDK.CryptopayAssetId;
|
|
10
10
|
externalId?: string;
|
|
11
11
|
isTest?: boolean;
|
|
12
12
|
metadata?: Record<string, unknown>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type * as SuwardSDK from "../../../../index.js";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {}
|
|
4
5
|
*/
|
|
5
6
|
export interface GetV1PaymentsRequest {
|
|
6
7
|
/** Sort order (asc/desc) */
|
|
7
|
-
|
|
8
|
-
/** Limit (default 100) */
|
|
8
|
+
order?: SuwardSDK.GetV1PaymentsRequestOrder;
|
|
9
|
+
/** Limit (default 20, max 100) */
|
|
9
10
|
limit?: number;
|
|
10
11
|
/** Last ID for pagination */
|
|
11
12
|
lastId?: string;
|
|
@@ -2,4 +2,5 @@ export type { CryptopayCreatePaymentRequest } from "./CryptopayCreatePaymentRequ
|
|
|
2
2
|
export type { CryptopaySimulatePaymentRequest } from "./CryptopaySimulatePaymentRequest.js";
|
|
3
3
|
export type { GetV1PaymentsPaymentIdRequest } from "./GetV1PaymentsPaymentIdRequest.js";
|
|
4
4
|
export type { GetV1PaymentsRequest } from "./GetV1PaymentsRequest.js";
|
|
5
|
+
export type { PostV1PaymentsPaymentIdActivateRequest } from "./PostV1PaymentsPaymentIdActivateRequest.js";
|
|
5
6
|
export type { PostV1PaymentsPaymentIdCancelRequest } from "./PostV1PaymentsPaymentIdCancelRequest.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GetV1PaymentsRequestOrder = void 0;
|
|
5
|
+
exports.GetV1PaymentsRequestOrder = {
|
|
6
|
+
Asc: "asc",
|
|
7
|
+
Desc: "desc",
|
|
8
|
+
};
|
|
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./GetV1PaymentsPaymentIdResponse.js"), exports);
|
|
18
|
+
__exportStar(require("./GetV1PaymentsRequestOrder.js"), exports);
|
|
@@ -9,8 +9,9 @@ export declare namespace StaticWalletsClient {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class StaticWalletsClient {
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<StaticWalletsClient.Options>;
|
|
12
|
-
constructor(options
|
|
12
|
+
constructor(options?: StaticWalletsClient.Options);
|
|
13
13
|
/**
|
|
14
|
+
* @param {SuwardSDK.GetV1StaticWalletsRequest} request
|
|
14
15
|
* @param {StaticWalletsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
15
16
|
*
|
|
16
17
|
* @throws {@link SuwardSDK.UnauthorizedError}
|
|
@@ -18,7 +19,7 @@ export declare class StaticWalletsClient {
|
|
|
18
19
|
* @example
|
|
19
20
|
* await client.staticWallets.listStaticWallets()
|
|
20
21
|
*/
|
|
21
|
-
listStaticWallets(requestOptions?: StaticWalletsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.CryptopayListStaticWalletsResponse>;
|
|
22
|
+
listStaticWallets(request?: SuwardSDK.GetV1StaticWalletsRequest, requestOptions?: StaticWalletsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.CryptopayListStaticWalletsResponse>;
|
|
22
23
|
private __listStaticWallets;
|
|
23
24
|
/**
|
|
24
25
|
* Create a reusable deposit address with an accepted-asset allow-list
|