@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
30 lines (24 loc) • 841 B
text/typescript
import { AppleTransaction, AppleTransactionsCollection } from './db/AppleTransactionsCollection.js';
export const configureAppleTransactionsModule = async ({ db }) => {
const AppleTransactions = await AppleTransactionsCollection(db);
return {
findTransactionById: async (transactionIdentifier: string): Promise<AppleTransaction> => {
return AppleTransactions.findOne({ _id: transactionIdentifier });
},
createTransaction: async (doc: AppleTransaction) => {
await AppleTransactions.insertOne({
...doc,
created: new Date(),
});
return doc._id;
},
};
};
export default {
appleTransactions: {
configure: configureAppleTransactionsModule,
},
};
export type AppleTransactionsModule = {
appleTransactions: Awaited<ReturnType<typeof configureAppleTransactionsModule>>;
};