feat(automations): auto-email invoice on wire-transfer placed and on fulfillment
- New ShopSettings fields: autoEmailOnWireTransferPlaced, autoEmailOnFulfilledNonWireTransfer, wireTransferGatewayNames. - New Automations section in settings with two toggles + gateway list. - orders/create webhook now fires automation 1 (wire-transfer placed). - New orders/fulfilled webhook fires automation 2 (non-wire-transfer fulfilled). - Shared helper services/invoice/automations.server.ts handles classification and idempotent generate+send (skips if already sent). - Webhook subscription for orders/fulfilled added to all 3 app tomls. This is the non-Plus fallback for Shopify Flow, whose custom-app actions are gated to Plus stores only.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "ShopSettings" ADD COLUMN "autoEmailOnWireTransferPlaced" BOOLEAN NOT NULL DEFAULT false;
|
||||
ALTER TABLE "ShopSettings" ADD COLUMN "autoEmailOnFulfilledNonWireTransfer" BOOLEAN NOT NULL DEFAULT false;
|
||||
ALTER TABLE "ShopSettings" ADD COLUMN "wireTransferGatewayNames" TEXT NOT NULL DEFAULT '';
|
||||
@@ -99,6 +99,17 @@ model ShopSettings {
|
||||
emailSubjectEn String @default("")
|
||||
emailBodyHtmlEn String @default("")
|
||||
|
||||
// Automations (webhook-driven, as a fallback to Shopify Flow which only
|
||||
// exposes custom-app actions on Plus stores).
|
||||
// 1) Wire-transfer order is placed → auto-email the invoice immediately.
|
||||
autoEmailOnWireTransferPlaced Boolean @default(false)
|
||||
// 2) Order is fulfilled and is NOT a wire-transfer order → auto-email.
|
||||
autoEmailOnFulfilledNonWireTransfer Boolean @default(false)
|
||||
// Comma-separated list of payment-gateway names treated as "wire transfer"
|
||||
// (matched case-insensitively, substring). Empty falls back to a sensible
|
||||
// default ("manual,Überweisung,Wire Transfer,Bank Transfer,Vorkasse,Bank Deposit").
|
||||
wireTransferGatewayNames String @default("")
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user