diff --git a/scripts/build_ifta_quarterly_campaign.py b/scripts/build_ifta_quarterly_campaign.py index fcaff4c..7dc7570 100644 --- a/scripts/build_ifta_quarterly_campaign.py +++ b/scripts/build_ifta_quarterly_campaign.py @@ -224,11 +224,13 @@ def main() -> int: _reset_cycle_if_new(conn, q, due) coupon = None - if args.start_campaign and not args.preview and not args.dry_run: + if tc.COUPON_ENABLED and args.start_campaign and not args.preview and not args.dry_run: try: coupon = tc.get_or_create_daily_coupon(conn, today) except Exception as exc: # noqa: BLE001 LOG.warning("[ifta] coupon mint failed: %s (sending without)", exc) + elif not tc.COUPON_ENABLED: + LOG.info("[ifta] coupon disabled (CAMPAIGN_ENABLE_COUPON unset) — normal price") cur = conn.cursor() cur.execute(SELECT_SQL, [list(tc.BLOCKED_EMAIL_DOMAINS), touch_no, args.limit]) diff --git a/scripts/build_otc_campaign.py b/scripts/build_otc_campaign.py index 97ca16c..822c4db 100644 --- a/scripts/build_otc_campaign.py +++ b/scripts/build_otc_campaign.py @@ -82,11 +82,13 @@ def main() -> int: conn = psycopg2.connect(tc.DB_URL) coupon = None - if args.start_campaign and not args.preview and not args.dry_run: + if tc.COUPON_ENABLED and args.start_campaign and not args.preview and not args.dry_run: try: coupon = tc.get_or_create_daily_coupon(conn, date.today()) except Exception as exc: # noqa: BLE001 LOG.warning("[otc] coupon mint failed: %s", exc) + elif not tc.COUPON_ENABLED: + LOG.info("[otc] coupon disabled (CAMPAIGN_ENABLE_COUPON unset) — normal price") def attribs(r): si = (r.get("state_inc") or "").strip() diff --git a/scripts/build_trucking_campaigns.py b/scripts/build_trucking_campaigns.py index 4f76146..76c233b 100644 --- a/scripts/build_trucking_campaigns.py +++ b/scripts/build_trucking_campaigns.py @@ -155,6 +155,16 @@ def lp_slug_for(campaign_type: str, phy_state: str | None = None) -> str: # checkout enforce expiry + the service-fee-only scope (pass-through government # fees are never discounted). The code + prices are merged into the email so the # recipient sees a real, expiring deal. +# +# DISCOUNT TOGGLE: the daily coupon is DISABLED by default (Jun 2026). The +# discount sends were not being delivered (DKIM-broken window), so we are +# re-testing whether normal-price offers convert now that deliverability is +# fixed. With the coupon off, no code is minted and an empty coupon_code is +# merged -- the campaign templates' `{{ if .Subscriber.Attribs.coupon_code }}` +# guard automatically falls through to the normal-price `{{ else }}` branch and +# the landing-page links carry no `?code=`. Set CAMPAIGN_ENABLE_COUPON=1 to +# bring the daily deal back. Reversible, no template or DB changes needed. +COUPON_ENABLED = os.getenv("CAMPAIGN_ENABLE_COUPON", "0") in ("1", "true", "yes") COUPON_PCT = int(os.getenv("CAMPAIGN_COUPON_PCT", "40")) # Eligible slugs = every discountable service a trucking campaign can link to. # Pass-through-only slugs (boc3-filing $25 passthrough, etc.) are intentionally @@ -903,13 +913,17 @@ def run(send_date: date, dry_run: bool = False, preview: bool = False, conn = psycopg2.connect(DB_URL) # Mint (or reuse) the same-day coupon for this send date so every campaign - # in the run shares one expiring code. Preview/dry runs skip the write. + # in the run shares one expiring code. Preview/dry runs skip the write, and + # the daily deal is disabled by default (see COUPON_ENABLED) -- when off we + # send at normal price (empty coupon_code -> template's no-deal branch). daily_coupon = None - if not dry_run and not preview: + if COUPON_ENABLED and not dry_run and not preview: try: daily_coupon = get_or_create_daily_coupon(conn, send_date) except Exception as exc: # noqa: BLE001 LOG.warning("[coupon] could not mint daily coupon: %s (sending without)", exc) + elif not COUPON_ENABLED: + LOG.info("[coupon] disabled (CAMPAIGN_ENABLE_COUPON unset) — sending at normal price") base_mcs150 = get_base_campaign(CAMPAIGN_MCS150_ID) base_inactive = get_base_campaign(CAMPAIGN_INACTIVE_ID) diff --git a/scripts/build_ucr_annual_campaign.py b/scripts/build_ucr_annual_campaign.py index b3b7efd..1234865 100644 --- a/scripts/build_ucr_annual_campaign.py +++ b/scripts/build_ucr_annual_campaign.py @@ -170,11 +170,13 @@ def main() -> int: _reset_cycle_if_new(conn, year) coupon = None - if args.start_campaign and not args.preview and not args.dry_run: + if tc.COUPON_ENABLED and args.start_campaign and not args.preview and not args.dry_run: try: coupon = tc.get_or_create_daily_coupon(conn, today) except Exception as exc: # noqa: BLE001 LOG.warning("[ucr] coupon mint failed: %s", exc) + elif not tc.COUPON_ENABLED: + LOG.info("[ucr] coupon disabled (CAMPAIGN_ENABLE_COUPON unset) — normal price") cur = conn.cursor() cur.execute(SELECT_SQL, [list(tc.BLOCKED_EMAIL_DOMAINS), touch_no, args.limit])