ePages 7.25.0 - DE_EPAGES/Order/API/Object/ContainerPaymentMethod.pm

Package DE_EPAGES::Order::API::Object::ContainerPaymentMethod

object interface for PaymentMethod to handle features hire purchase and payment discounts.

Base
DE_EPAGES::Payment::API::Object::PaymentMethod

Functions

addToContainer
calculatePaymentPrice
canAddToBasket
lineItem
recalculateLineItem

addToContainer

Adds payment and tax line item to container.

Syntax
$LineItem = $PaymentMethod->addToContainer($Container);
Input
$Container (object)
line item container
Return
$LineItem (object)
line item

calculatePaymentPrice

Returns the payment price for the given line item container. This method is used by lineItem and recalculateLineItem unless they are overloaded. The default implementation returns 0. Override this method to change the shipping price calculation of a basket or order. To calculate the payment costs without a lineitem container, e.g. for export to product portals, also overload the method DE_EPAGES::Shipping::API::Object::PaymentMethod::price.

Syntax
my $PaymentPrice = $ShippingMethod->calculatePaymentPrice($Container);
Return
$PaymentPrice (money)
price of payment

canAddToBasket

Tests if a payment method can be added to the basket with the given currency. Uses function DE_EPAGES::Payment::API::Object::PaymentMethod::price to evaluate if payment methode has a price (price can be 0). Possible for methods, which costs, but have no price in the given currency.

Syntax
$PaymentMethod->canAddToBasket($hVars);
Input
$hVars (ref.hash)
vars of container and basket
Return
$Can (boolean)
can added to the basket

lineItem

Collect information for line item.

Syntax
my $hInfo = $PaymentMethod->lineItem($Container);
Input
$Container (object)
line item container
Return
$hInfo (ref.hash)
payment line item info, keys
  • BasePrice - shipping sub total of container - float
  • LineItemPrice - additional price for hire purchase - float
  • Name - name of payment method
  • PaymentMethod - self - object
  • Quantity - quantity is 1 - float
  • TaxClass - tax class of payment - object
  • TaxRate - tax rate - float

recalculateLineItem

Called to recalc the line item. And adds a payment discount if possible.

Syntax
$PaymentMethod->recalculateLineItem($LineItem);
Input
$LineItem (object)
line item