UNPKG

sibs-payments

Version:

A payment system module for SIBS payments integration with card tokenization support

38 lines 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Cancellation = Cancellation; const types_1 = require("./types"); async function Cancellation(iam, data) { const now = new Date(); // First, create the refund transaction const auth = await (await fetch(`${types_1.API}/${data.transactionId}/cancellation`, { method: 'POST', headers: { "Content-Type": "application/json", "Authorization": `Bearer ${iam.bearerToken}`, "X-IBM-Client-Id": iam.clientId }, body: JSON.stringify({ "merchant": { "terminalId": iam.terminalId, "channel": "web", "merchantTransactionId": data.customId }, "transaction": { "transactionTimestamp": now.toISOString(), "description": data.description, "moto": false, "amount": { "value": data.value, "currency": data.currency }, "originalTransaction": { "id": data.transactionId, "datetime": now.toISOString() } } }) })).json(); return auth; } //# sourceMappingURL=purchase-cancellation.js.map