Поделиться через


RecordPromoCodes

Use the RecordPromoCodes pipeline component to record the promotion codes that have been applied to the order and to add promotional discounts to the list of discounts for the order form.

Intended use: Order Processing pipeline, Order Adjust Price stage.

Values Read

The RecordPromoCodes pipeline component reads the following values from the indicated dictionaries.

Key

Dictionary

Description

_itemlevel_discounts_applied

Order

A SimpleList of Dictionaries where each Dictionary contains information about an item-level discount that was applied to the line item.

_orderlevel_discounts_applied

Order

A SimpleList of Dictionaries where each Dictionary contains information about an order-level discount that was applied to the order.

promo_code_info

Order

A Simplelist of Dictionaries that correspond to PromoCodeRecordCollection. The information in each entry is trusted by the ReservePromoCodes component for the amount of 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

Order

A Simplelist of strings containing the promotion codes entered by the user that correspond to PromoCodeStringCollection.

CacheManager

Context

A CacheManager Object that is used for retrieving the cached set of discounts eligible for application.

Values Written

The RecordPromoCodes pipeline component writes the following values to the indicated dictionaries.

Key

Dictionary

Description

_itemlevel_discounts_applied

Order

A SimpleList of Dictionaries where each Dictionary contains information about an item-level discount that was applied to the line item. The order of the list is significant and represents the order in which the discounts were applied to this line item.

The Dictionary contains the following elements for each discount:

  • discount_id. Campaign item ID (VT_I4).

  • discount_priority. Discount priority (rank) (VT_I4).

  • discount_timestamp. Last-modified timestamp of the discount (VT_DATE).

  • cy_discount_amount. How much was actually taken off of the item (VT_CY).

  • discount_type. 1=Currency value; 2=Percentage (VT_I4).

  • cy_discount_value Currency value or percentage value (VT_CY).

  • discount_name. Discount name (VT_BSTR).

_orderlevel_discounts_applied

Order

A SimpleList of Dictionaries where each Dictionary contains information about an order-level discount that was applied to the order. The order of the list is significant and represents the order in which the discounts were applied to this line item.

The Dictionary contains the following elements for each discount:

  • discount_id. Campaign item ID (VT_I4).

  • discount_priority. Discount priority (rank) (VT_I4).

  • discount_timestamp. Last-modified timestamp of the discount (VT_DATE).

  • cy_discount_amount. How much was actually taken off of the item (VT_CY).

  • discount_type. 1=Currency value; 2=Percentage (VT_I4).

  • cy_discount_value. Currency value or percentage value (VT_CY).

  • discount_name. Discount name (VT_BSTR).

promo_code_info

Order

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 amount of 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 RecordPromoCodes pipeline component performs two functions:

  • Updates the promo_code_info structures for which promotion codes have been applied (sets the promo_applied property to True).

  • Reviews the two optional lists (_itemlevel_discounts_applied and _orderlevel_discounts_applied) that might exist for each line item, adding promotion code information.

If any of the Dictionaries in these lists represents a discount that depends on a promotion code, the promotion code and the promotion code definition ID are added to the Dictionary. These Dictionaries correspond to DiscountApplicationRecord in the Orders run-time object model. The RecordPromoCodes pipeline component reads the set of discounts and their promotion code definition IDs from the Discount Content list.

See Also

Other Resources

ContentList Object

Pipeline Component Reference