shippin address
This commit is contained in:
parent
ef3ddc6669
commit
b560d3a324
@ -225,10 +225,41 @@ export const checkout = async (req, res) => {
|
|||||||
? item?.variant?.gst_Id?.tax
|
? item?.variant?.gst_Id?.tax
|
||||||
: item?.product?.master_GST?.tax
|
: item?.product?.master_GST?.tax
|
||||||
)) /
|
)) /
|
||||||
100
|
100
|
||||||
)?.toFixed(2),
|
)?.toFixed(2),
|
||||||
total_gst_amount: Number(
|
total_gst_amount: Number(
|
||||||
Number(item?.quantity) *
|
Number(item?.quantity) *
|
||||||
|
Number(
|
||||||
|
(Number(
|
||||||
|
item?.variant?.price
|
||||||
|
? item?.variant?.price
|
||||||
|
: item?.product?.master_price
|
||||||
|
) *
|
||||||
|
Number(
|
||||||
|
item?.variant?.gst_Id?.tax
|
||||||
|
? item?.variant?.gst_Id?.tax
|
||||||
|
: item?.product?.master_GST?.tax
|
||||||
|
)) /
|
||||||
|
100
|
||||||
|
)
|
||||||
|
)?.toFixed(2),
|
||||||
|
gst_rate: item?.variant?.gst_Id?.tax
|
||||||
|
? item?.variant?.gst_Id?.tax
|
||||||
|
: item?.product?.master_GST?.tax,
|
||||||
|
tax_Name: item?.variant?.gst_Id?.name
|
||||||
|
? item?.variant?.gst_Id?.name
|
||||||
|
: item?.product?.master_GST?.name,
|
||||||
|
product_Subtotal: Number(
|
||||||
|
Number(
|
||||||
|
item.quantity *
|
||||||
|
Number(
|
||||||
|
item?.variant?.price
|
||||||
|
? item?.variant?.price
|
||||||
|
: item?.product?.master_price
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
Number(
|
||||||
|
Number(item.quantity) *
|
||||||
Number(
|
Number(
|
||||||
(Number(
|
(Number(
|
||||||
item?.variant?.price
|
item?.variant?.price
|
||||||
@ -240,40 +271,9 @@ export const checkout = async (req, res) => {
|
|||||||
? item?.variant?.gst_Id?.tax
|
? item?.variant?.gst_Id?.tax
|
||||||
: item?.product?.master_GST?.tax
|
: item?.product?.master_GST?.tax
|
||||||
)) /
|
)) /
|
||||||
100
|
100
|
||||||
)
|
|
||||||
)?.toFixed(2),
|
|
||||||
gst_rate: item?.variant?.gst_Id?.tax
|
|
||||||
? item?.variant?.gst_Id?.tax
|
|
||||||
: item?.product?.master_GST?.tax,
|
|
||||||
tax_Name: item?.variant?.gst_Id?.name
|
|
||||||
? item?.variant?.gst_Id?.name
|
|
||||||
: item?.product?.master_GST?.name,
|
|
||||||
product_Subtotal: Number(
|
|
||||||
Number(
|
|
||||||
item.quantity *
|
|
||||||
Number(
|
|
||||||
item?.variant?.price
|
|
||||||
? item?.variant?.price
|
|
||||||
: item?.product?.master_price
|
|
||||||
)
|
|
||||||
) +
|
|
||||||
Number(
|
|
||||||
Number(item.quantity) *
|
|
||||||
Number(
|
|
||||||
(Number(
|
|
||||||
item?.variant?.price
|
|
||||||
? item?.variant?.price
|
|
||||||
: item?.product?.master_price
|
|
||||||
) *
|
|
||||||
Number(
|
|
||||||
item?.variant?.gst_Id?.tax
|
|
||||||
? item?.variant?.gst_Id?.tax
|
|
||||||
: item?.product?.master_GST?.tax
|
|
||||||
)) /
|
|
||||||
100
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
)?.toFixed(2),
|
)?.toFixed(2),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -384,40 +384,31 @@ export const paymentVerification = async (req, res) => {
|
|||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
|
|
||||||
subject: `Your Order #${findSameOrder?.orderID} Confirmation`,
|
subject: `Your Order #${findSameOrder?.orderID} Confirmation`,
|
||||||
html: ` <h1 style="color: #333; text-align: center; font-family: Arial, sans-serif;">Welcome to Smellika - Let the Shopping Begin!</h1>
|
html: ` <h1 style="color: #333; text-align: center; font-family: Arial, sans-serif;">Welcome to Tavisa - Let the Shopping Begin!</h1>
|
||||||
<strong style="color: #1b03a3; font-size: 16px"> Hi ${
|
<strong style="color: #1b03a3; font-size: 16px"> Hi ${findSameOrder?.shippingInfo?.first_Name
|
||||||
findSameOrder?.shippingInfo?.first_Name
|
},</strong>
|
||||||
},</strong>
|
|
||||||
|
|
||||||
<p style="color: #555; font-size: 15px;">Great news! Your order #${
|
<p style="color: #555; font-size: 15px;">Great news! Your order #${findSameOrder?.orderID
|
||||||
findSameOrder?.orderID
|
|
||||||
} has been confirmed. Here are the details</p>
|
} has been confirmed. Here are the details</p>
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Shipping Address : ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Shipping Address : ${findSameOrder?.shippingInfo?.first_Name
|
||||||
findSameOrder?.shippingInfo?.first_Name
|
} ${findSameOrder?.shippingInfo?.last_Name} , ${findSameOrder?.shippingInfo?.street
|
||||||
} ${findSameOrder?.shippingInfo?.last_Name} , ${
|
} ${findSameOrder?.shippingInfo?.city} ${findSameOrder?.shippingInfo?.state
|
||||||
findSameOrder?.shippingInfo?.street
|
} ${findSameOrder?.shippingInfo?.country}, PIN-${findSameOrder?.shippingInfo?.postalCode
|
||||||
} ${findSameOrder?.shippingInfo?.city} ${
|
}, Phone Number: ${findSameOrder?.shippingInfo?.phone_Number}
|
||||||
findSameOrder?.shippingInfo?.state
|
${findSameOrder?.shippingInfo?.company_name
|
||||||
} ${findSameOrder?.shippingInfo?.country}, PIN-${
|
? ",Company Name :" + findSameOrder?.shippingInfo?.company_name + ""
|
||||||
findSameOrder?.shippingInfo?.postalCode
|
: ""
|
||||||
}, Phone Number: ${findSameOrder?.shippingInfo?.phone_Number}
|
} ${findSameOrder?.shippingInfo?.gst_number
|
||||||
${
|
|
||||||
findSameOrder?.shippingInfo?.company_name
|
|
||||||
? ",Company Name :" + findSameOrder?.shippingInfo?.company_name + ""
|
|
||||||
: ""
|
|
||||||
} ${
|
|
||||||
findSameOrder?.shippingInfo?.gst_number
|
|
||||||
? ", GST_NO:" + findSameOrder?.shippingInfo?.gst_number
|
? ", GST_NO:" + findSameOrder?.shippingInfo?.gst_number
|
||||||
: ""
|
: ""
|
||||||
}</h4>
|
}</h4>
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;"> Any Discount : ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;"> Any Discount : ${findSameOrder?.isCouponUsed
|
||||||
findSameOrder?.isCouponUsed
|
|
||||||
? "Yes ,₹" +
|
? "Yes ,₹" +
|
||||||
Number(findSameOrder?.couponUsed?.discount_amount) +
|
Number(findSameOrder?.couponUsed?.discount_amount) +
|
||||||
" , COUPON_CODE:" +
|
" , COUPON_CODE:" +
|
||||||
findSameOrder?.couponUsed?.coupon_code
|
findSameOrder?.couponUsed?.coupon_code
|
||||||
: "No Discount"
|
: "No Discount"
|
||||||
}</h4>
|
}</h4>
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Order Items :</h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Order Items :</h4>
|
||||||
<table style="border-collapse: collapse; width: 100%;">
|
<table style="border-collapse: collapse; width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
@ -439,47 +430,37 @@ export const paymentVerification = async (req, res) => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
${findSameOrder?.orderItems
|
${findSameOrder?.orderItems
|
||||||
?.map(
|
?.map(
|
||||||
(product, index) => `
|
(product, index) => `
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${index + 1
|
||||||
index + 1
|
|
||||||
}</td>
|
}</td>
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.name
|
||||||
product.name
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product?.variant_Name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
}</td>
|
||||||
product?.variant_Name
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${product?.image[0]?.url
|
||||||
}</td>
|
}" alt="${product.name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${
|
}" style="max-width: 40px; height: auto;"></td>
|
||||||
product?.image[0]?.url
|
|
||||||
}" alt="${
|
|
||||||
product.name
|
|
||||||
}" style="max-width: 40px; height: auto;"></td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.quantity
|
||||||
product.quantity
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.price
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
}</td>
|
||||||
product.price
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product?.gst_amount
|
||||||
}</td>
|
}</td>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product?.product_Subtotal
|
||||||
product?.gst_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
|
||||||
product?.product_Subtotal
|
|
||||||
}</td>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.join("")}
|
.join("")}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${findSameOrder?.total_amount
|
||||||
findSameOrder?.total_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -487,7 +468,7 @@ export const paymentVerification = async (req, res) => {
|
|||||||
<br/>
|
<br/>
|
||||||
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
||||||
|
|
||||||
<span style="color: #555; font-size: 13px;">Team Smellika</span>`,
|
<span style="color: #555; font-size: 13px;">Team Tavisa</span>`,
|
||||||
});
|
});
|
||||||
// console.log("findSameOrder", findSameOrder);
|
// console.log("findSameOrder", findSameOrder);
|
||||||
|
|
||||||
@ -501,7 +482,7 @@ export const paymentVerification = async (req, res) => {
|
|||||||
// razorpay_signature,
|
// razorpay_signature,
|
||||||
// });
|
// });
|
||||||
|
|
||||||
res.redirect(`https://smellika.com/shop`);
|
res.redirect(`https://ayurpulse-website.netlify.app/shop`);
|
||||||
// res.redirect(
|
// res.redirect(
|
||||||
// `http://localhost:5173/cart/paymentsuccess?reference=${razorpay_payment_id}`
|
// `http://localhost:5173/cart/paymentsuccess?reference=${razorpay_payment_id}`
|
||||||
// );
|
// );
|
||||||
@ -554,39 +535,30 @@ export const pospaymentVerification = async (req, res) => {
|
|||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
|
|
||||||
subject: `Your Order #${findSameOrder?.orderID} Confirmation`,
|
subject: `Your Order #${findSameOrder?.orderID} Confirmation`,
|
||||||
html: ` <h1 style="color: #333; text-align: center; font-family: Arial, sans-serif;">Welcome to Smellika - Let the Shopping Begin!</h1>
|
html: ` <h1 style="color: #333; text-align: center; font-family: Arial, sans-serif;">Welcome to Tavisa - Let the Shopping Begin!</h1>
|
||||||
<strong style="color: #1b03a3; font-size: 16px"> Hi ${
|
<strong style="color: #1b03a3; font-size: 16px"> Hi ${findSameOrder?.shippingInfo?.first_Name
|
||||||
findSameOrder?.shippingInfo?.first_Name
|
},</strong>
|
||||||
},</strong>
|
|
||||||
|
|
||||||
<p style="color: #555; font-size: 15px;">Great news! Your order #${
|
<p style="color: #555; font-size: 15px;">Great news! Your order #${findSameOrder?.orderID
|
||||||
findSameOrder?.orderID
|
|
||||||
} has been confirmed. Here are the details</p>
|
} has been confirmed. Here are the details</p>
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Shipping Address : ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Shipping Address : ${findSameOrder?.shippingInfo?.first_Name
|
||||||
findSameOrder?.shippingInfo?.first_Name
|
} ${findSameOrder?.shippingInfo?.last_Name} , ${findSameOrder?.shippingInfo?.street
|
||||||
} ${findSameOrder?.shippingInfo?.last_Name} , ${
|
} ${findSameOrder?.shippingInfo?.city} ${findSameOrder?.shippingInfo?.state
|
||||||
findSameOrder?.shippingInfo?.street
|
} ${findSameOrder?.shippingInfo?.country}, PIN-${findSameOrder?.shippingInfo?.postalCode
|
||||||
} ${findSameOrder?.shippingInfo?.city} ${
|
}, Phone Number: ${findSameOrder?.shippingInfo?.phone_Number}
|
||||||
findSameOrder?.shippingInfo?.state
|
${findSameOrder?.shippingInfo?.company_name
|
||||||
} ${findSameOrder?.shippingInfo?.country}, PIN-${
|
? ",Company Name :" + findSameOrder?.shippingInfo?.company_name + ""
|
||||||
findSameOrder?.shippingInfo?.postalCode
|
: ""
|
||||||
}, Phone Number: ${findSameOrder?.shippingInfo?.phone_Number}
|
} ${findSameOrder?.shippingInfo?.gst_number
|
||||||
${
|
|
||||||
findSameOrder?.shippingInfo?.company_name
|
|
||||||
? ",Company Name :" + findSameOrder?.shippingInfo?.company_name + ""
|
|
||||||
: ""
|
|
||||||
} ${
|
|
||||||
findSameOrder?.shippingInfo?.gst_number
|
|
||||||
? ", GST_NO:" + findSameOrder?.shippingInfo?.gst_number
|
? ", GST_NO:" + findSameOrder?.shippingInfo?.gst_number
|
||||||
: ""
|
: ""
|
||||||
}</h4>
|
}</h4>
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;"> Any Discount: ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;"> Any Discount: ${findSameOrder?.isCouponUsed
|
||||||
findSameOrder?.isCouponUsed
|
? "Yes ,₹" +
|
||||||
? "Yes ,₹" +
|
Number(findSameOrder?.couponUsed?.discount_amount) +
|
||||||
Number(findSameOrder?.couponUsed?.discount_amount) +
|
" , COUPON_CODE:" +
|
||||||
" , COUPON_CODE:" +
|
findSameOrder?.couponUsed?.coupon_code
|
||||||
findSameOrder?.couponUsed?.coupon_code
|
: "No Discount"
|
||||||
: "No Discount"
|
|
||||||
}</h4>
|
}</h4>
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Order Items :</h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Order Items :</h4>
|
||||||
<table style="border-collapse: collapse; width: 100%;">
|
<table style="border-collapse: collapse; width: 100%;">
|
||||||
@ -609,47 +581,37 @@ export const pospaymentVerification = async (req, res) => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
${findSameOrder?.orderItems
|
${findSameOrder?.orderItems
|
||||||
?.map(
|
?.map(
|
||||||
(product, index) => `
|
(product, index) => `
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${index + 1
|
||||||
index + 1
|
|
||||||
}</td>
|
}</td>
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.name
|
||||||
product.name
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product?.variant_Name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
}</td>
|
||||||
product?.variant_Name
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${product?.image[0]?.url
|
||||||
}</td>
|
}" alt="${product.name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${
|
}" style="max-width: 40px; height: auto;"></td>
|
||||||
product?.image[0]?.url
|
|
||||||
}" alt="${
|
|
||||||
product.name
|
|
||||||
}" style="max-width: 40px; height: auto;"></td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.quantity
|
||||||
product.quantity
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.price
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
}</td>
|
||||||
product.price
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product?.gst_amount
|
||||||
}</td>
|
}</td>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product?.product_Subtotal
|
||||||
product?.gst_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
|
||||||
product?.product_Subtotal
|
|
||||||
}</td>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.join("")}
|
.join("")}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${findSameOrder?.total_amount
|
||||||
findSameOrder?.total_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -657,7 +619,7 @@ export const pospaymentVerification = async (req, res) => {
|
|||||||
<br/>
|
<br/>
|
||||||
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
||||||
|
|
||||||
<span style="color: #555; font-size: 13px;">Team Smellika</span>`,
|
<span style="color: #555; font-size: 13px;">Team Tavisa</span>`,
|
||||||
});
|
});
|
||||||
// console.log("findSameOrder", findSameOrder);
|
// console.log("findSameOrder", findSameOrder);
|
||||||
|
|
||||||
@ -801,24 +763,24 @@ export const webhook = async (req, res) => {
|
|||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
|
|
||||||
subject: `Your Order #${findOrder?.orderID} Confirmation`,
|
subject: `Your Order #${findOrder?.orderID} Confirmation`,
|
||||||
html: ` <h1 style="color: #333; text-align: center; font-family: Arial, sans-serif;">Welcome to Smellika - Let the Shopping Begin!</h1>
|
html: ` <h1 style="color: #333; text-align: center; font-family: Arial, sans-serif;">Welcome to Tavisa - Let the Shopping Begin!</h1>
|
||||||
<strong style="color: #1b03a3; font-size: 16px"> Hi ${findOrder?.shippingInfo?.first_Name},</strong>
|
<strong style="color: #1b03a3; font-size: 16px"> Hi ${findOrder?.shippingInfo?.first_Name},</strong>
|
||||||
|
|
||||||
<p style="color: #555; font-size: 15px;">Great news! Your order #${findOrder?.orderID} has been confirmed. Here are the details</p>
|
<p style="color: #555; font-size: 15px;">Great news! Your order #${findOrder?.orderID} has been confirmed. Here are the details</p>
|
||||||
<br/>
|
<br/>
|
||||||
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
||||||
|
|
||||||
<span style="color: #555; font-size: 13px;">Team Smellika</span>`,
|
<span style="color: #555; font-size: 13px;">Team Tavisa</span>`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Items: [List of Purchased Items]
|
// Items: [List of Purchased Items]
|
||||||
// Total Amount: [Total Amount]
|
// Total Amount: [Total Amount]
|
||||||
// Shipping Address: [Shipping Address]
|
// Shipping Address: [Shipping Address]
|
||||||
|
|
||||||
// We'll keep you updated on the shipping progress. Thanks for choosing Smellika!
|
// We'll keep you updated on the shipping progress. Thanks for choosing Tavisa!
|
||||||
|
|
||||||
// Best regards
|
// Best regards
|
||||||
// Team Smellika
|
// Team Tavisa
|
||||||
console.log(
|
console.log(
|
||||||
"event.data.object",
|
"event.data.object",
|
||||||
event.data.object,
|
event.data.object,
|
||||||
|
@ -173,21 +173,18 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
to: `${order?.user?.email}`, // Change to your recipient
|
to: `${order?.user?.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Order #${order?.orderID} Update: Cancellation and Refund Process`,
|
subject: `Order #${order?.orderID} Update: Cancellation and Refund Process`,
|
||||||
html: `<strong style="color: #1b03a3; font-size: 16px"> Hi ${
|
html: `<strong style="color: #1b03a3; font-size: 16px"> Hi ${order?.shippingInfo?.first_Name
|
||||||
order?.shippingInfo?.first_Name
|
},</strong>
|
||||||
},</strong>
|
<h3 style="color: #333; font-family: Arial, sans-serif;">We hope this message finds you well. We're writing to inform you that your order ${order?.orderID
|
||||||
<h3 style="color: #333; font-family: Arial, sans-serif;">We hope this message finds you well. We're writing to inform you that your order ${
|
} has been canceled. We understand that circumstances may change, and we're here to assist you throughout the process.</h3>
|
||||||
order?.orderID
|
|
||||||
} has been canceled. We understand that circumstances may change, and we're here to assist you throughout the process.</h3>
|
|
||||||
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Any Discount : ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Any Discount : ${order?.isCouponUsed
|
||||||
order?.isCouponUsed
|
? "Yes ,₹" +
|
||||||
? "Yes ,₹" +
|
Number(order?.couponUsed?.discount_amount) +
|
||||||
Number(order?.couponUsed?.discount_amount) +
|
" , COUPON_CODE:" +
|
||||||
" , COUPON_CODE:" +
|
order?.couponUsed?.coupon_code
|
||||||
order?.couponUsed?.coupon_code
|
: "No Discount"
|
||||||
: "No Discount"
|
}</h4>
|
||||||
}</h4>
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;"> Items :</h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;"> Items :</h4>
|
||||||
<table style="border-collapse: collapse; width: 100%;">
|
<table style="border-collapse: collapse; width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
@ -205,53 +202,42 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
${order?.orderItems
|
${order?.orderItems
|
||||||
?.map(
|
?.map(
|
||||||
(product, index) => `
|
(product, index) => `
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${index + 1
|
||||||
index + 1
|
}</td>
|
||||||
}</td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.name
|
||||||
product.name
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product?.variant_Name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
}</td>
|
||||||
product?.variant_Name
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${product?.image[0]?.url
|
||||||
}</td>
|
}" alt="${product.name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${
|
}" style="max-width: 40px; height: auto;"></td>
|
||||||
product?.image[0]?.url
|
|
||||||
}" alt="${
|
|
||||||
product.name
|
|
||||||
}" style="max-width: 40px; height: auto;"></td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.quantity
|
||||||
product.quantity
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.price
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
}</td>
|
||||||
product.price
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product?.gst_amount
|
||||||
}</td>
|
}</td>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.product_Subtotal
|
||||||
product?.gst_amount
|
|
||||||
}</td>
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
|
||||||
product.product_Subtotal
|
|
||||||
}</td>
|
}</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.join("")}
|
.join("")}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${order?.total_amount
|
||||||
order?.total_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Cancellation Reason : ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Cancellation Reason : ${req.body?.ReasonforCancellation
|
||||||
req.body?.ReasonforCancellation
|
}</h4>
|
||||||
}</h4>
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Refund Information: The amount from your canceled order will be processed for a refund. Please allow up to 7 working days for the amount to be transferred back to your original payment method.</h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Refund Information: The amount from your canceled order will be processed for a refund. Please allow up to 7 working days for the amount to be transferred back to your original payment method.</h4>
|
||||||
|
|
||||||
<h5 style="color: #333; font-family: Arial, sans-serif;">If you have any concerns or further questions, please feel free to reply to this email. We appreciate your understanding and hope to serve you better in the future.
|
<h5 style="color: #333; font-family: Arial, sans-serif;">If you have any concerns or further questions, please feel free to reply to this email. We appreciate your understanding and hope to serve you better in the future.
|
||||||
@ -259,7 +245,7 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
<br/>
|
<br/>
|
||||||
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
||||||
|
|
||||||
<span style="color: #555; font-size: 13px;">Team Smellika</span>`,
|
<span style="color: #555; font-size: 13px;">Team Tavisa</span>`,
|
||||||
});
|
});
|
||||||
return res
|
return res
|
||||||
.status(200)
|
.status(200)
|
||||||
@ -271,22 +257,19 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
to: `${order?.user?.email}`, // Change to your recipient
|
to: `${order?.user?.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Your Order #${order?.orderID} is in Processing!`,
|
subject: `Your Order #${order?.orderID} is in Processing!`,
|
||||||
html: ` <h3 style="color: #333; font-family: Arial, sans-serif;">Exciting news! Your order #${
|
html: ` <h3 style="color: #333; font-family: Arial, sans-serif;">Exciting news! Your order #${order?.orderID
|
||||||
order?.orderID
|
} has entered the processing phase. Our team is diligently preparing your items for dispatch. Rest assured, we're working hard to ensure everything is perfect for you.</h3>
|
||||||
} has entered the processing phase. Our team is diligently preparing your items for dispatch. Rest assured, we're working hard to ensure everything is perfect for you.</h3>
|
<strong style="color: #1b03a3; font-size: 16px"> Hi ${order?.shippingInfo?.first_Name
|
||||||
<strong style="color: #1b03a3; font-size: 16px"> Hi ${
|
},</strong>
|
||||||
order?.shippingInfo?.first_Name
|
|
||||||
},</strong>
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Order Status : Processing</h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Order Status : Processing</h4>
|
||||||
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Any Discount : ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Any Discount : ${order?.isCouponUsed
|
||||||
order?.isCouponUsed
|
? "Yes ,₹" +
|
||||||
? "Yes ,₹" +
|
Number(order?.couponUsed?.discount_amount) +
|
||||||
Number(order?.couponUsed?.discount_amount) +
|
" , COUPON_CODE:" +
|
||||||
" , COUPON_CODE:" +
|
order?.couponUsed?.coupon_code
|
||||||
order?.couponUsed?.coupon_code
|
: "No Discount"
|
||||||
: "No Discount"
|
}</h4>
|
||||||
}</h4>
|
|
||||||
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Order Items :</h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Order Items :</h4>
|
||||||
<table style="border-collapse: collapse; width: 100%;">
|
<table style="border-collapse: collapse; width: 100%;">
|
||||||
@ -308,57 +291,47 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
${order?.orderItems
|
${order?.orderItems
|
||||||
?.map(
|
?.map(
|
||||||
(product, index) => `
|
(product, index) => `
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${index + 1
|
||||||
index + 1
|
}</td>
|
||||||
}</td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.name
|
||||||
product.name
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product?.variant_Name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
}</td>
|
||||||
product?.variant_Name
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${product?.image[0]?.url
|
||||||
}</td>
|
}" alt="${product.name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${
|
}" style="max-width: 40px; height: auto;"></td>
|
||||||
product?.image[0]?.url
|
|
||||||
}" alt="${
|
|
||||||
product.name
|
|
||||||
}" style="max-width: 40px; height: auto;"></td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.quantity
|
||||||
product.quantity
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.price
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
}</td>
|
||||||
product.price
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product?.gst_amount
|
||||||
}</td>
|
}</td>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.product_Subtotal
|
||||||
product?.gst_amount
|
|
||||||
}</td>
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
|
||||||
product.product_Subtotal
|
|
||||||
}</td>
|
}</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.join("")}
|
.join("")}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${order?.total_amount
|
||||||
order?.total_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h5 style="color: #333; font-family: Arial, sans-serif;">We'll send you another email with the tracking details as soon as your order is dispatched. If you have any questions or need assistance, feel free to reply to this email.</h5>
|
<h5 style="color: #333; font-family: Arial, sans-serif;">We'll send you another email with the tracking details as soon as your order is dispatched. If you have any questions or need assistance, feel free to reply to this email.</h5>
|
||||||
<h5 style="color: #333; font-family: Arial, sans-serif;">Thank you for choosing Smellika!</h5>
|
<h5 style="color: #333; font-family: Arial, sans-serif;">Thank you for choosing Tavisa!</h5>
|
||||||
<br/>
|
<br/>
|
||||||
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
||||||
|
|
||||||
<span style="color: #555; font-size: 13px;">Team Smellika</span>`,
|
<span style="color: #555; font-size: 13px;">Team Tavisa</span>`,
|
||||||
});
|
});
|
||||||
return res
|
return res
|
||||||
.status(200)
|
.status(200)
|
||||||
@ -394,28 +367,23 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
to: `${order?.user?.email}`, // Change to your recipient
|
to: `${order?.user?.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Your Order #${order?.orderID} is On Its Way!`,
|
subject: `Your Order #${order?.orderID} is On Its Way!`,
|
||||||
html: `<strong style="color: #1b03a3; font-size: 16px"> Hi ${
|
html: `<strong style="color: #1b03a3; font-size: 16px"> Hi ${order?.shippingInfo?.first_Name
|
||||||
order?.shippingInfo?.first_Name
|
},</strong>
|
||||||
},</strong>
|
<h3 style="color: #333; font-family: Arial, sans-serif;">Exciting news! Your order #${order?.orderID
|
||||||
<h3 style="color: #333; font-family: Arial, sans-serif;">Exciting news! Your order #${
|
} has been dispatched and is en route to you. 🚚 Here are the details:</h3>
|
||||||
order?.orderID
|
|
||||||
} has been dispatched and is en route to you. 🚚 Here are the details:</h3>
|
|
||||||
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Courier Name : ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Courier Name : ${req.body.courierName
|
||||||
req.body.courierName
|
} </h4>
|
||||||
} </h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Courier Tracking ID : ${req.body.TrackingID
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Courier Tracking ID : ${
|
}</h4>
|
||||||
req.body.TrackingID
|
|
||||||
}</h4>
|
|
||||||
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Any Discount : ${
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Any Discount : ${order?.isCouponUsed
|
||||||
order?.isCouponUsed
|
? "Yes ,₹" +
|
||||||
? "Yes ,₹" +
|
Number(order?.couponUsed?.discount_amount) +
|
||||||
Number(order?.couponUsed?.discount_amount) +
|
" , COUPON_CODE:" +
|
||||||
" , COUPON_CODE:" +
|
order?.couponUsed?.coupon_code
|
||||||
order?.couponUsed?.coupon_code
|
: "No Discount"
|
||||||
: "No Discount"
|
}</h4>
|
||||||
}</h4>
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;"> Items :</h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;"> Items :</h4>
|
||||||
<table style="border-collapse: collapse; width: 100%;">
|
<table style="border-collapse: collapse; width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
@ -436,59 +404,49 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
${order?.orderItems
|
${order?.orderItems
|
||||||
?.map(
|
?.map(
|
||||||
(product, index) => `
|
(product, index) => `
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${index + 1
|
||||||
index + 1
|
}</td>
|
||||||
}</td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.name
|
||||||
product.name
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product?.variant_Name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
}</td>
|
||||||
product?.variant_Name
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${product?.image[0]?.url
|
||||||
}</td>
|
}" alt="${product.name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${
|
}" style="max-width: 40px; height: auto;"></td>
|
||||||
product?.image[0]?.url
|
|
||||||
}" alt="${
|
|
||||||
product.name
|
|
||||||
}" style="max-width: 40px; height: auto;"></td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.quantity
|
||||||
product.quantity
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.price
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
}</td>
|
||||||
product.price
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product?.gst_amount
|
||||||
}</td>
|
}</td>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.product_Subtotal
|
||||||
product?.gst_amount
|
|
||||||
}</td>
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
|
||||||
product.product_Subtotal
|
|
||||||
}</td>
|
}</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.join("")}
|
.join("")}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${order?.total_amount
|
||||||
order?.total_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="color: #333; font-family: Arial, sans-serif;">Order Status : Dispatched</h3>
|
<h3 style="color: #333; font-family: Arial, sans-serif;">Order Status : Dispatched</h3>
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">If you have any questions or need assistance, feel free to reply to this email.
|
<h4 style="color: #333; font-family: Arial, sans-serif;">If you have any questions or need assistance, feel free to reply to this email.
|
||||||
</h4>
|
</h4>
|
||||||
<h5 style="color: #333; font-family: Arial, sans-serif;">Thanks for choosing Smellika! We hope you enjoy your purchase.
|
<h5 style="color: #333; font-family: Arial, sans-serif;">Thanks for choosing Tavisa! We hope you enjoy your purchase.
|
||||||
</h5>
|
</h5>
|
||||||
<br/>
|
<br/>
|
||||||
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
||||||
|
|
||||||
<span style="color: #555; font-size: 13px;">Team Smellika</span>`,
|
<span style="color: #555; font-size: 13px;">Team Tavisa</span>`,
|
||||||
});
|
});
|
||||||
return res
|
return res
|
||||||
.status(200)
|
.status(200)
|
||||||
@ -501,20 +459,17 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
to: `${order?.user?.email}`, // Change to your recipient
|
to: `${order?.user?.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Your Order #${order?.orderID} Has Been Delivered!`,
|
subject: `Your Order #${order?.orderID} Has Been Delivered!`,
|
||||||
html: `<strong style="color: #1b03a3; font-size: 16px"> Hi ${
|
html: `<strong style="color: #1b03a3; font-size: 16px"> Hi ${order?.shippingInfo?.first_Name
|
||||||
order?.shippingInfo?.first_Name
|
},</strong>
|
||||||
},</strong>
|
<h3 style="color: #333; font-family: Arial, sans-serif;">Great news! Your order #${order?.orderID
|
||||||
<h3 style="color: #333; font-family: Arial, sans-serif;">Great news! Your order #${
|
} has been successfully delivered to your doorstep. We hope everything is just as you expected!</h3>
|
||||||
order?.orderID
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Any Discount : ${order?.isCouponUsed
|
||||||
} has been successfully delivered to your doorstep. We hope everything is just as you expected!</h3>
|
? "Yes ,₹" +
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Any Discount : ${
|
Number(order?.couponUsed?.discount_amount) +
|
||||||
order?.isCouponUsed
|
" , COUPON_CODE:" +
|
||||||
? "Yes ,₹" +
|
order?.couponUsed?.coupon_code
|
||||||
Number(order?.couponUsed?.discount_amount) +
|
: "No Discount"
|
||||||
" , COUPON_CODE:" +
|
}</h4>
|
||||||
order?.couponUsed?.coupon_code
|
|
||||||
: "No Discount"
|
|
||||||
}</h4>
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;"> Items :</h4>
|
<h4 style="color: #333; font-family: Arial, sans-serif;"> Items :</h4>
|
||||||
<table style="border-collapse: collapse; width: 100%;">
|
<table style="border-collapse: collapse; width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
@ -537,34 +492,25 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
?.map(
|
?.map(
|
||||||
(product, index) => `
|
(product, index) => `
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${index + 1
|
||||||
index + 1
|
}</td>
|
||||||
}</td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.name
|
||||||
product.name
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product?.variant_Name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
}</td>
|
||||||
product?.variant_Name
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${product?.image[0]?.url
|
||||||
}</td>
|
}" alt="${product.name
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;"><img src="${
|
}" style="max-width: 40px; height: auto;"></td>
|
||||||
product?.image[0]?.url
|
|
||||||
}" alt="${
|
|
||||||
product.name
|
|
||||||
}" style="max-width: 40px; height: auto;"></td>
|
|
||||||
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">${product.quantity
|
||||||
product.quantity
|
}</td>
|
||||||
}</td>
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.price
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
}</td>
|
||||||
product.price
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product?.gst_amount
|
||||||
}</td>
|
}</td>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${product.product_Subtotal
|
||||||
product?.gst_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
|
||||||
product.product_Subtotal
|
|
||||||
}</td>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
`
|
`
|
||||||
@ -572,26 +518,24 @@ export const updateOrderStatusById = async (req, res) => {
|
|||||||
.join("")}
|
.join("")}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
<th colspan="7" style="border: 1px solid #555; padding: 2px; text-align: right;">Total Amount :</th>
|
||||||
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${
|
<td style="border: 1px solid #555; padding: 2px; text-align: center;">₹${order?.total_amount
|
||||||
order?.total_amount
|
}</td>
|
||||||
}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="color: #333; font-family: Arial, sans-serif;">Delivery Date: ${
|
<h3 style="color: #333; font-family: Arial, sans-serif;">Delivery Date: ${req.body.DDate
|
||||||
req.body.DDate
|
}</h3>
|
||||||
}</h3>
|
|
||||||
<h4 style="color: #333; font-family: Arial, sans-serif;">Your satisfaction is our priority, and we'd love to hear about your experience. Please take a moment to share your thoughts by leaving a review. Your feedback is invaluable to us!
|
<h4 style="color: #333; font-family: Arial, sans-serif;">Your satisfaction is our priority, and we'd love to hear about your experience. Please take a moment to share your thoughts by leaving a review. Your feedback is invaluable to us!
|
||||||
</h4>
|
</h4>
|
||||||
<h5 style="color: #333; font-family: Arial, sans-serif;">If you have any questions or concerns about your order, feel free to reply to this email.
|
<h5 style="color: #333; font-family: Arial, sans-serif;">If you have any questions or concerns about your order, feel free to reply to this email.
|
||||||
</h5>
|
</h5>
|
||||||
<h5 style="color: #333; font-family: Arial, sans-serif;">Thank you for choosing Smellika! We hope to serve you again soon.
|
<h5 style="color: #333; font-family: Arial, sans-serif;">Thank you for choosing Tavisa! We hope to serve you again soon.
|
||||||
|
|
||||||
</h5>
|
</h5>
|
||||||
<br/>
|
<br/>
|
||||||
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
<span style="color: #555; font-size: 13px;">Best regards,</span><br/>
|
||||||
|
|
||||||
<span style="color: #555; font-size: 13px;">Team Smellika</span>`,
|
<span style="color: #555; font-size: 13px;">Team Tavisa</span>`,
|
||||||
});
|
});
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -50,12 +50,12 @@ const orderSchema = new mongoose.Schema(
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
company_name: {
|
// company_name: {
|
||||||
type: String,
|
// type: String,
|
||||||
},
|
// },
|
||||||
gst_number: {
|
// gst_number: {
|
||||||
type: String,
|
// type: String,
|
||||||
},
|
// },
|
||||||
addressId: {
|
addressId: {
|
||||||
type: mongoose.Schema.ObjectId,
|
type: mongoose.Schema.ObjectId,
|
||||||
ref: "ShippingAddress",
|
ref: "ShippingAddress",
|
||||||
|
@ -38,19 +38,19 @@ const shippingAddressSchema = new mongoose.Schema(
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
company_name: {
|
// company_name: {
|
||||||
type: String,
|
// type: String,
|
||||||
},
|
// },
|
||||||
gst_number: {
|
// gst_number: {
|
||||||
type: String,
|
// type: String,
|
||||||
validate: {
|
// validate: {
|
||||||
validator: function (v) {
|
// validator: function (v) {
|
||||||
// Regular expression for Indian GST number validation
|
// // Regular expression for Indian GST number validation
|
||||||
return /^(\d{2}[A-Z]{5}\d{4}[A-Z]{1}\d[Z]{1}[A-Z\d]{1})$/.test(v);
|
// return /^(\d{2}[A-Z]{5}\d{4}[A-Z]{1}\d[Z]{1}[A-Z\d]{1})$/.test(v);
|
||||||
},
|
// },
|
||||||
message: (props) => `${props.value} is not a valid Indian GST number!`,
|
// message: (props) => `${props.value} is not a valid Indian GST number!`,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
default: {
|
default: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user