add env to turn off automatic medipost sending on montonio callback
This commit is contained in:
@@ -30,10 +30,15 @@ const env = () => z
|
||||
error: 'NEXT_PUBLIC_SITE_URL is required',
|
||||
})
|
||||
.min(1),
|
||||
isEnabledDispatchOnMontonioCallback: z
|
||||
.boolean({
|
||||
error: 'MEDIPOST_ENABLE_DISPATCH_ON_MONTONIO_CALLBACK is required',
|
||||
}),
|
||||
})
|
||||
.parse({
|
||||
emailSender: process.env.EMAIL_SENDER,
|
||||
siteUrl: process.env.NEXT_PUBLIC_SITE_URL!,
|
||||
isEnabledDispatchOnMontonioCallback: process.env.MEDIPOST_ENABLE_DISPATCH_ON_MONTONIO_CALLBACK === 'true',
|
||||
});
|
||||
|
||||
const sendEmail = async ({
|
||||
@@ -205,7 +210,9 @@ export async function processMontonioCallback(orderToken: string) {
|
||||
console.error("Missing email to send order result email", orderResult);
|
||||
}
|
||||
|
||||
await sendOrderToMedipost({ medusaOrderId, orderedAnalysisElements });
|
||||
if (env().isEnabledDispatchOnMontonioCallback) {
|
||||
await sendOrderToMedipost({ medusaOrderId, orderedAnalysisElements });
|
||||
}
|
||||
|
||||
return { success: true, orderId };
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user