ePages 7.0.0 - DE_EPAGES/Payment/API/Object/PaymentMethod.pm

Package DE_EPAGES::Payment::API::Object::PaymentMethod

object interface for PaymentMethod.

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

Functions

canDelete
className
dbPackage
featureName
getLevels
getMaxPriceValue
getMinPriceValue
getPaymentMethodDiscount
levels
price
setLevels
setMaxPriceValue
setMinPriceValue
setPaymentMethodDiscount
template
usableAtStorefront

canDelete

Test if the object can be deleted. In case of the default payment method a warning is added. The default payment method can't be deleted.

Syntax
$CanDelete = $Object->canDelete($aWarnings);
Input
$aWarnings (array.ref)
array of Warning Objects
Return
$CanDelete (boolean)
true if the payment method can be deleted

className

Returns the class name, used for DAL access.

Syntax
$ClassName = $PaymentMethod->className;
Return
$ClassName (String)
class name

dbPackage

Returns the database package, used for DAL access.

Syntax
$DbPackage = $PaymentMethod->dbPackage;
Return
$DbPackage (String)
database package name

featureName

Returns the feature name.

Syntax
$FeatureName = $PaymentMethod->featureName;
Return
$FeatureName (String)
feature name (undef means no feature count)

getLevels

Return the payment levels for the given currency in the requested tax model.

Syntax
$ahLevels = $Object->getLevels($CurrencyID, $TaxModel);
$ahLevels = $Object->getLevels($CurrencyID, $TaxModel, $ExtraPrecision);
Input
$CurrencyID (char(3))
currency id
$TaxModel (int)
tax model (1=gross/including tax, 0=net/without tax)
$ExtraPrecision (boolean)
(optional, default=0) extra precision for net prices
in back-office
Return
$ahLevels (int)
list of hashes, keys:
BaseValue, LowerBound, UpperBound, Multiplier, PaymentLevelID

getMaxPriceValue

Returns the price limit max value of this payment method. Returns undef if the payment method does not have a max value.

Syntax
$Value = $PaymentMethod->getMaxPriceValue($CurrencyID);
Example
$Value = $PaymentMethod->getMaxPriceValue('EUR');
Input
$CurrencyID (string)
currency code
Return
$Value (float)
price

getMinPriceValue

Returns the price limit min value of this payment method. Returns undef if the payment method does not have a min value.

Syntax
$Value = $PaymentMethod->getMinPriceValue($CurrencyID);
Example
$Value = $PaymentMethod->getMinPriceValue('EUR');
Input
$CurrencyID (string)
currency code
Return
$Value (float)
price

getPaymentMethodDiscount

Returns the discount or fee price value of this payment method. Returns undef if the payment method does not have a value.

Syntax
$Value = $PaymentMethod->getPaymentMethodDiscount($CurrencyID);
Example
$Value = $PaymentMethod->getPaymentMethodDiscount('EUR');
Input
$CurrencyID (string)
currency code
Return
$Value (float)
price

levels

Returns all payment level objects of that payment method.

Syntax
$aPaymentLevels = $Object->levels;
Return
$aPaymentLevels (ref.array.object)
list of payment level opbjects

price

Returns the payment price by the given requirements. Needs to be implemented for a new payment method.

Syntax
$PaymentPrice = $Object->price( $hVars );
Example
$PaymentPrice = $PaymentMethod->price( {
    CurrencyID => 'USD',
    TaxModel   => $PaymentMethod->getSite()->get('TaxModel')
} );
Return
$PaymentPrice (money)
price of payment

setLevels

Sets all payment levels for the given currency. Deletes payment levels that are not included in the list. Calculates net prices from gross prices if $TaxModel is TAX_MODEL_GROSS.

Syntax
$Object->setLevels($CurrencyID, $TaxModel, $ahLevels);
Input
$CurrencyID (char(3))
currency id
$TaxModel (int)
tax model (1=gross/including tax, 0=net/without tax)
$ahLevels (int)
list of hashes, keys:
BaseValue, LowerBound, UpperBound, Multiplier

setMaxPriceValue

Sets the price limit max value of this payment method.

Syntax
$Paymentmethod->setMaxPriceValue($CurrencyID, $MinValue);
Example
$Paymentmethod->setMaxPriceValue('EUR', 50.00);
$Paymentmethod->setMaxPriceValue('EUR', undef);
Input
$CurrencyID (string)
currency code
$Value (float)
min price. A value of undef deletes the price.

setMinPriceValue

Sets the price limit min value of this payment method.

Syntax
$Paymentmethod->setMinPriceValue($CurrencyID, $MinValue);
Example
$Paymentmethod->setMinPriceValue('EUR', 50.00);
$Paymentmethod->setMinPriceValue('EUR', undef);
Input
$CurrencyID (string)
currency code
$Value (float)
min price. A value of undef deletes the price.

setPaymentMethodDiscount

Sets the discount or fee value of this payment method.

Syntax
$Paymentmethod->setPaymentMethodDiscount($CurrencyID, $Value);
Example
$Paymentmethod->setPaymentMethodDiscount('EUR', 5.00);
$Paymentmethod->setPaymentMethodDiscount('EUR', undef);
Input
$CurrencyID (string)
currency code
$Value (float)
price. A value of undef deletes the price.

template

This function is used to overwrite the given template for the purpose that each payment method can define there own template (visualisation).

Syntax
$Name = $Object->template($Name, $ObjectPageType);
Input
$Name (string)
include name
$ObjectPageType (DE_EPAGES::Presentation::API::Object::ObjectPageType)
object related pagetype
Return
$Name (string)
include name

usableAtStorefront

Tests if a payment method with the given currency is visible in the storefront. Uses function DE_EPAGES::Payment::API::Object::PaymentMethod::price to evaluate if payment methode has a price (price can be 0).

Syntax
$Usable = $PaymentMethod->usableAtStorefront($hVars);
Input
$hVars (ref.hash)
  • CurrencyID - alpha currency code (ISO 4217) - char(3)
  • TaxModel - gross or net price - int
Return
$Usable (boolean)
true if payment method is usable in the storefront