UNPKG

@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

10 lines (8 loc) 463 B
export const buildSignature = async (transactionId, orderPaymentId) => { const payload = [transactionId, orderPaymentId, process.env.SAFERPAY_PW].filter(Boolean).join(':'); const msgUint8 = new TextEncoder().encode(payload); const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8); const hashArray = Array.from(new Uint8Array(hashBuffer)); const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join(''); return hashHex; };