ePages 7.26.0 - DE_EPAGES/Shop/API/Address.pm

Package DE_EPAGES::Shop::API::Address

This module includes a function to update VATID

@EXPORT_OK
CheckStringVATID
CheckVATID
UpdateVATID
IsTaxModelNet
IsEUAddress
CheckShopCountry
GetTaxCountryIDForShop
IsPrivateVATID

Functions

CheckShopCountry
CheckStringVATID
CheckVATID
GetTaxCountryIDForShop
IsEUAddress
IsPrivateVATID
IsTaxModelNet
UpdateVATID

CheckShopCountry

Checks whether a $CountryID is served by the shop

Syntax
$IsCountrySupported = CheckShopCountry( $Shop, $CountryID );
Example
$IsCyprusSupported  = CheckShopCountry( $Shop, 196 );
Input
$Shop (object)
shop object
$CountryID (int)
country id (ISO_3166-1_numeric)
Return
$CheckShopCountry (boolean)
1 (true) if country is supported by the shop or if country
is undefined, 0 otherwise.

CheckStringVATID

returns 1 if vatid contains not only " " and "-" returns 0 if vatid contain only " " and "-"

Syntax
$check = CheckStringVATID( $VATID );
Example
$check = CheckStringVATID( '118541153' );
Input
$VATID (string)
VATID
Return
$check (int)
valid

CheckVATID

returns 1 if country is not eu country returns 1 if VATID is valid returns -1 if CountryID and country VATID not same returns 0 if VATID is not valid

Syntax
$check = CheckVATID( $VATID, $CountryID, $Shop );
Input
$VATID (string)
VATID
$CountryID (int)
country id
$Shop (object)
shop object
Return
$check (int)
valid

GetTaxCountryIDForShop

Returns the CountryID for the given shop by the shop address.

Syntax
my $CountryID = GetTaxCountryIDForShop( $Shop ));
Input
$Shop (object)
shop object
Return
$CountryID (int)
true country for shop

IsEUAddress

Checks the address on the basis of countryid and zip code exceptions to be a EU Address

Syntax
my $IsEUAddress = IsEUAddress( $Address );
Input
$Address (object)
address object
Return
$IsEUAddress (int)
address is an EU address

IsPrivateVATID

checks if the VATID is listed in the exception list $TAX_MODEL_GROSS_WITH_VATID or if it is a usual (business) VATID

Syntax
my $IsPrivate = IsPrivateVATID( $VATID );
Input
$VATID (string)
VATID
Return
$IsPrivate (boolean)
true if VATID is listed in the exception list
$TAX_MODEL_GROSS_WITH_VATID

IsTaxModelNet

Checks the address on the basis of shop, countryid and vatid to be net.

Syntax
my $IsNet = IsTaxModelNet( $Shop, $Address );
Input
$Shop (object)
shop object
$Address (object)
address object
Return
$IsNet (boolean)
true if address is non-eu-address
or is eu-address and vatid is defined and valid

UpdateVATID

Adds the country code to the VATID if $CountryID is defined and the country is a member of the European Union.

Syntax
$VATID = UpdateVATID( $VATID, $CountryID, $Shop );
Example
$VATID = UpdateVATID( '118541153', 276, $Shop );
Input
$VATID (string)
VATID
$CountryID (int)
country id
$Shop (object)
shop object
Return
$VATID (string)
VAT ID including country code, e.g. "DE118541153"