André Walker > Business-CPI-0.916 > Business::CPI::Util::Types

Download:
Business-CPI-0.916.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.916   Source   Latest Release: Business-CPI-0.918

NAME ^

Business::CPI::Util::Types - Basic types for Business::CPI

VERSION ^

version 0.916

DESCRIPTION ^

Moo types for isa checks and coercions.

TYPES ^

Money

Most gateways require the money amount to be provided with two decimal places. This method coerces the value into number, and then to a string as expected by the gateways.

Examples:

5.55 becomes "5.55"
5.5 becomes "5.50"
5 becomes "5.00"

PhoneNumber

Phone numbers should contain an optional + sign in the beginning, indicating whether it contains the country code or not, and numbers only. Non-alphanumerical characters are allowed, such as parenthesis and spaces, but will be removed.

Examples of accepted phone numbers, and their coerced values are:

"+55 11 12345678" becomes "+551112345678"
"+55 (11) 12345678" becomes "+551112345678"
"+551112345678" remains the same
"1234-5678" becomes "12345678"
"(11)1234-5678" becomes "1112345678"
"1234567890123" remains the same

Country

Lowercase two-letter code for countries, according to ISO 3166-1. See:

http://www.iso.org/iso/country_codes

The type is somewhat flexible, coercing to the alpha-2 code if the English name is provided. But the recommended way is to set it as expected, the lowercase alpha-2 code.

DateTime

A valid DateTime object. No coercions here.

AUTHOR ^

André Walker <andre@andrewalker.net>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2014 by André Walker.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: