ePages 6.17.13 - DE_EPAGES/USPS/API/WebServices/TrackingDeliveryConfirmationLabel.pm

Package DE_EPAGES::USPS::API::WebServices::TrackingDeliveryConfirmationLabel

It collects (XML) information required to generate USPS Tracking/Delivery Confirmation Label requests and processed correct responses

Functions

_sizeIntoInches
_weightIntoOunces
callWebService
feedRequest
getResponseDeliveryConfirmationNumberOrError
getResponseLabelBase64CodeOrError
getResponseLogMessageOrEmpty
getResponsePostageOrError
isValidRequestAndInternalConditionsOrError
isValidResponseOrError
new
setContainerTypeOrError
setCredentials
setDataFromOrder
setDataFromShippingLabel
setDestinationAddress
setDestinationAddressCleansing
setLabelDate
setOriginAddress
setSenderRecipientMailing
setServiceTypeOrError
setSizeInInches
setSizeOrError
setWeightInOuncesOrError

_sizeIntoInches

It converts hash dimensions into inches and returns them.

Syntax
$hSizeInInches = $self->_sizeIntoInches($hSize, $Unit);
Input
$hSize (hash ref)
hash containing width, length, depth and girth values
$Unit (object)
length unit of measure object
Return
$hSizeInInches (hash ref)
hash with dimensions in inches

_weightIntoOunces

It converts any weight units into ounces and returns them.

Syntax
$weightInOunces = $self->_weightIntoOunces($weight, $Unit);
Input
$weight
decimal
$Unit (object)
weight unit of measure object
Return
(decimal)
$weightInOunces

callWebService

It arranges the log filter and calls the web service through the common interface.

Syntax
$self->callWebService();

feedRequest

It feeds USPS Tracking Delivery Confirmation Label object, ready to use the web service call.

Syntax
$self->feedRequest($ShippingLabel);
Input
$ShippingLabel (object)
Shipping label object

getResponseDeliveryConfirmationNumberOrError

It checks that the delivery confirmation number node exists for the response and returns the content. It throws an error if no delivery confirmation number can be found.

Syntax
$number = $self->getResponseDeliveryConfirmationNumberOrError();
Return
(string)
$number

getResponseLabelBase64CodeOrError

It checks that the label node exists for the response and returns the content. It throws an error if no label can be found.

Syntax
$base64code = $self->getResponseLabelBase64CodeOrError();
Return
$base64code (string)
base 64 code string

getResponseLogMessageOrEmpty

It returns the provided log message attribute of the response or an empty string if no log message can be found.

Syntax
$logMessage = $self->getResponseLogMessageOrEmpty();
Return
(string)
$logMessage

getResponsePostageOrError

It checks that the postage node exists for the response and returns the content. It throws an error if no postage can be found.

Syntax
$postage = $self->getResponsePostageOrError();
Return
$postage (string)
string representing a decimal number

isValidRequestAndInternalConditionsOrError

It checks validity of the request based on documented (already known) requirements. It returns 1 (true) or throws an error.

Syntax
$isValid = $self->isValidRequestAndInternalConditionsOrError();
Return
(boolean)
$isValid

isValidResponseOrError

It checks that the response is of Tracking Delivery Confirmation Label API web service type. If it's not, it throws an error.

Syntax
$isValid = $self->isValidResponseOrError();
Return
(boolean)
$isValid

new

Creates a new Tracking Delivery Confirmation Label object .

Syntax
$TDCLabel = DE_EPAGES::USPS::API::WebServices::TrackingDeliveryConfirmationLabel->new($ShippingFulfillmentMethod);
Input
$ShippingFulfillmentMethod (object)
ShippingFulfillmentMethod object
$Client (object)
Remote Client object -only used for mocking-
Return
$TDCLabel (object)
TrackingDeliveryConfirmationLabel object

setContainerTypeOrError

It sets the container type into the request XML structure inside the TrackingDeliveryConfirmationLabel object.

Syntax
$self->setContainerTypeOrError($ContainerType);
Input
$ContainerType (object)
ListItem USPS object

setCredentials

It sets USPS access credentials for Tracking Delivery Confirmation Label web services into XML root node as required by USPS.

Syntax
$self->setCredentials( $ShippingFulfillmentMethod );
Input
$ShippingFulfillmentMethod (object)
Shipping Fulfillment Method object

setDataFromOrder

It sets order content information into the request XML structure inside the TrackingDeliveryConfirmationLabel object.

Syntax
$self->setDataFromOrder($Order);
Input
$Order (object)
Order object

setDataFromShippingLabel

It sets shipping label content information into the request XML structure inside the TrackingDeliveryConfirmationLabel object.

Syntax
$self->setDataFromShippingLabel($ShippingLabel);
Input
$ShippingLabel (object)
Shipping Label object

setDestinationAddress

It sets destination address into the request XML structure inside the TrackingDeliveryConfirmationLabel object.

Syntax
$self->setDestinationAddress($DestinationAddress);
Input
$DestinationAddress (object)
Address object

setDestinationAddressCleansing

It sets cleansing allowance or not depending if a validated USPS address was chosen by end customer at checkout process

Syntax
$self->setDestinationAddressCleansing($IsUSPSSuggestedAddress);
Input
$IsUSPSSuggestedAddress
boolean

setLabelDate

If not null date is included, it formats and adds to the LabelDate attribute of the request object.

Syntax
$self->setLabelDate($pickupDate);
Input
$pickupDate
date

setOriginAddress

It sets origin address into the request XML structure inside the TrackingDeliveryConfirmationLabel object.

Syntax
$self->setOriginAddress($OriginAddress);
Input
$OriginAddress (object)
Address object

setSenderRecipientMailing

If shop and end user addresses have FullName and EMail attributes set, activate USPS mailing service informing about tracking delivery status

Syntax
$self->setSenderRecipientMailing($OriginAddress, $DestinationAddress);
Input
$OriginAddress (object)
Address object
$DestinationAddress (object)
Address object

setServiceTypeOrError

It sets the service type into the request XML structure inside the TrackingDeliveryConfirmationLabel object.

Syntax
$self->setServiceTypeOrError($ServiceType);
Input
$ServiceType (object)
ListItem USPS object

setSizeInInches

It sets package size into the request XML structure inside the TrackingDeliveryConfirmationLabel object.

Syntax
$self->setSizeInInches($hSize, $Unit);
Input
$hSize (hash ref)
hash containing width, length, depth and girth values
$Unit (object)
Unit of Measure object

setSizeOrError

It checks the dimensions of the package and fits the Size XML parameter accordingly. if a size value is passed it bypasses dimensions checking.

Syntax
$self->setSizeOrError($size);
Input
$size (string)
size tag string

setWeightInOuncesOrError

It sets package weight into the request XML structure inside the TrackingDeliveryConfirmationLabel object. It throws an error on incorrect parameters

Syntax
$self->setWeightInOuncesOrError($weight, $Unit);
Input
$weight (float)
weight value
$Unit (object)
Unit of Measure object