Skip to content

Commit

Permalink
Merge pull request #13 from calimania/feat/markket-content-type
Browse files Browse the repository at this point in the history
changed format of logger
  • Loading branch information
dvidsilva authored Jan 5, 2025
2 parents aa8e5be + b652e50 commit 9047cb5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/api/markket/controllers/markket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,27 @@ module.exports = createCoreController(modelId, ({ strapi }) => ({
console.log(`markket.create:${body.action || 'default'}`);

if (body?.action === 'stripe.link') {
link = await createPaymentLinkWithPriceIds(body?.prices || [], !!body?.includes_shipping, !!body?.stripe_test);
const response = await createPaymentLinkWithPriceIds(body?.prices || [], !!body?.includes_shipping, !!body?.stripe_test);
link = {
response,
body,
};
message = 'stripe link created';
}

if (body?.action === 'stripe.receipt' && body?.session_id) {
link = await getSessionById(body?.session_id, body?.session_id?.includes('cs_test'));
const response = await getSessionById(body?.session_id, body?.session_id?.includes('cs_test'));
link = {
response,
body,
};
message = 'stripe session retrieved';
}

if (body?.action == 'stripe:checkout.session.completed') {
// @TODO: Created Order record
const sendEmail = await sendOrderNotification({ strapi, order: body });
link = { body, sendEmail };
const response = await sendOrderNotification({ strapi, order: body });
link = { body, response };
}

// Create a markket transaction record
Expand Down

0 comments on commit 9047cb5

Please sign in to comment.