@arc-publishing/sdk-sales
Version:
JS Sales SDK for working with Arc Subs Sales API
41 lines • 2.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var APIErrorResponse_1 = require("@arc-publishing/sdk-subs-core/lib/utils/APIErrorResponse");
var JSONResponseHandler_1 = tslib_1.__importDefault(require("@arc-publishing/sdk-subs-core/lib/utils/JSONResponseHandler"));
var constants_1 = require("./constants");
var utils_1 = require("./utils");
var SingletonFetch_1 = tslib_1.__importDefault(require("../serviceHelpers/SingletonFetch"));
var sales_1 = tslib_1.__importDefault(require("./sales"));
function finalizePaymentUpdate3ds(paymentID, paymentMethodID, token, options, spreedlySuccess) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var body, requestOpts;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
body = spreedlySuccess
? JSON.stringify(tslib_1.__assign(tslib_1.__assign({}, options), { token: token, SPREEDLY_SUCCEEDED: true }))
: JSON.stringify(tslib_1.__assign(tslib_1.__assign({}, options), { token: token }));
return [4, (0, utils_1.getOptions)({
method: 'PUT',
headers: constants_1.headers,
body: body
})];
case 1:
requestOpts = _a.sent();
return [2, (0, SingletonFetch_1.default)("".concat(sales_1.default.apiOrigin, "/sales/public/v1/paymentmethod/").concat(paymentID, "/provider/").concat(paymentMethodID, "/finalize3ds"), requestOpts, 'finalizePaymentUpdate3ds')
.then(JSONResponseHandler_1.default)
.then(function (json) {
if ((0, APIErrorResponse_1.isAPIErrorResponse)(json)) {
throw json;
}
else {
return json;
}
})];
}
});
});
}
exports.default = finalizePaymentUpdate3ds;
//# sourceMappingURL=finalizePaymentUpdate3ds.js.map