fix(slack): show discount code flag
This commit is contained in:
1 parent
1b00f967de
commit
b5bf650ec2
1 file changed
+14
-10
@@ -6,6 +6,8 @@ class SlackService extends BaseService {
|
|||||||
/**
|
/**
|
||||||
* @param {Object} options - options defined in `medusa-config.js`
|
* @param {Object} options - options defined in `medusa-config.js`
|
||||||
* {
|
* {
|
||||||
|
* show_discount_code: If set to true the discount code used will be
|
||||||
|
* displayed in the order channel.
|
||||||
* slack_url: "https://hooks.slack.com/services/...",
|
* slack_url: "https://hooks.slack.com/services/...",
|
||||||
* admin_orders_url: "https:..../orders"
|
* admin_orders_url: "https:..../orders"
|
||||||
* }
|
* }
|
||||||
@@ -119,17 +121,19 @@ class SlackService extends BaseService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
order.discounts.forEach((d) => {
|
if (this.options_.show_discount_code) {
|
||||||
blocks.push({
|
order.discounts.forEach((d) => {
|
||||||
type: "section",
|
blocks.push({
|
||||||
text: {
|
type: "section",
|
||||||
type: "mrkdwn",
|
text: {
|
||||||
text: `*Promo Code*\t${d.code} ${d.rule.value}${
|
type: "mrkdwn",
|
||||||
d.rule.type === "percentage" ? "%" : ` ${currencyCode}`
|
text: `*Promo Code*\t${d.code} ${d.rule.value}${
|
||||||
}`,
|
d.rule.type === "percentage" ? "%" : ` ${currencyCode}`
|
||||||
},
|
}`,
|
||||||
|
},
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
blocks.push({
|
blocks.push({
|
||||||
type: "divider",
|
type: "divider",
|
||||||
|
|||||||
Reference in new issue
Block a user