Heystack\Ecommerce\Transaction\Transaction
Transaction Service
Handles all the TransactionModifiers and calculates the order's total.
- Author: Glenn Bautista <glenn@heyday.co.nz>
- Copyright: Heyday
Synopsis
class Transaction
implements
TransactionInterface,StateableInterface
{
- // constants
- const IDENTIFIER = 'transaction';
- // members
- protected array $modifiers = ;
- protected Money $total;
- protected $status;
- protected $validStatuses;
- protected bool $updateRequested;
- // methods
- public void __construct()
- public void saveState()
- public void restoreState()
- public void addModifier()
- public TransactionModifierInterface|null getModifier()
- public array getModifiers()
- public array getModifiersByType()
- public array getChargeableModifiers()
- public array getDeductibleModifiers()
- public array getNeutralModifiers()
- public Money getTotal()
- public void updateTotal()
- public Money getTotalWithExclusions()
- public Money getChargeableTotalWithExclusions()
- public Money getDeductibleTotalWithExclusions()
- public array getLinkedModifers()
- public string getStorableIdentifier()
- public string getSchemaName()
- public array getStorableData()
- public array getStorableBackendIdentifiers()
- public void setStatus()
- public string getStatus()
- protected bool isValidStatus()
- // Inherited methods from HasCurrencyServiceTrait
- public void setCurrencyService()
- public CurrencyServiceInterface getCurrencyService()
Hierarchy
Uses
- Heystack\Core\Traits\HasStateServiceTrait
- Heystack\Ecommerce\Currency\Traits\HasCurrencyServiceTrait
Implements
- Heystack\Ecommerce\Transaction\Interfaces\TransactionInterface
- Heystack\Core\State\StateableInterface
Constants
Name | Value |
---|---|
IDENTIFIER | 'transaction' |
Members
protected
- $currencyService — \Heystack\Ecommerce\Currency\Interfaces\CurrencyServiceInterface
- $modifiers — array
- $status — string
- $total — \SebastianBergmann\Money\Money
- $updateRequested
—
Heystack\Ecommerce\Transaction\bool
Tracks if a update has been requested - $validStatuses
—
array
Holds an array of statuses that is accepted by the setStatus() method
Methods
protected
- isValidStatus() — Checks if a status is valid
public
- __construct() — Creates the Transaction object
- addModifier() — Add a TransactionModifier to the Transaction
- getChargeableModifiers()
- getChargeableTotalWithExclusions()
- getDeductibleModifiers()
- getDeductibleTotalWithExclusions()
- getLinkedModifers()
- getModifier() — Returns a TransactionModifier based on the identifier
- getModifiers() — Returns all the TransactionModifiers held by the Transaction object
- getModifiersByType() — Returns modifiers on the transaction by TranactionModifierType
- getNeutralModifiers()
- getSchemaName() — Get the name of the schema this system relates to
- getStatus() — Retrieves the Transaction's status
- getStorableBackendIdentifiers() — Get the type of storage that is being used
- getStorableData() — Get the data to store
- getStorableIdentifier() — Get the identifier for this system
- getTotal() — Returns the aggregate total of the TransactionModifers held by the Transaction object
- getTotalWithExclusions() — Retrieves the total excluding specified modifiers
- restoreState() — Restores the state of the Transaction object
- saveState() — Saves the state of the Transaction object
- setStatus() — Sets the status of the transaction
- updateTotal() — Update the aggregate total of the TransactionModifers held by the Transaction object