@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
28 lines • 893 B
JavaScript
import splitProperties from './splitProperties.js';
import { sha256 } from '@unchainedshop/utils';
export default async function parseRegistrationData(transaction) {
const parsed = Object.entries(transaction).reduce((acc, [objectKey, payload]) => {
const { token, info } = splitProperties({ objectKey, payload });
if (token) {
return {
token,
info,
objectKey,
};
}
return acc;
}, {});
if (parsed.objectKey) {
const _id = await sha256(parsed.token);
return {
...parsed,
_id,
paymentMethod: transaction.paymentMethod,
currency: transaction.currency,
language: transaction.language,
type: transaction.type,
};
}
return null;
}
//# sourceMappingURL=parseRegistrationData.js.map