User Tools

Site Tools


api:product:campaign

API : Product campaigns

A campaign is a time-limited discount on an MVNO or SIP rateplan. Accounts created while the campaign is open get the campaign price for a fixed number of whole months, and are then invoiced at the rateplan's normal price again.

Overview List the campaigns that can still cost money.
Create Create a campaign on a master or reseller rateplan.
Update Update a campaign.
Stop Stop a campaign early.
Take over A reseller takes over a master campaign at its own customer price.
Sign-ups How many accounts signed up in a campaign's enrolment window.
Name The name of one campaign, for the badge on an account.

How campaigns work

Where a campaign lives

Campaigns are stored in campaigns on the rateplan product (see Products), and only on MVNO_RATEPLAN and SIP_RATEPLAN products.

  • A master campaign is on a master product (reseller null). It applies only to the resellers named in its resellers list, which must name at least one.
  • A reseller campaign is on a reseller product. It applies to that reseller's own accounts.
  • A customer product never holds campaigns. Its accounts get the campaigns of the reseller product and the master product above it.
  • When both apply, the reseller's own campaign wins over the master campaign.
  • Campaigns are never deleted. The array is the product's campaign history.

The enrolment window

startDate and endDate are Danish calendar days, sent as Copenhagen midnight (1 October 2026 is 2026-09-30T22:00:00.000Z). Both days are inside the window, so a campaign may start and end on the same day.

  • An account is judged by the day it was created: created on a day inside the window means the account gets the campaign.
  • The account is enrolled at its first invoicing, which must happen within 3 months of the account being created. Later than that, it does not get the campaign.
  • Enrolment writes a stamp on the account: campaign = { campaign, product, to }. The stamp never changes afterwards.
  • The discount starts at the first whole month. The part-month from activation to the 1st is invoiced at the normal price, then months whole months are invoiced at the campaign price.
  • wholesale is what the reseller is invoiced for the account during the campaign, and price is what the customer is invoiced.
  • Stopping a campaign closes the window at the end of the stop day. Accounts already enrolled keep their discount.

What can be changed

Before a campaign starts, everything can be changed. Once it has started, the accounts enrolled on it were priced by it, so:

  • name, startDate, months, wholesale, price and resellers are locked.
  • endDate can only be moved earlier, and not to before today. To close a campaign right away, stop it.
  • message can always be changed.
  • A stopped campaign cannot be changed at all.

Only RESELLER_ADMIN and ADMIN may set wholesale. When anybody else creates a campaign, wholesale is the product's own wholesale, so a reseller's campaign changes the customer price only.

A reseller's copy of a master campaign

A reseller named on a master campaign may take it over on its own reseller product, to offer it at its own customer price. The copy is an ordinary reseller campaign with fromCampaign set to the master campaign's id:

  • The reseller sets price, name and message.
  • startDate, endDate, months and wholesale are copied from the master campaign and follow it. The reseller can only move the copy's end date earlier, or stop the copy.
  • Stopping the master campaign stops its copies. Moving its end date earlier pulls in the copies that end later.
  • Before the master starts, changes to its start date, months and wholesale are also copied to the copies. A renamed master only renames copies that still have the master's name.
  • Removing a reseller from the master's resellers stops that reseller's copy.
  • A copy the reseller changed while the master change was being made keeps the reseller's own name or end date.
  • Because the reseller's own campaign wins, accounts created after the takeover get the copy. The customer is invoiced at the reseller's price and the reseller at the master's wholesale.

Who sees what

  • ADMIN and RESELLER_ADMIN see every campaign. When the question is about one reseller's or customer's rateplan, only the master campaigns that name that reseller count.
  • A RESELLER sees its own campaigns and the master campaigns that name it. On a master campaign it sees itself as the only reseller in resellers.
  • Customers are not shown campaigns. The overview, the sign-ups and the campaign name are RESELLER and above, and the product Get and List requests leave out campaigns and hasOpenCampaign for them.
  • Campaign names are written by resellers. They are never put into error messages.

For RESELLER and above, the product Get and List requests show hasOpenCampaign on rateplans: true when a campaign that affects the rateplan is enrolling right now.

api/product/campaign.txt · Last modified: by Thomas Andersen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki