RedeemPromoCodes
Use this component to validate promotion codes and mark them as redeemed.
Intended use: Order Processing pipeline, Accept stage.
Values Read
The RedeemPromoCodes component reads the following values from the indicated dictionaries.
Key |
Dictionary |
Description |
---|---|---|
promo_user_identity |
OrderForm |
An optional string that contains an alternative identifier for the current user. For example, this could be a membership number or e-mail address. This is used only for Restricted promotions. A match of either the primary user_id or promo_user_identity with the target user of the promotion code will enable the promotion. |
BasketOrderGroupID |
OrderForm |
A string that contains the GUID that is the ID of the OrderGroup. This is used when you write entries into the mktg_promocode_history table. |
promo_code_info |
OrderForm |
A Simplelist of Dictionaries that correspond to PromoCodeRecordCollection. The information in each entry is trusted by the ReservePromoCodes component for the time specified by the i_PromoCodeRenewReservationAfter_Minutes resource property setting. After that interval has elapsed, a new lookup on the promotion code is performed and the entry is rebuilt with fresh information. |
promo_codes |
OrderForm |
A Simplelist of strings that contain the promotion codes entered by the user that correspond to PromoCodeStringCollection. |
user_id |
OrderForm |
An optional string that contains the primary user identifier for the current user. This is used only for Restricted promotion codes. Typically, this is a GUID that represents a user in the Profiles System. |
CacheManager |
Context |
A CacheManager Object that is used for retrieving the cached set of discounts eligible for application. |
CommerceResources |
Context |
The CommerceResourceCollection that contains all the resources for the site. |
Values Written
The RedeemPromoCodes component writes the following values to the indicated Dictionaries.
Key |
Dictionary |
Description |
---|---|---|
promo_code_info |
OrderForm |
A Simplelist of Dictionaries that correspond to PromoCodeRecordCollection. On output, there is exactly one entry in this list for each promotion code string in the promo_codes list. The information in each entry is trusted by the ReservePromoCodes component for the time specified by the i_PromoCodeRenewReservationAfter_Minutes resource property setting. After that interval has elapsed, a new lookup on the promotion code is performed and the entry is rebuilt with fresh information. |
Remarks
The RedeemPromoCodes pipeline component validates promotion codes just as the ReservePromoCodes pipeline component validates promotion codes. The RedeemPromoCodes pipeline component reviews the promo_code_info list in the ContentList Object. If there is a promotion code whose Applied flag is set to True, the RedeemPromoCodes pipeline component records the fact that the promotion code has been redeemed. If there are any promotion codes that are marked as reserved but that have not had a discount applied, the RedeemPromoCodes pipeline component cancels the reservation for that promotion code.