@unchainedshop/plugins
Version:
Because of a Typescript issue with upstream "postfinancecheckout", the Postfinance plugin has been disabled from transpilation, import the source ts files from src and enable node_module tsc or copy over the src/payment/postfinance-checkout to your projec
14 lines (12 loc) • 494 B
text/typescript
import { FetchDatatransFn, CancelRequestPayload, CancelResponse } from './types.js';
export default async function cancel({
transactionId,
...payload
}: CancelRequestPayload): Promise<CancelResponse> {
const reqBody = payload;
const { fetchDatatrans }: { fetchDatatrans: FetchDatatransFn } = this;
const result = await fetchDatatrans(`/v1/transactions/${transactionId}/cancel`, reqBody);
if (result.status === 204) return true;
const json = await result.json();
return json;
}