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