\Discount_Engine

سرویس پرداخت‌ها را برای ماژولهای داخلی سیستم ایجاد می کند.

Summary

Methods
Properties
Constants
getType()
getTitle()
getDescription()
getPrice()
isValid()
validate()
consumeDiscount()
jsonSerialize()
No public properties found
ENGINE_PREFIX
VALIDATION_CODE_VALID
VALIDATION_CODE_USED
VALIDATION_CODE_EXPIRED
VALIDATION_CODE_NOT_OWNED
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

ENGINE_PREFIX

ENGINE_PREFIX = 'discount_engine_'

VALIDATION_CODE_VALID

VALIDATION_CODE_VALID = 0 : integer

Validcation code to show that discount is valid.

VALIDATION_CODE_USED

VALIDATION_CODE_USED = 1 : integer

Validcation code to show that discount is used before.

VALIDATION_CODE_EXPIRED

VALIDATION_CODE_EXPIRED = 2 : integer

Validcation code to show that discount is expired.

VALIDATION_CODE_NOT_OWNED

VALIDATION_CODE_NOT_OWNED = 3 : integer

Validcation code to show that discount is not owned by current user.

Methods

getType()

getType() : string

Returns

string

getTitle()

getTitle() 

getDescription()

getDescription() 

getPrice()

getPrice(integer  $price, \Discount_Discount  $discount, \Pluf_HTTP_Request  $request) 

Compute new price after use given discount.

Parameters

integer $price
\Discount_Discount $discount
\Pluf_HTTP_Request $request

isValid()

isValid(\Discount_Discount  $discount, \Pluf_HTTP_Request  $request) 

Check if give discount is valid or not.

Parameters

\Discount_Discount $discount
\Pluf_HTTP_Request $request

validate()

validate(\Discount_Discount  $discount, \Pluf_Http_Request  $request) 

Validate given discount and returns a code as result.

Returned code should be as following:

  • 0: discount is valid.
  • 1: discount is used before.
  • 2: discount is expired.
  • 3: discount is not owned by current user.

Parameters

\Discount_Discount $discount
\Pluf_Http_Request $request

consumeDiscount()

consumeDiscount(\Discount_Discount  $discount) 

Cosume one unit from given discount

Parameters

\Discount_Discount $discount

jsonSerialize()

jsonSerialize() 

(non-PHPdoc)