UNPKG

@arc-publishing/sdk-sales

Version:
36 lines 1.67 kB
import { __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 initializePaymentUpdate(paymentID, paymentMethodID) { return __awaiter(this, void 0, void 0, function () { var url, fetchOptions; return __generator(this, function (_a) { switch (_a.label) { case 0: url = "".concat(Sales.apiOrigin, "/sales/public/v1/paymentmethod/").concat(paymentID, "/provider/").concat(paymentMethodID); return [4, getOptions({ method: 'PUT', headers: headers, body: JSON.stringify({}) })]; case 1: fetchOptions = _a.sent(); return [2, SingletonFetch(url, fetchOptions, 'initializePaymentUpdate') .then(JSONResponseHandler) .then(function (json) { if (isAPIErrorResponse(json)) { throw json; } else { return json; } })]; } }); }); } //# sourceMappingURL=initializePaymentUpdate.js.map