ePages 7.23.0 - DE_EPAGES/Klarna/API/Object/PaymentMethodKlarnaBase.pm

Package DE_EPAGES::Klarna::API::Object::PaymentMethodKlarnaBase

abstract base class for the three Klarna payment methods

Base
DE_EPAGES::Order::API::Object::ContainerPaymentMethod

Functions

calculatePaymentPrice
canAddToBasket
canUseBasketCurrency
featureName
isBasketAddressValidOrUndef
isSupportedAddress
usableAtStorefront

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 = $PaymentMethod->calculatePaymentPrice($Container);
Input
$Container (ref.hash)
LineItemContainer
Return
$PaymentPrice (money)
price of payment

canAddToBasket

Tests if a payment method can be added to the basket with the given currency. Overrides function DE_EPAGES::Order::API::Object::ContainerPaymentMethod::canAddToBasket The payment method can be added to the container if the CurrencyID attribute matches the currency of the container.

Syntax
if ($PaymentMethod->canAddToBasket($hVars));
Input
$hVars (ref.hash)
  • CurrencyID - alpha currency code (ISO 4217) - char(3)
  • TaxModel - gross or net price - int
Return
$canAddToBasket (boolean)
true if payment method can be used for the given currency

canUseBasketCurrency

Returns 1 if the customer address in the basket is undefined, or is defined and the country's currency is supported by Klarna in this country

Syntax
$valid = $PaymentMethod->canUseBasketCurrency($Basket);
Input
$Basket (object)
basket object
Return
$CanUse (boolean)
true if basket currency is valid to use with Klarna

featureName

Returns the feature name 'Klarna'.

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

isBasketAddressValidOrUndef

Returns 1 if the customer address in the basket is undefined or is defined and valid to use for Klarna

Syntax
$valid = $PaymentMethod->isBasketAddressValidOrUndef($Basket);
Input
$Basket (object)
basket object
Return
$ValidOrUndef (boolean)
true if basket address is valid or undef

isSupportedAddress

Function tests if an address is supported by Klarna

Syntax
$Supported = $PaymentMethod->isSupportedAddress($Address);
Input
$Address (ref.hash)
The address to check
Return
$Supported (boolean)
true if the address is supported

usableAtStorefront

Funtion tests if a payment method 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 (object)
CurrencyID - alpha currency code (ISO 4217) - char(3),
TaxModel - gross or net price - int | ref.hash
LineItemContainer - the line item container object
Return
$Usable (boolean)
true if payment method is usable in the storefront