ePages 7.27.0 - DE_EPAGES/Klarna/API/Tools.pm

Package DE_EPAGES::Klarna::API::Tools

This module implements functions to encoding special characters and cutting too length strings.

Base
-
@EXPORT_OK
CutStringToLength
CleanUpString
GetKlarnaPrice
GetKlarnaVat

Functions

CleanUpString
CutStringToLength
GetKlarnaPrice
GetKlarnaVat

CleanUpString

Clean up a string

Syntax
$FormattedString = CleanUpString($string, {'mode' => 'Encode'});
Input
$string (string)
input string
$extra (hash)
'mode' => 'Encode', (Encode, Remove or NoClean)
Return
$FormattedString (string)
formatted string

CutStringToLength

Cut data of string input if it exceeds specific maximum length and clean the string up

Syntax
$FormattedString = $self->CutStringToLength($string, $settings);
Input
$string (string)
input string
$settings (hash)

'max' => 255, # maximum length
'mode' => 'Encode', # Encode, Remove or NoClean
'mark' => '...', # note that the length of the marker will be included in the max value
'trim' => 1, # trim whitespace around string
Return
$FormattedString (string)
formatted string

GetKlarnaPrice

Returns the line item's price in Klarna's format

Syntax
GetKlarnaPrice( $LineItem );
Input
$LineItem (object)
Order's line item
Return
$Price (String)
Line item's price in Klarna's format

GetKlarnaVat

Returns the line item's tax in Klarna's format

Syntax
GetKlarnaVat( $LineItem );
Input
$LineItem (object)
Order's line item
Return
$Vat (String)
Line item's tax in Klarna's format