Pipelet AddCouponToBasket2
Validates the supplied coupon code and, if the coupon code is valid, applies them to the basket.
While applying the coupon code the pipelet adds a new CouponLineItem to the basket based on the supplied coupon code. The coupon code gets set at the CouponLineItem.
A coupon code can be invalid because of the following reasons:
  • the coupon code is already added to the basket
  • a coupon code of the same coupon is already in basket.
    Adding a single coupon code of this coupon is sufficient to enables a promotion.
    Adding another coupon code of the same coupon does not make sense since the promotion is already enabled by the previously added code.
  • the numbers of redemptions of this coupon code is 1 and the code as already been redeemed.
  • the numbers of redemptions of this coupon code is >1 and the maximum numbers of redemptions of this coupon code has already been reached.
    The pipelet includes the number of redemptions of this coupon code in past plus
    the number of redemptions of other coupon codes of the same coupon in the past.
  • the maximum number of times this coupon can be redeemed per customer has already been reached.
  • the maximum number of times this coupon can be redeemed by a customer within a given time period has already been reached.
    The pipelet includes the number of redemptions of this coupon code in past plus
    the number of redemptions of other coupon codes of the same coupon in the past.
  • the coupon code is unknown to the system
  • the coupon is not enabled
  • there exists no active promotion to which the coupon is assigned

In this case, no CouponLineItem is added to the basket and the pipelet returns to the error connector. The returned "Status" object contains the details of why the coupon was invalid. Status: The status object representing a detailed result of the operation. The status property (Status.status) will be set to 0 if the coupon was successfully applied or 1 otherwise. The code property (Status.code) will be set to one of the following values:
  • "OK" = The coupon was applied to the basket.
  • CouponStatusCodes.COUPON_CODE_ALREADY_IN_BASKET = Indicates that coupon code has already been added to basket.
  • CouponStatusCodes.COUPON_ALREADY_IN_BASKET = Indicates that another code of the same MultiCode/System coupon has already been added to basket.
  • CouponStatusCodes.COUPON_CODE_ALREADY_REDEEMED = Indicates that code of MultiCode/System coupon has already been redeemed.
  • CouponStatusCodes.COUPON_CODE_UNKNOWN = Indicates that coupon not found for given coupon code or that the code itself was not found.
  • CouponStatusCodes.COUPON_DISABLED = Indicates that coupon is not enabled.
  • CouponStatusCodes.REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code exceeded.
  • CouponStatusCodes.CUSTOMER_REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code and customer exceeded.
  • CouponStatusCodes.TIMEFRAME_REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code, customer and time exceeded.
  • CouponStatusCodes.NO_ACTIVE_PROMOTION = Indicates that coupon is not assigned to an active promotion.
Group:
Basket
Flags:
Error Connector
Transaction Required
Input Parameters
Basket  :  LineItemCtnr (Required)
The basket to add the coupon to.
CouponCode  :  String (Required)
The code of the coupon to add.
Output Parameters
Status  :  Status  :  (Required)
The status object representing a detailed result of the operation. The status property (Status.status) will be set to 0 if the coupon was successfully applied or 1 otherwise. The code property (Status.code) will be set to one of the following values:
  • "OK" = The coupon was applied to the basket.
  • CouponStatusCodes.COUPON_CODE_ALREADY_IN_BASKET = Indicates that coupon code has already been added to basket.
  • CouponStatusCodes.COUPON_ALREADY_IN_BASKET = Indicates that another code of the same MultiCode/System coupon has already been added to basket.
  • CouponStatusCodes.COUPON_CODE_ALREADY_REDEEMED = Indicates that code of MultiCode/System coupon has already been redeemed.
  • CouponStatusCodes.COUPON_CODE_UNKNOWN = Indicates that coupon not found for given coupon code or that the code itself was not found.
  • CouponStatusCodes.COUPON_DISABLED = Indicates that coupon is not enabled.
  • CouponStatusCodes.COUPON_REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code exceeded.
  • CouponStatusCodes.REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code and customer exceeded.
  • CouponStatusCodes.TIMEFRAME_REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code, customer and time exceeded.
  • CouponStatusCodes.NO_ACTIVE_PROMOTION = Indicates that coupon is not assigned to an active promotion.
CouponLineItem  :  CouponLineItem  :  (Optional)
The newly created coupon line item.