ePages 6.10 - DE_EPAGES/Coupon/API/Object/CouponCode.pm

Package DE_EPAGES::Coupon::API::Object::CouponCode

object interface for CouponCode.

Base
DE_EPAGES::Object::API::Object::Object

Functions

addToContainer
lineItem
recalculateLineItem
redeem

addToContainer

Adds a line item to container after checking if the Coupon is invalidated, if the valid coupon count is reached, if the coupon is effective/valid and if there is a coupon in the basket already.

Syntax
$LineItem = $CouponCode->addToContainer( $Container, $hInfo );
Input
$Container (hash)
line item container | object
$hInfo |
Return
$LineItem (object)
coupon lineitem

lineItem

Builds a line item like hash for all line item information.

Syntax
$hLineItem = $CouponCode->lineItem( $Container, $hInfo );
Input
$Container (object)
line item container
$hInfo (ref.hash)
keys
  • Quantity - quantity (optional default=MinOrder)- float
  • CurrencyID - alpha currency code (optional default=Container.CurrencyID) - char(3)
  • TaxModel - gros or net price (optional default=Container.TaxModel) - int
  • IsQuantityChanged - quantity was changed by product (optional default=0) - int
  • .... (optional)- ...
Return
$hLineItem (ref.hash)
hash for lineitem insert, keys
  • SKU
  • Name
  • TaxClass
  • Quantity
  • BasePrice
  • Discount
  • LineItemPrice
  • Product
  • TaxRate
  • IsQuantityChanged

recalculateLineItem

Coupon line items call this function to recalculate the item.

Syntax
$CouponCode->recalculateLineItem($CouponCode, $LineItem);
Input
$CouponCode (string)
coupon code
$LineItem (ref.hash)
line item which will be recalculated

redeem

Redeems a coupon and increases the count of redeemed coupons. If a coupon is redeemable only once then it'll be invalidated.

Syntax
$CouponCode->redeem;