NAME

Business::CPI::Types - Coersion and checks

VERSION

version 0.908

DESCRIPTION

Coersions and validations for the internal CPI attributes.

METHODS

stringified_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"

is_valid_phone_number

Checks whether the phone number is in the correct format (+9999...).

phone_number

Coerces phone numbers to contain an optional + sign in the beginning, indicating whether it contains the country code or not, and numbers only. 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

AUTHOR

André Walker <andre@andrewalker.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 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.