@unified-api/typescript-sdk 1.0.0 → 1.0.2
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 +54 -700
- package/dist/sdk/accounting.d.ts +0 -40
- package/dist/sdk/accounting.js +44 -696
- package/dist/sdk/link.d.ts +31 -0
- package/dist/sdk/link.js +503 -0
- package/dist/sdk/models/operations/{createaccountingpayment.d.ts → createpaymentlink.d.ts} +7 -7
- package/dist/sdk/models/operations/createpaymentlink.js +95 -0
- package/dist/sdk/models/operations/createpaymentpayment.d.ts +28 -0
- package/dist/sdk/models/operations/{createaccountingpayment.js → createpaymentpayment.js} +20 -20
- package/dist/sdk/models/operations/getpaymentlink.d.ts +35 -0
- package/dist/sdk/models/operations/getpaymentlink.js +99 -0
- package/dist/sdk/models/operations/{getaccountingpayment.d.ts → getpaymentpayment.d.ts} +6 -6
- package/dist/sdk/models/operations/{getaccountingpayment.js → getpaymentpayment.js} +20 -20
- package/dist/sdk/models/operations/{getaccountingpayout.d.ts → getpaymentpayout.d.ts} +6 -6
- package/dist/sdk/models/operations/{getaccountingpayout.js → getpaymentpayout.js} +20 -20
- package/dist/sdk/models/operations/{getaccountingrefund.d.ts → getpaymentrefund.d.ts} +6 -6
- package/dist/sdk/models/operations/{getaccountingrefund.js → getpaymentrefund.js} +20 -20
- package/dist/sdk/models/operations/getunifiedintegrationauth.d.ts +6 -4
- package/dist/sdk/models/operations/getunifiedintegrationauth.js +6 -4
- package/dist/sdk/models/operations/index.d.ts +16 -10
- package/dist/sdk/models/operations/index.js +16 -10
- package/dist/sdk/models/operations/listpaymentlinks.d.ts +51 -0
- package/dist/sdk/models/operations/listpaymentlinks.js +127 -0
- package/dist/sdk/models/operations/{listaccountingpayments.d.ts → listpaymentpayments.d.ts} +6 -6
- package/dist/sdk/models/operations/{listaccountingpayments.js → listpaymentpayments.js} +28 -28
- package/dist/sdk/models/operations/{listaccountingpayouts.d.ts → listpaymentpayouts.d.ts} +6 -6
- package/dist/sdk/models/operations/{listaccountingpayouts.js → listpaymentpayouts.js} +26 -26
- package/dist/sdk/models/operations/{listaccountingrefunds.d.ts → listpaymentrefunds.d.ts} +6 -6
- package/dist/sdk/models/operations/{listaccountingrefunds.js → listpaymentrefunds.js} +27 -27
- package/dist/sdk/models/operations/listunifiedconnections.d.ts +2 -1
- package/dist/sdk/models/operations/listunifiedconnections.js +1 -0
- package/dist/sdk/models/operations/listunifiedintegrations.d.ts +2 -1
- package/dist/sdk/models/operations/listunifiedintegrations.js +1 -0
- package/dist/sdk/models/operations/listunifiedintegrationworkspaces.d.ts +2 -1
- package/dist/sdk/models/operations/listunifiedintegrationworkspaces.js +1 -0
- package/dist/sdk/models/operations/patchpaymentlink.d.ts +32 -0
- package/dist/sdk/models/operations/patchpaymentlink.js +99 -0
- package/dist/sdk/models/operations/{patchaccountingpayment.d.ts → patchpaymentpayment.d.ts} +7 -7
- package/dist/sdk/models/operations/{patchaccountingpayment.js → patchpaymentpayment.js} +21 -21
- package/dist/sdk/models/operations/removepaymentlink.d.ts +30 -0
- package/dist/sdk/models/operations/{removeaccountingpayment.js → removepaymentlink.js} +17 -17
- package/dist/sdk/models/operations/{removeaccountingpayment.d.ts → removepaymentpayment.d.ts} +2 -2
- package/dist/sdk/models/operations/removepaymentpayment.js +71 -0
- package/dist/sdk/models/operations/updatepaymentlink.d.ts +32 -0
- package/dist/sdk/models/operations/updatepaymentlink.js +99 -0
- package/dist/sdk/models/operations/{updateaccountingpayment.d.ts → updatepaymentpayment.d.ts} +7 -7
- package/dist/sdk/models/operations/{updateaccountingpayment.js → updatepaymentpayment.js} +21 -21
- package/dist/sdk/models/shared/accountinginvoice.d.ts +1 -0
- package/dist/sdk/models/shared/accountinginvoice.js +5 -0
- package/dist/sdk/models/shared/index.d.ts +5 -3
- package/dist/sdk/models/shared/index.js +5 -3
- package/dist/sdk/models/shared/paymenntlinklineitem.d.ts +20 -0
- package/dist/sdk/models/shared/paymenntlinklineitem.js +137 -0
- package/dist/sdk/models/shared/paymentlink.d.ts +15 -0
- package/dist/sdk/models/shared/paymentlink.js +105 -0
- package/dist/sdk/models/shared/{accountingpayment.d.ts → paymentpayment.d.ts} +1 -1
- package/dist/sdk/models/shared/{accountingpayment.js → paymentpayment.js} +18 -18
- package/dist/sdk/models/shared/{accountingpayout.d.ts → paymentpayout.d.ts} +3 -3
- package/dist/sdk/models/shared/{accountingpayout.js → paymentpayout.js} +21 -21
- package/dist/sdk/models/shared/{accountingrefund.d.ts → paymentrefund.d.ts} +3 -3
- package/dist/sdk/models/shared/{accountingrefund.js → paymentrefund.js} +23 -23
- package/dist/sdk/models/shared/propertyconnectioncategories.d.ts +2 -1
- package/dist/sdk/models/shared/propertyconnectioncategories.js +1 -0
- package/dist/sdk/models/shared/propertyconnectionpermissions.d.ts +6 -4
- package/dist/sdk/models/shared/propertyconnectionpermissions.js +6 -4
- package/dist/sdk/models/shared/propertyintegrationcategories.d.ts +2 -1
- package/dist/sdk/models/shared/propertyintegrationcategories.js +1 -0
- package/dist/sdk/models/shared/webhook.d.ts +4 -3
- package/dist/sdk/models/shared/webhook.js +4 -3
- package/dist/sdk/payment.d.ts +46 -6
- package/dist/sdk/payment.js +705 -53
- package/dist/sdk/payout.d.ts +2 -2
- package/dist/sdk/payout.js +11 -11
- package/dist/sdk/refund.d.ts +2 -2
- package/dist/sdk/refund.js +11 -11
- package/dist/sdk/sdk.d.ts +5 -3
- package/dist/sdk/sdk.js +7 -5
- package/docs/sdk/models/operations/categories.md +2 -1
- package/docs/sdk/models/operations/createpaymentlinkrequest.md +9 -0
- package/docs/sdk/models/operations/createpaymentlinkresponse.md +11 -0
- package/docs/sdk/models/operations/createpaymentpaymentrequest.md +9 -0
- package/docs/sdk/models/operations/createpaymentpaymentresponse.md +11 -0
- package/docs/sdk/models/operations/getpaymentlinkrequest.md +10 -0
- package/docs/sdk/models/operations/getpaymentlinkresponse.md +11 -0
- package/docs/sdk/models/operations/{getaccountingpaymentrequest.md → getpaymentpaymentrequest.md} +1 -1
- package/docs/sdk/models/operations/getpaymentpaymentresponse.md +11 -0
- package/docs/sdk/models/operations/{getaccountingpayoutrequest.md → getpaymentpayoutrequest.md} +1 -1
- package/docs/sdk/models/operations/getpaymentpayoutresponse.md +11 -0
- package/docs/sdk/models/operations/{getaccountingrefundrequest.md → getpaymentrefundrequest.md} +1 -1
- package/docs/sdk/models/operations/getpaymentrefundresponse.md +11 -0
- package/docs/sdk/models/operations/listpaymentlinksrequest.md +17 -0
- package/docs/sdk/models/operations/listpaymentlinksresponse.md +11 -0
- package/docs/sdk/models/operations/{listaccountingpaymentsrequest.md → listpaymentpaymentsrequest.md} +1 -1
- package/docs/sdk/models/operations/listpaymentpaymentsresponse.md +11 -0
- package/docs/sdk/models/operations/{listaccountingpayoutsrequest.md → listpaymentpayoutsrequest.md} +1 -1
- package/docs/sdk/models/operations/listpaymentpayoutsresponse.md +11 -0
- package/docs/sdk/models/operations/{listaccountingrefundsrequest.md → listpaymentrefundsrequest.md} +1 -1
- package/docs/sdk/models/operations/listpaymentrefundsresponse.md +11 -0
- package/docs/sdk/models/operations/listunifiedintegrationsqueryparamcategories.md +2 -1
- package/docs/sdk/models/operations/patchpaymentlinkrequest.md +10 -0
- package/docs/sdk/models/operations/patchpaymentlinkresponse.md +11 -0
- package/docs/sdk/models/operations/patchpaymentpaymentrequest.md +10 -0
- package/docs/sdk/models/operations/patchpaymentpaymentresponse.md +11 -0
- package/docs/sdk/models/operations/queryparamcategories.md +2 -1
- package/docs/sdk/models/operations/{removeaccountingpaymentrequest.md → removepaymentlinkrequest.md} +2 -2
- package/docs/sdk/models/operations/{removeaccountingpaymentresponse.md → removepaymentlinkresponse.md} +1 -1
- package/docs/sdk/models/operations/removepaymentpaymentrequest.md +9 -0
- package/docs/sdk/models/operations/removepaymentpaymentresponse.md +11 -0
- package/docs/sdk/models/operations/scopes.md +6 -4
- package/docs/sdk/models/operations/updatepaymentlinkrequest.md +10 -0
- package/docs/sdk/models/operations/updatepaymentlinkresponse.md +11 -0
- package/docs/sdk/models/operations/updatepaymentpaymentrequest.md +10 -0
- package/docs/sdk/models/operations/updatepaymentpaymentresponse.md +11 -0
- package/docs/sdk/models/shared/accountinginvoice.md +2 -1
- package/docs/sdk/models/shared/objecttype.md +4 -3
- package/docs/sdk/models/shared/paymenntlinklineitem.md +24 -0
- package/docs/sdk/models/shared/paymentlink.md +18 -0
- package/docs/sdk/models/shared/{accountingpayment.md → paymentpayment.md} +1 -1
- package/docs/sdk/models/shared/paymentpayout.md +15 -0
- package/docs/sdk/models/shared/{accountingpayoutstatus.md → paymentpayoutstatus.md} +1 -1
- package/docs/sdk/models/shared/paymentrefund.md +17 -0
- package/docs/sdk/models/shared/{accountingrefundstatus.md → paymentrefundstatus.md} +1 -1
- package/docs/sdk/models/shared/propertyconnectioncategories.md +2 -1
- package/docs/sdk/models/shared/propertyconnectionpermissions.md +6 -4
- package/docs/sdk/models/shared/propertyintegrationcategories.md +2 -1
- package/package.json +1 -1
- package/docs/sdk/models/operations/createaccountingpaymentrequest.md +0 -9
- package/docs/sdk/models/operations/createaccountingpaymentresponse.md +0 -11
- package/docs/sdk/models/operations/getaccountingpaymentresponse.md +0 -11
- package/docs/sdk/models/operations/getaccountingpayoutresponse.md +0 -11
- package/docs/sdk/models/operations/getaccountingrefundresponse.md +0 -11
- package/docs/sdk/models/operations/listaccountingpaymentsresponse.md +0 -11
- package/docs/sdk/models/operations/listaccountingpayoutsresponse.md +0 -11
- package/docs/sdk/models/operations/listaccountingrefundsresponse.md +0 -11
- package/docs/sdk/models/operations/patchaccountingpaymentrequest.md +0 -10
- package/docs/sdk/models/operations/patchaccountingpaymentresponse.md +0 -11
- package/docs/sdk/models/operations/updateaccountingpaymentrequest.md +0 -10
- package/docs/sdk/models/operations/updateaccountingpaymentresponse.md +0 -11
- package/docs/sdk/models/shared/accountingpayout.md +0 -15
- package/docs/sdk/models/shared/accountingrefund.md +0 -17
- package/docs/sdks/account/README.md +0 -312
- package/docs/sdks/accounting/README.md +0 -2198
- package/docs/sdks/activity/README.md +0 -321
- package/docs/sdks/apicall/README.md +0 -95
- package/docs/sdks/application/README.md +0 -333
- package/docs/sdks/applicationstatus/README.md +0 -54
- package/docs/sdks/ats/README.md +0 -2488
- package/docs/sdks/auth/README.md +0 -103
- package/docs/sdks/call/README.md +0 -54
- package/docs/sdks/candidate/README.md +0 -369
- package/docs/sdks/collection/README.md +0 -348
- package/docs/sdks/commerce/README.md +0 -1371
- package/docs/sdks/company/README.md +0 -517
- package/docs/sdks/connection/README.md +0 -359
- package/docs/sdks/contact/README.md +0 -1028
- package/docs/sdks/crm/README.md +0 -2048
- package/docs/sdks/customer/README.md +0 -348
- package/docs/sdks/deal/README.md +0 -315
- package/docs/sdks/document/README.md +0 -309
- package/docs/sdks/employee/README.md +0 -363
- package/docs/sdks/enrich/README.md +0 -97
- package/docs/sdks/event/README.md +0 -390
- package/docs/sdks/file/README.md +0 -330
- package/docs/sdks/group/README.md +0 -327
- package/docs/sdks/hris/README.md +0 -685
- package/docs/sdks/integration/README.md +0 -155
- package/docs/sdks/interview/README.md +0 -318
- package/docs/sdks/inventory/README.md +0 -309
- package/docs/sdks/invoice/README.md +0 -324
- package/docs/sdks/issue/README.md +0 -49
- package/docs/sdks/item/README.md +0 -417
- package/docs/sdks/job/README.md +0 -396
- package/docs/sdks/lead/README.md +0 -336
- package/docs/sdks/list/README.md +0 -306
- package/docs/sdks/location/README.md +0 -312
- package/docs/sdks/login/README.md +0 -52
- package/docs/sdks/martech/README.md +0 -643
- package/docs/sdks/member/README.md +0 -342
- package/docs/sdks/note/README.md +0 -306
- package/docs/sdks/organization/README.md +0 -104
- package/docs/sdks/passthrough/README.md +0 -249
- package/docs/sdks/payment/README.md +0 -306
- package/docs/sdks/payout/README.md +0 -104
- package/docs/sdks/person/README.md +0 -51
- package/docs/sdks/pipeline/README.md +0 -306
- package/docs/sdks/refund/README.md +0 -104
- package/docs/sdks/scorecard/README.md +0 -324
- package/docs/sdks/storage/README.md +0 -330
- package/docs/sdks/taxrate/README.md +0 -312
- package/docs/sdks/ticket/README.md +0 -318
- package/docs/sdks/ticketing/README.md +0 -962
- package/docs/sdks/transaction/README.md +0 -327
- package/docs/sdks/uc/README.md +0 -388
- package/docs/sdks/unified/README.md +0 -929
- package/docs/sdks/unifiedto/README.md +0 -9
- package/docs/sdks/webhook/README.md +0 -291
package/dist/sdk/payment.js
CHANGED
|
@@ -98,54 +98,499 @@ var Payment = /** @class */ (function () {
|
|
|
98
98
|
function Payment(sdkConfig) {
|
|
99
99
|
this.sdkConfiguration = sdkConfig;
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Create a payment link
|
|
103
|
+
*/
|
|
104
|
+
Payment.prototype.createPaymentLink = function (req, config) {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
|
|
108
|
+
var _d;
|
|
109
|
+
return __generator(this, function (_e) {
|
|
110
|
+
switch (_e.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
113
|
+
req = new operations.CreatePaymentLinkRequest(req);
|
|
114
|
+
}
|
|
115
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
116
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/link", req);
|
|
117
|
+
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
118
|
+
try {
|
|
119
|
+
_d = __read(utils.serializeRequestBody(req, "paymentLink", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
if (e instanceof Error) {
|
|
123
|
+
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
client = this.sdkConfiguration.defaultClient;
|
|
127
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
128
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
129
|
+
return [4 /*yield*/, globalSecurity()];
|
|
130
|
+
case 1:
|
|
131
|
+
globalSecurity = _e.sent();
|
|
132
|
+
_e.label = 2;
|
|
133
|
+
case 2:
|
|
134
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
135
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
136
|
+
}
|
|
137
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
138
|
+
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
139
|
+
headers["Accept"] = "application/json";
|
|
140
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
141
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
142
|
+
case 3:
|
|
143
|
+
httpRes = _e.sent();
|
|
144
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
145
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
146
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
147
|
+
}
|
|
148
|
+
res = new operations.CreatePaymentLinkResponse({
|
|
149
|
+
statusCode: httpRes.status,
|
|
150
|
+
contentType: responseContentType,
|
|
151
|
+
rawResponse: httpRes,
|
|
152
|
+
});
|
|
153
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
154
|
+
switch (true) {
|
|
155
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
156
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
157
|
+
res.paymentLink = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentLink);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
164
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
165
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
166
|
+
}
|
|
167
|
+
return [2 /*return*/, res];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
101
172
|
/**
|
|
102
173
|
* Create a payment
|
|
103
174
|
*/
|
|
104
|
-
Payment.prototype.
|
|
175
|
+
Payment.prototype.createPaymentPayment = function (req, config) {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
+
var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
|
|
179
|
+
var _d;
|
|
180
|
+
return __generator(this, function (_e) {
|
|
181
|
+
switch (_e.label) {
|
|
182
|
+
case 0:
|
|
183
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
184
|
+
req = new operations.CreatePaymentPaymentRequest(req);
|
|
185
|
+
}
|
|
186
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
187
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/payment", req);
|
|
188
|
+
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
189
|
+
try {
|
|
190
|
+
_d = __read(utils.serializeRequestBody(req, "paymentPayment", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
if (e instanceof Error) {
|
|
194
|
+
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
client = this.sdkConfiguration.defaultClient;
|
|
198
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
199
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
200
|
+
return [4 /*yield*/, globalSecurity()];
|
|
201
|
+
case 1:
|
|
202
|
+
globalSecurity = _e.sent();
|
|
203
|
+
_e.label = 2;
|
|
204
|
+
case 2:
|
|
205
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
206
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
207
|
+
}
|
|
208
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
209
|
+
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
210
|
+
headers["Accept"] = "application/json";
|
|
211
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
212
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
213
|
+
case 3:
|
|
214
|
+
httpRes = _e.sent();
|
|
215
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
216
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
217
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
218
|
+
}
|
|
219
|
+
res = new operations.CreatePaymentPaymentResponse({
|
|
220
|
+
statusCode: httpRes.status,
|
|
221
|
+
contentType: responseContentType,
|
|
222
|
+
rawResponse: httpRes,
|
|
223
|
+
});
|
|
224
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
225
|
+
switch (true) {
|
|
226
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
227
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
228
|
+
res.paymentPayment = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentPayment);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
232
|
+
}
|
|
233
|
+
break;
|
|
234
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
235
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
236
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
237
|
+
}
|
|
238
|
+
return [2 /*return*/, res];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Retrieve a payment link
|
|
245
|
+
*/
|
|
246
|
+
Payment.prototype.getPaymentLink = function (req, config) {
|
|
247
|
+
var _a, _b;
|
|
248
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
249
|
+
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
|
|
250
|
+
return __generator(this, function (_c) {
|
|
251
|
+
switch (_c.label) {
|
|
252
|
+
case 0:
|
|
253
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
254
|
+
req = new operations.GetPaymentLinkRequest(req);
|
|
255
|
+
}
|
|
256
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
257
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/link/{id}", req);
|
|
258
|
+
client = this.sdkConfiguration.defaultClient;
|
|
259
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
260
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
261
|
+
return [4 /*yield*/, globalSecurity()];
|
|
262
|
+
case 1:
|
|
263
|
+
globalSecurity = _c.sent();
|
|
264
|
+
_c.label = 2;
|
|
265
|
+
case 2:
|
|
266
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
267
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
268
|
+
}
|
|
269
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
270
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
271
|
+
queryParams = utils.serializeQueryParams(req);
|
|
272
|
+
headers["Accept"] = "application/json";
|
|
273
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
274
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
275
|
+
case 3:
|
|
276
|
+
httpRes = _c.sent();
|
|
277
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
278
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
279
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
280
|
+
}
|
|
281
|
+
res = new operations.GetPaymentLinkResponse({
|
|
282
|
+
statusCode: httpRes.status,
|
|
283
|
+
contentType: responseContentType,
|
|
284
|
+
rawResponse: httpRes,
|
|
285
|
+
});
|
|
286
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
287
|
+
switch (true) {
|
|
288
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
289
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
290
|
+
res.paymentLink = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentLink);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
297
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
298
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
299
|
+
}
|
|
300
|
+
return [2 /*return*/, res];
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Retrieve a payment
|
|
307
|
+
*/
|
|
308
|
+
Payment.prototype.getPaymentPayment = function (req, config) {
|
|
309
|
+
var _a, _b;
|
|
310
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
311
|
+
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
|
|
312
|
+
return __generator(this, function (_c) {
|
|
313
|
+
switch (_c.label) {
|
|
314
|
+
case 0:
|
|
315
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
316
|
+
req = new operations.GetPaymentPaymentRequest(req);
|
|
317
|
+
}
|
|
318
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
319
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/payment/{id}", req);
|
|
320
|
+
client = this.sdkConfiguration.defaultClient;
|
|
321
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
322
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
323
|
+
return [4 /*yield*/, globalSecurity()];
|
|
324
|
+
case 1:
|
|
325
|
+
globalSecurity = _c.sent();
|
|
326
|
+
_c.label = 2;
|
|
327
|
+
case 2:
|
|
328
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
329
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
330
|
+
}
|
|
331
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
332
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
333
|
+
queryParams = utils.serializeQueryParams(req);
|
|
334
|
+
headers["Accept"] = "application/json";
|
|
335
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
336
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
337
|
+
case 3:
|
|
338
|
+
httpRes = _c.sent();
|
|
339
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
340
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
341
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
342
|
+
}
|
|
343
|
+
res = new operations.GetPaymentPaymentResponse({
|
|
344
|
+
statusCode: httpRes.status,
|
|
345
|
+
contentType: responseContentType,
|
|
346
|
+
rawResponse: httpRes,
|
|
347
|
+
});
|
|
348
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
349
|
+
switch (true) {
|
|
350
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
351
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
352
|
+
res.paymentPayment = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentPayment);
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
356
|
+
}
|
|
357
|
+
break;
|
|
358
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
359
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
360
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
361
|
+
}
|
|
362
|
+
return [2 /*return*/, res];
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* Retrieve a payout
|
|
369
|
+
*/
|
|
370
|
+
Payment.prototype.getPaymentPayout = function (req, config) {
|
|
371
|
+
var _a, _b;
|
|
372
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
373
|
+
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
|
|
374
|
+
return __generator(this, function (_c) {
|
|
375
|
+
switch (_c.label) {
|
|
376
|
+
case 0:
|
|
377
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
378
|
+
req = new operations.GetPaymentPayoutRequest(req);
|
|
379
|
+
}
|
|
380
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
381
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/payout/{id}", req);
|
|
382
|
+
client = this.sdkConfiguration.defaultClient;
|
|
383
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
384
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
385
|
+
return [4 /*yield*/, globalSecurity()];
|
|
386
|
+
case 1:
|
|
387
|
+
globalSecurity = _c.sent();
|
|
388
|
+
_c.label = 2;
|
|
389
|
+
case 2:
|
|
390
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
391
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
392
|
+
}
|
|
393
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
394
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
395
|
+
queryParams = utils.serializeQueryParams(req);
|
|
396
|
+
headers["Accept"] = "application/json";
|
|
397
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
398
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
399
|
+
case 3:
|
|
400
|
+
httpRes = _c.sent();
|
|
401
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
402
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
403
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
404
|
+
}
|
|
405
|
+
res = new operations.GetPaymentPayoutResponse({
|
|
406
|
+
statusCode: httpRes.status,
|
|
407
|
+
contentType: responseContentType,
|
|
408
|
+
rawResponse: httpRes,
|
|
409
|
+
});
|
|
410
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
411
|
+
switch (true) {
|
|
412
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
413
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
414
|
+
res.paymentPayout = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentPayout);
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
418
|
+
}
|
|
419
|
+
break;
|
|
420
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
421
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
422
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
423
|
+
}
|
|
424
|
+
return [2 /*return*/, res];
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
};
|
|
429
|
+
/**
|
|
430
|
+
* Retrieve a refund
|
|
431
|
+
*/
|
|
432
|
+
Payment.prototype.getPaymentRefund = function (req, config) {
|
|
433
|
+
var _a, _b;
|
|
434
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
435
|
+
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
|
|
436
|
+
return __generator(this, function (_c) {
|
|
437
|
+
switch (_c.label) {
|
|
438
|
+
case 0:
|
|
439
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
440
|
+
req = new operations.GetPaymentRefundRequest(req);
|
|
441
|
+
}
|
|
442
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
443
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/refund/{id}", req);
|
|
444
|
+
client = this.sdkConfiguration.defaultClient;
|
|
445
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
446
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
447
|
+
return [4 /*yield*/, globalSecurity()];
|
|
448
|
+
case 1:
|
|
449
|
+
globalSecurity = _c.sent();
|
|
450
|
+
_c.label = 2;
|
|
451
|
+
case 2:
|
|
452
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
453
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
454
|
+
}
|
|
455
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
456
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
457
|
+
queryParams = utils.serializeQueryParams(req);
|
|
458
|
+
headers["Accept"] = "application/json";
|
|
459
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
460
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
461
|
+
case 3:
|
|
462
|
+
httpRes = _c.sent();
|
|
463
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
464
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
465
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
466
|
+
}
|
|
467
|
+
res = new operations.GetPaymentRefundResponse({
|
|
468
|
+
statusCode: httpRes.status,
|
|
469
|
+
contentType: responseContentType,
|
|
470
|
+
rawResponse: httpRes,
|
|
471
|
+
});
|
|
472
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
473
|
+
switch (true) {
|
|
474
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
475
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
476
|
+
res.paymentRefund = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentRefund);
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
480
|
+
}
|
|
481
|
+
break;
|
|
482
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
483
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
484
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
485
|
+
}
|
|
486
|
+
return [2 /*return*/, res];
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* List all payment links
|
|
493
|
+
*/
|
|
494
|
+
Payment.prototype.listPaymentLinks = function (req, config) {
|
|
495
|
+
var _a, _b;
|
|
496
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
497
|
+
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes, resFieldDepth;
|
|
498
|
+
return __generator(this, function (_c) {
|
|
499
|
+
switch (_c.label) {
|
|
500
|
+
case 0:
|
|
501
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
502
|
+
req = new operations.ListPaymentLinksRequest(req);
|
|
503
|
+
}
|
|
504
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
505
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/link", req);
|
|
506
|
+
client = this.sdkConfiguration.defaultClient;
|
|
507
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
508
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
509
|
+
return [4 /*yield*/, globalSecurity()];
|
|
510
|
+
case 1:
|
|
511
|
+
globalSecurity = _c.sent();
|
|
512
|
+
_c.label = 2;
|
|
513
|
+
case 2:
|
|
514
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
515
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
516
|
+
}
|
|
517
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
518
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
519
|
+
queryParams = utils.serializeQueryParams(req);
|
|
520
|
+
headers["Accept"] = "application/json";
|
|
521
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
522
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
523
|
+
case 3:
|
|
524
|
+
httpRes = _c.sent();
|
|
525
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
526
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
527
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
528
|
+
}
|
|
529
|
+
res = new operations.ListPaymentLinksResponse({
|
|
530
|
+
statusCode: httpRes.status,
|
|
531
|
+
contentType: responseContentType,
|
|
532
|
+
rawResponse: httpRes,
|
|
533
|
+
});
|
|
534
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
535
|
+
switch (true) {
|
|
536
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
537
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
538
|
+
res.paymentLinks = [];
|
|
539
|
+
resFieldDepth = utils.getResFieldDepth(res);
|
|
540
|
+
res.paymentLinks = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentLink, resFieldDepth);
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
544
|
+
}
|
|
545
|
+
break;
|
|
546
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
547
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
548
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
549
|
+
}
|
|
550
|
+
return [2 /*return*/, res];
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
/**
|
|
556
|
+
* List all payments
|
|
557
|
+
*/
|
|
558
|
+
Payment.prototype.listPaymentPayments = function (req, config) {
|
|
105
559
|
var _a, _b;
|
|
106
560
|
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
-
var baseURL, operationUrl,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
switch (_e.label) {
|
|
561
|
+
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes, resFieldDepth;
|
|
562
|
+
return __generator(this, function (_c) {
|
|
563
|
+
switch (_c.label) {
|
|
111
564
|
case 0:
|
|
112
565
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
113
|
-
req = new operations.
|
|
566
|
+
req = new operations.ListPaymentPaymentsRequest(req);
|
|
114
567
|
}
|
|
115
568
|
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
116
|
-
operationUrl = utils.generateURL(baseURL, "/
|
|
117
|
-
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
118
|
-
try {
|
|
119
|
-
_d = __read(utils.serializeRequestBody(req, "accountingPayment", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
120
|
-
}
|
|
121
|
-
catch (e) {
|
|
122
|
-
if (e instanceof Error) {
|
|
123
|
-
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
124
|
-
}
|
|
125
|
-
}
|
|
569
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/payment", req);
|
|
126
570
|
client = this.sdkConfiguration.defaultClient;
|
|
127
571
|
globalSecurity = this.sdkConfiguration.security;
|
|
128
572
|
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
129
573
|
return [4 /*yield*/, globalSecurity()];
|
|
130
574
|
case 1:
|
|
131
|
-
globalSecurity =
|
|
132
|
-
|
|
575
|
+
globalSecurity = _c.sent();
|
|
576
|
+
_c.label = 2;
|
|
133
577
|
case 2:
|
|
134
578
|
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
135
579
|
globalSecurity = new shared.Security(globalSecurity);
|
|
136
580
|
}
|
|
137
581
|
properties = utils.parseSecurityProperties(globalSecurity);
|
|
138
|
-
headers = __assign(__assign(
|
|
582
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
583
|
+
queryParams = utils.serializeQueryParams(req);
|
|
139
584
|
headers["Accept"] = "application/json";
|
|
140
585
|
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
141
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "
|
|
586
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
142
587
|
case 3:
|
|
143
|
-
httpRes =
|
|
588
|
+
httpRes = _c.sent();
|
|
144
589
|
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
145
590
|
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
146
591
|
throw new Error("status code not found in response: ".concat(httpRes));
|
|
147
592
|
}
|
|
148
|
-
res = new operations.
|
|
593
|
+
res = new operations.ListPaymentPaymentsResponse({
|
|
149
594
|
statusCode: httpRes.status,
|
|
150
595
|
contentType: responseContentType,
|
|
151
596
|
rawResponse: httpRes,
|
|
@@ -154,7 +599,9 @@ var Payment = /** @class */ (function () {
|
|
|
154
599
|
switch (true) {
|
|
155
600
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
156
601
|
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
157
|
-
res.
|
|
602
|
+
res.paymentPayments = [];
|
|
603
|
+
resFieldDepth = utils.getResFieldDepth(res);
|
|
604
|
+
res.paymentPayments = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentPayment, resFieldDepth);
|
|
158
605
|
}
|
|
159
606
|
else {
|
|
160
607
|
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
@@ -170,20 +617,20 @@ var Payment = /** @class */ (function () {
|
|
|
170
617
|
});
|
|
171
618
|
};
|
|
172
619
|
/**
|
|
173
|
-
*
|
|
620
|
+
* List all payouts
|
|
174
621
|
*/
|
|
175
|
-
Payment.prototype.
|
|
622
|
+
Payment.prototype.listPaymentPayouts = function (req, config) {
|
|
176
623
|
var _a, _b;
|
|
177
624
|
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
-
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
|
|
625
|
+
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes, resFieldDepth;
|
|
179
626
|
return __generator(this, function (_c) {
|
|
180
627
|
switch (_c.label) {
|
|
181
628
|
case 0:
|
|
182
629
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
183
|
-
req = new operations.
|
|
630
|
+
req = new operations.ListPaymentPayoutsRequest(req);
|
|
184
631
|
}
|
|
185
632
|
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
186
|
-
operationUrl = utils.generateURL(baseURL, "/
|
|
633
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/payout", req);
|
|
187
634
|
client = this.sdkConfiguration.defaultClient;
|
|
188
635
|
globalSecurity = this.sdkConfiguration.security;
|
|
189
636
|
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
@@ -207,7 +654,7 @@ var Payment = /** @class */ (function () {
|
|
|
207
654
|
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
208
655
|
throw new Error("status code not found in response: ".concat(httpRes));
|
|
209
656
|
}
|
|
210
|
-
res = new operations.
|
|
657
|
+
res = new operations.ListPaymentPayoutsResponse({
|
|
211
658
|
statusCode: httpRes.status,
|
|
212
659
|
contentType: responseContentType,
|
|
213
660
|
rawResponse: httpRes,
|
|
@@ -216,7 +663,9 @@ var Payment = /** @class */ (function () {
|
|
|
216
663
|
switch (true) {
|
|
217
664
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
218
665
|
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
219
|
-
res.
|
|
666
|
+
res.paymentPayouts = [];
|
|
667
|
+
resFieldDepth = utils.getResFieldDepth(res);
|
|
668
|
+
res.paymentPayouts = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentPayout, resFieldDepth);
|
|
220
669
|
}
|
|
221
670
|
else {
|
|
222
671
|
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
@@ -232,9 +681,9 @@ var Payment = /** @class */ (function () {
|
|
|
232
681
|
});
|
|
233
682
|
};
|
|
234
683
|
/**
|
|
235
|
-
* List all
|
|
684
|
+
* List all refunds
|
|
236
685
|
*/
|
|
237
|
-
Payment.prototype.
|
|
686
|
+
Payment.prototype.listPaymentRefunds = function (req, config) {
|
|
238
687
|
var _a, _b;
|
|
239
688
|
return __awaiter(this, void 0, void 0, function () {
|
|
240
689
|
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes, resFieldDepth;
|
|
@@ -242,10 +691,10 @@ var Payment = /** @class */ (function () {
|
|
|
242
691
|
switch (_c.label) {
|
|
243
692
|
case 0:
|
|
244
693
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
245
|
-
req = new operations.
|
|
694
|
+
req = new operations.ListPaymentRefundsRequest(req);
|
|
246
695
|
}
|
|
247
696
|
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
248
|
-
operationUrl = utils.generateURL(baseURL, "/
|
|
697
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/refund", req);
|
|
249
698
|
client = this.sdkConfiguration.defaultClient;
|
|
250
699
|
globalSecurity = this.sdkConfiguration.security;
|
|
251
700
|
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
@@ -269,7 +718,7 @@ var Payment = /** @class */ (function () {
|
|
|
269
718
|
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
270
719
|
throw new Error("status code not found in response: ".concat(httpRes));
|
|
271
720
|
}
|
|
272
|
-
res = new operations.
|
|
721
|
+
res = new operations.ListPaymentRefundsResponse({
|
|
273
722
|
statusCode: httpRes.status,
|
|
274
723
|
contentType: responseContentType,
|
|
275
724
|
rawResponse: httpRes,
|
|
@@ -278,9 +727,80 @@ var Payment = /** @class */ (function () {
|
|
|
278
727
|
switch (true) {
|
|
279
728
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
280
729
|
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
281
|
-
res.
|
|
730
|
+
res.paymentRefunds = [];
|
|
282
731
|
resFieldDepth = utils.getResFieldDepth(res);
|
|
283
|
-
res.
|
|
732
|
+
res.paymentRefunds = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentRefund, resFieldDepth);
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
736
|
+
}
|
|
737
|
+
break;
|
|
738
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
739
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
740
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
741
|
+
}
|
|
742
|
+
return [2 /*return*/, res];
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
/**
|
|
748
|
+
* Update a payment link
|
|
749
|
+
*/
|
|
750
|
+
Payment.prototype.patchPaymentLink = function (req, config) {
|
|
751
|
+
var _a, _b;
|
|
752
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
753
|
+
var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
|
|
754
|
+
var _d;
|
|
755
|
+
return __generator(this, function (_e) {
|
|
756
|
+
switch (_e.label) {
|
|
757
|
+
case 0:
|
|
758
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
759
|
+
req = new operations.PatchPaymentLinkRequest(req);
|
|
760
|
+
}
|
|
761
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
762
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/link/{id}", req);
|
|
763
|
+
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
764
|
+
try {
|
|
765
|
+
_d = __read(utils.serializeRequestBody(req, "paymentLink", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
766
|
+
}
|
|
767
|
+
catch (e) {
|
|
768
|
+
if (e instanceof Error) {
|
|
769
|
+
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
client = this.sdkConfiguration.defaultClient;
|
|
773
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
774
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
775
|
+
return [4 /*yield*/, globalSecurity()];
|
|
776
|
+
case 1:
|
|
777
|
+
globalSecurity = _e.sent();
|
|
778
|
+
_e.label = 2;
|
|
779
|
+
case 2:
|
|
780
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
781
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
782
|
+
}
|
|
783
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
784
|
+
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
785
|
+
headers["Accept"] = "application/json";
|
|
786
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
787
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "patch", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
788
|
+
case 3:
|
|
789
|
+
httpRes = _e.sent();
|
|
790
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
791
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
792
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
793
|
+
}
|
|
794
|
+
res = new operations.PatchPaymentLinkResponse({
|
|
795
|
+
statusCode: httpRes.status,
|
|
796
|
+
contentType: responseContentType,
|
|
797
|
+
rawResponse: httpRes,
|
|
798
|
+
});
|
|
799
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
800
|
+
switch (true) {
|
|
801
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
802
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
803
|
+
res.paymentLink = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentLink);
|
|
284
804
|
}
|
|
285
805
|
else {
|
|
286
806
|
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
@@ -298,7 +818,7 @@ var Payment = /** @class */ (function () {
|
|
|
298
818
|
/**
|
|
299
819
|
* Update a payment
|
|
300
820
|
*/
|
|
301
|
-
Payment.prototype.
|
|
821
|
+
Payment.prototype.patchPaymentPayment = function (req, config) {
|
|
302
822
|
var _a, _b;
|
|
303
823
|
return __awaiter(this, void 0, void 0, function () {
|
|
304
824
|
var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
|
|
@@ -307,13 +827,13 @@ var Payment = /** @class */ (function () {
|
|
|
307
827
|
switch (_e.label) {
|
|
308
828
|
case 0:
|
|
309
829
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
310
|
-
req = new operations.
|
|
830
|
+
req = new operations.PatchPaymentPaymentRequest(req);
|
|
311
831
|
}
|
|
312
832
|
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
313
|
-
operationUrl = utils.generateURL(baseURL, "/
|
|
833
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/payment/{id}", req);
|
|
314
834
|
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
315
835
|
try {
|
|
316
|
-
_d = __read(utils.serializeRequestBody(req, "
|
|
836
|
+
_d = __read(utils.serializeRequestBody(req, "paymentPayment", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
317
837
|
}
|
|
318
838
|
catch (e) {
|
|
319
839
|
if (e instanceof Error) {
|
|
@@ -342,7 +862,7 @@ var Payment = /** @class */ (function () {
|
|
|
342
862
|
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
343
863
|
throw new Error("status code not found in response: ".concat(httpRes));
|
|
344
864
|
}
|
|
345
|
-
res = new operations.
|
|
865
|
+
res = new operations.PatchPaymentPaymentResponse({
|
|
346
866
|
statusCode: httpRes.status,
|
|
347
867
|
contentType: responseContentType,
|
|
348
868
|
rawResponse: httpRes,
|
|
@@ -351,7 +871,7 @@ var Payment = /** @class */ (function () {
|
|
|
351
871
|
switch (true) {
|
|
352
872
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
353
873
|
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
354
|
-
res.
|
|
874
|
+
res.paymentPayment = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentPayment);
|
|
355
875
|
}
|
|
356
876
|
else {
|
|
357
877
|
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
@@ -366,10 +886,71 @@ var Payment = /** @class */ (function () {
|
|
|
366
886
|
});
|
|
367
887
|
});
|
|
368
888
|
};
|
|
889
|
+
/**
|
|
890
|
+
* Remove a payment link
|
|
891
|
+
*/
|
|
892
|
+
Payment.prototype.removePaymentLink = function (req, config) {
|
|
893
|
+
var _a, _b;
|
|
894
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
895
|
+
var baseURL, operationUrl, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
|
|
896
|
+
return __generator(this, function (_c) {
|
|
897
|
+
switch (_c.label) {
|
|
898
|
+
case 0:
|
|
899
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
900
|
+
req = new operations.RemovePaymentLinkRequest(req);
|
|
901
|
+
}
|
|
902
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
903
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/link/{id}", req);
|
|
904
|
+
client = this.sdkConfiguration.defaultClient;
|
|
905
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
906
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
907
|
+
return [4 /*yield*/, globalSecurity()];
|
|
908
|
+
case 1:
|
|
909
|
+
globalSecurity = _c.sent();
|
|
910
|
+
_c.label = 2;
|
|
911
|
+
case 2:
|
|
912
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
913
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
914
|
+
}
|
|
915
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
916
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
917
|
+
headers["Accept"] = "application/json";
|
|
918
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
919
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
|
|
920
|
+
case 3:
|
|
921
|
+
httpRes = _c.sent();
|
|
922
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
923
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
924
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
925
|
+
}
|
|
926
|
+
res = new operations.RemovePaymentLinkResponse({
|
|
927
|
+
statusCode: httpRes.status,
|
|
928
|
+
contentType: responseContentType,
|
|
929
|
+
rawResponse: httpRes,
|
|
930
|
+
});
|
|
931
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
932
|
+
switch (true) {
|
|
933
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
934
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
935
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
936
|
+
default:
|
|
937
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
938
|
+
res.res = decodedRes;
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
941
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
942
|
+
}
|
|
943
|
+
break;
|
|
944
|
+
}
|
|
945
|
+
return [2 /*return*/, res];
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
});
|
|
949
|
+
};
|
|
369
950
|
/**
|
|
370
951
|
* Remove a payment
|
|
371
952
|
*/
|
|
372
|
-
Payment.prototype.
|
|
953
|
+
Payment.prototype.removePaymentPayment = function (req, config) {
|
|
373
954
|
var _a, _b;
|
|
374
955
|
return __awaiter(this, void 0, void 0, function () {
|
|
375
956
|
var baseURL, operationUrl, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
|
|
@@ -377,10 +958,10 @@ var Payment = /** @class */ (function () {
|
|
|
377
958
|
switch (_c.label) {
|
|
378
959
|
case 0:
|
|
379
960
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
380
|
-
req = new operations.
|
|
961
|
+
req = new operations.RemovePaymentPaymentRequest(req);
|
|
381
962
|
}
|
|
382
963
|
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
383
|
-
operationUrl = utils.generateURL(baseURL, "/
|
|
964
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/payment/{id}", req);
|
|
384
965
|
client = this.sdkConfiguration.defaultClient;
|
|
385
966
|
globalSecurity = this.sdkConfiguration.security;
|
|
386
967
|
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
@@ -403,7 +984,7 @@ var Payment = /** @class */ (function () {
|
|
|
403
984
|
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
404
985
|
throw new Error("status code not found in response: ".concat(httpRes));
|
|
405
986
|
}
|
|
406
|
-
res = new operations.
|
|
987
|
+
res = new operations.RemovePaymentPaymentResponse({
|
|
407
988
|
statusCode: httpRes.status,
|
|
408
989
|
contentType: responseContentType,
|
|
409
990
|
rawResponse: httpRes,
|
|
@@ -427,10 +1008,81 @@ var Payment = /** @class */ (function () {
|
|
|
427
1008
|
});
|
|
428
1009
|
});
|
|
429
1010
|
};
|
|
1011
|
+
/**
|
|
1012
|
+
* Update a payment link
|
|
1013
|
+
*/
|
|
1014
|
+
Payment.prototype.updatePaymentLink = function (req, config) {
|
|
1015
|
+
var _a, _b;
|
|
1016
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1017
|
+
var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
|
|
1018
|
+
var _d;
|
|
1019
|
+
return __generator(this, function (_e) {
|
|
1020
|
+
switch (_e.label) {
|
|
1021
|
+
case 0:
|
|
1022
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
1023
|
+
req = new operations.UpdatePaymentLinkRequest(req);
|
|
1024
|
+
}
|
|
1025
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
1026
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/link/{id}", req);
|
|
1027
|
+
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
1028
|
+
try {
|
|
1029
|
+
_d = __read(utils.serializeRequestBody(req, "paymentLink", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
1030
|
+
}
|
|
1031
|
+
catch (e) {
|
|
1032
|
+
if (e instanceof Error) {
|
|
1033
|
+
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
client = this.sdkConfiguration.defaultClient;
|
|
1037
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
1038
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
1039
|
+
return [4 /*yield*/, globalSecurity()];
|
|
1040
|
+
case 1:
|
|
1041
|
+
globalSecurity = _e.sent();
|
|
1042
|
+
_e.label = 2;
|
|
1043
|
+
case 2:
|
|
1044
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
1045
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
1046
|
+
}
|
|
1047
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
1048
|
+
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
1049
|
+
headers["Accept"] = "application/json";
|
|
1050
|
+
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
1051
|
+
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
1052
|
+
case 3:
|
|
1053
|
+
httpRes = _e.sent();
|
|
1054
|
+
responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
1055
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
1056
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
1057
|
+
}
|
|
1058
|
+
res = new operations.UpdatePaymentLinkResponse({
|
|
1059
|
+
statusCode: httpRes.status,
|
|
1060
|
+
contentType: responseContentType,
|
|
1061
|
+
rawResponse: httpRes,
|
|
1062
|
+
});
|
|
1063
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
1064
|
+
switch (true) {
|
|
1065
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
1066
|
+
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
1067
|
+
res.paymentLink = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentLink);
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|
|
1071
|
+
}
|
|
1072
|
+
break;
|
|
1073
|
+
case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
1074
|
+
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
1075
|
+
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
1076
|
+
}
|
|
1077
|
+
return [2 /*return*/, res];
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
});
|
|
1081
|
+
};
|
|
430
1082
|
/**
|
|
431
1083
|
* Update a payment
|
|
432
1084
|
*/
|
|
433
|
-
Payment.prototype.
|
|
1085
|
+
Payment.prototype.updatePaymentPayment = function (req, config) {
|
|
434
1086
|
var _a, _b;
|
|
435
1087
|
return __awaiter(this, void 0, void 0, function () {
|
|
436
1088
|
var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
|
|
@@ -439,13 +1091,13 @@ var Payment = /** @class */ (function () {
|
|
|
439
1091
|
switch (_e.label) {
|
|
440
1092
|
case 0:
|
|
441
1093
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
442
|
-
req = new operations.
|
|
1094
|
+
req = new operations.UpdatePaymentPaymentRequest(req);
|
|
443
1095
|
}
|
|
444
1096
|
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
445
|
-
operationUrl = utils.generateURL(baseURL, "/
|
|
1097
|
+
operationUrl = utils.generateURL(baseURL, "/payment/{connection_id}/payment/{id}", req);
|
|
446
1098
|
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
447
1099
|
try {
|
|
448
|
-
_d = __read(utils.serializeRequestBody(req, "
|
|
1100
|
+
_d = __read(utils.serializeRequestBody(req, "paymentPayment", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
449
1101
|
}
|
|
450
1102
|
catch (e) {
|
|
451
1103
|
if (e instanceof Error) {
|
|
@@ -474,7 +1126,7 @@ var Payment = /** @class */ (function () {
|
|
|
474
1126
|
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
475
1127
|
throw new Error("status code not found in response: ".concat(httpRes));
|
|
476
1128
|
}
|
|
477
|
-
res = new operations.
|
|
1129
|
+
res = new operations.UpdatePaymentPaymentResponse({
|
|
478
1130
|
statusCode: httpRes.status,
|
|
479
1131
|
contentType: responseContentType,
|
|
480
1132
|
rawResponse: httpRes,
|
|
@@ -483,7 +1135,7 @@ var Payment = /** @class */ (function () {
|
|
|
483
1135
|
switch (true) {
|
|
484
1136
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
485
1137
|
if (utils.matchContentType(responseContentType, "application/json")) {
|
|
486
|
-
res.
|
|
1138
|
+
res.paymentPayment = utils.objectToClass(JSON.parse(decodedRes), shared.PaymentPayment);
|
|
487
1139
|
}
|
|
488
1140
|
else {
|
|
489
1141
|
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
|