Applying a promo

Please make sure you read the Conventions before continuing with this guide.

Requirements.

You will need:

Checking the promo is valid

To check the promo is valid please find the promo using the promo code. If no promo is returned, check the promo code belongs to the account.

If the response is OK check if the promo is not disabled and verify at least one rule satisfies all the following conditions:

  1. productId matches the cart item
  2. the channel you are buying is allowed
  3. the trip type in the item matches
  4. if it is restricted to a specific route make sure it matches the item
  5. if it is restricted to a specific schedule make sure it matches the item
  6. the day of the week is available
  7. from and to stations are allowed
  8. the fare selected in the item is allowed
  9. you are within the purchase period
  10. the travel date gap matches your item
  11. the rule is unlimited or you have quantity available

Applying a promo.

You will interact with the /sales/cart/promos endpoint of the Sales Bucket to apply one promo to your cart.

The promo will try to match any rule to all the items in the cart. It will return the same given cart with the promo applied to all the item matching. If there is no match or any error occurs, the cart will be returned containing an error property with a string describing the error.

Parameter Type Example
promoCode String promo-code-000
channel String [websales,backoffice,agency-websales,agency-backoffice]