Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(notification): users receive notifications #32

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 68 additions & 22 deletions server/methods/core/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,31 @@ Meteor.methods({
if (result === 1) {
if (packed) {
// send notification that item has been packed and would be delivered shortly

// Email notification
const options = {
to: order.email,
from: "[email protected]",
subject: "Packed Order",
html: `<div><p>Hello,</p>
<p>Your order of ${order.items.length} item(s) of id ${order._id} has been packed and would be delivered to you shortly.</p>
<strong>
<p>Thanks for shopping with us!</p>
<p>Isildur Reaction Commerce</p>
</strong>
html: `
<div style="border-top: 3px solid #0099cc; margin: 30px 0px 10px 0px; padding-top:10px"></div>

<div style="width: 90%; margin: auto">
<div>
<img src="" alt="logo">
</div>

<h2 style="color: #0099cc; border-bottom: 1px solid grey; padding-bottom: 1%;">Shipping status</h2>
<p>Hi,</p>
<p>Your order of <span style="font-weight: bold;">${order.items.length} item(s)</span> of <span
style="color: #0099cc; text-decoration: underline;"><span
style="font-weight: bold; text-decoration: none;">id:</span> ${order._id}</span> has been packed and would be delivered to you shortly.</p>
<p>Thank You for shopping with us.</p>

<div style="border-top: 3px solid #0099cc; margin: 30px 0px 0px 0px; padding-top:10px"></div>

<p style="font-size: 75%; font-weight: bold">&#169 2017 Reaction Commerce. All rights reserved</p>
<p style="font-size: 50%; font-weight: light">1119 Colorado Ave Ste. 7, Santa Monica, CA 90401</p>

</div>
`
};
Expand Down Expand Up @@ -495,12 +508,26 @@ Meteor.methods({
to: order.email,
from: "[email protected]",
subject: "Delivered Order",
html: `<div><p>Hello,</p>
<p>Your order of ${order.items.length} item(s) of id ${order._id} has been delivered.</p>
<strong>
<p>Thanks for shopping with us!</p>
<p>Isildur Reaction Commerce</p>
</strong>
html: `
<div style="border-top: 3px solid #0099cc; margin: 30px 0px 10px 0px; padding-top:10px"></div>

<div style="width: 90%; margin: auto">
<div>
<img src=${emailLogo} alt="logo">
</div>

<h2 style="color: #0099cc; border-bottom: 1px solid grey; padding-bottom: 1%;">Delivered Order</h2>
<p>Hi,</p>
<p>Your order of <span style="font-weight: bold;">${order.items.length} item(s)</span> of <span
style="color: #0099cc; text-decoration: underline;"><span
style="font-weight: bold; text-decoration: none;">id:</span> ${order._id}</span> has been delivered.</p>
<p>Thank You for shopping with us.</p>

<div style="border-top: 3px solid #0099cc; margin: 30px 0px 0px 0px; padding-top:10px"></div>

<p style="font-size: 75%; font-weight: bold">&#169 2017 Reaction Commerce. All rights reserved</p>
<p style="font-size: 50%; font-weight: light">1119 Colorado Ave Ste. 7, Santa Monica, CA 90401</p>

</div>
`
};
Expand All @@ -511,7 +538,7 @@ Meteor.methods({
message: `Hi ${order.billing[0].address.fullName}. Your order of ${order.items.length} item(s) of id ${order._id} has successfully been delivered. Thanks for shopping with us. `,
number: order.billing[0].address.phone
};
Meteor.call("orders/sendText", textPayload);
// Meteor.call("orders/sendText", textPayload);
}

return true;
Expand Down Expand Up @@ -955,18 +982,37 @@ Meteor.methods({
if (!Reaction.hasPermission("orders")) {
throw new Meteor.Error(403, "Access Denied");
}

// send notification

const options = {
to: order.email,
from: "[email protected]",
subject: "Canceled Order",
html: `<div><p>Hello,</p>
<p>Your order was canceled. Please find the details below</p>
<strong>
<p>Item Ordered: ${order.items[0].title}</p>
<p style="color: red;">Reason: ${cancelComment.body}</p>
<p>Thanks for shopping with us!</p>
<p>Isildur Reaction Commerce</p>
</strong>
html: `
<div style="border-top: 3px solid #0099cc; margin: 30px 0px 10px 0px; padding-top:10px"></div>

<div style="width: 90%; margin: auto">
<div>
<img src="" alt="logo">
</div>

<h2 style="color: #0099cc; border-bottom: 1px solid grey; padding-bottom: 1%;">Canceled Order</h2>
<p>Hi,</p>
<p>Your order of <span style="font-weight: bold;">
${order.items.length} item(s)</span> of <span
style="color: #0099cc; text-decoration: underline;"><span
style="font-weight: bold; text-decoration: none;">id:</span> ${order._id}</span> was canceled. Please find the details below</p>
<strong>
<p>Item Ordered: ${order.items[0].title}</p>
<p style="color: red;">Reason: ${cancelComment.body}</p>
<p>Thank You for shopping with us.</p>

<div style="border-top: 3px solid #0099cc; margin: 30px 0px 0px 0px; padding-top:10px"></div>

<p style="font-size: 75%; font-weight: bold">&#169 2017 Reaction Commerce. All rights reserved</p>
<p style="font-size: 50%; font-weight: light">1119 Colorado Ave Ste. 7, Santa Monica, CA 90401</p>

</div>
`
};
Expand Down