@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
18 lines (14 loc) • 534 B
text/typescript
// https://api-reference.datatrans.ch/#operation/Authorize
import { FetchDatatransFn, AuthorizeRequestPayload, AuthorizeResponse } from './types.js';
export default async function authorize({
...payload
}: AuthorizeRequestPayload): Promise<AuthorizeResponse> {
const reqBody = {
...payload,
autoSettle: false,
};
const { fetchDatatrans }: { fetchDatatrans: FetchDatatransFn } = this;
const result = await fetchDatatrans('/v1/transactions/authorize', reqBody);
const json = await result.json();
return json;
}