* feat: Add DiscountCondition entity + Join table per relation (#1146) * feat: Convert DiscountService to TypeScript (#1149) * feat: Add DiscountRepository + bulk insert and remove (#1156) * feat: Add `conditions` to payload in `POST /discounts` and `POST /discounts/:id` (#1170) * feat: Add DiscountRuleCondition entity * fix relation * fix join key * Add discount rule condition repo * add join table per relation * Convert DiscountService to TypeScript * feat: Add DiscountConditionRepository * Add migration + remove use of valid_for * revert changes to files, not done yet * init work on create discount endpoint * Add conditions to create discount endpoint * Add conditions to update discount endpoint * Add unique constraint to discount condition * integration tests passing * fix imports of models * fix tests (excluding totals calculations) * Fix commented code * add unique constraint on discount condition * Add generic way of generating retrieve configs * Requested changes + ExactlyOne validator * Remove isLocal flag from error handler * Use postgres error constant * remove commented code * feat: Add `isValidForProduct` to check if Discount is valid for a given Product (#1172) * feat: Add `canApplyForCustomer` to check if Discount is valid for customer groups (#1212) * feat: Add `calculateDiscountForLineItem` (#1224) * feat: Adds discount condition test factory (#1228) * Remove use of valid_for * Tests passing * Remove valid_for form relations * Add integration tests for applying discounts to cart
medusa-plugin-sendgrid
Sendgrid Plugin for Medusa to send transactional emails.
If no values are defined for a given option, the plugin will not try to send an email for that event.
Plugin Options
{
api_key: [your sendgrid api key] (required),
from: [the from field, i.e. ACME <acme@mail.com>] (required),
gift_card_created_template: [used on gift_card.created],
order_placed_template: [used on order.placed],
order_cancelled_template: [used on order.cancelled],
order_shipped_template: [used on order.shipment_created],
order_completed_template: [used on order.completed],
user_password_reset_template: [used on user.password_reset],
customer_password_reset_template: [used on customer.password_reset],
localization: {
"de-DE": { // locale key
gift_card_created_template: [used on gift_card.created],
order_placed_template: [used on order.placed],
order_cancelled_template: [used on order.cancelled],
order_shipped_template: [used on order.shipment_created],
order_completed_template: [used on order.completed],
user_password_reset_template: [used on user.password_reset],
customer_password_reset_template: [used on customer.password_reset],
}
}
}
Dynamic usage
You can resolve the SendGrid service to dynamically send emails via sendgrid.
Example:
const sendgridService = scope.resolve("sendgridService")
sendgridService.sendEmail("d-123....", "ACME <acme@mail.com>", "customer@mail.com", { dynamic: "data" })