=head1 NAME Verotel::FlexPay =head1 DESCRIPTION This library allows merchants to use Verotel payment gateway and get paid by their users via Credit card and other payment methods. =head2 get_signature($secret, %params) Returns sha1_hex signature for the given parameters using L<$secret>. Signature is an SHA-1 hash as hexadecimal number generated from L<$secret> followed by the parameters joined with colon (:). Parameters ("$key=$value") are alphabeticaly orderered by their keys. Only the following parameters are considered for signing: =head1 AUTHOR Verotel developers =head1 SUPPORT Documentation PDF for the library can be found on the Verotel blog (http://blog.verotel.com/downloads/). =over 2 version, shopID, saleID, referenceID, priceAmount, priceCurrency, description, name custom1, custom2, custom3 subscriptionType period trialAmount, trialPeriod cancelDiscountPercentage =back =head3 Example: get_signature('aaB', shopID => '123', custom1 => 'xyz', custom2 => undef , ignored => 'bla' ); returns the SHA-1 string for "aaB:custom1=xyz:custom2=:shopID=123" converted to lowercase. =cut =head2 validate_signature($secret, %params) Returns true if the signature passed in the parameters match the signature computed from B parameters (except for the signature itself). =head3 Example: validate_signature('aaB', shopID => 123, saleID => 345, signature => '30a671fd2ab5a7580c3ecc279e092eef35a97ff1' ); returns true as the signature passed as the parameter is the same as the signature computed for "aaB:saleID=345:shopID=123" =cut =head2 get_purchase_URL($secret, %params) Return URL for purchase with signed parameters (only the parameters listed in the description of get_signature() are considered for signing). =head3 Example: get_purchase_URL('mySecret', shopID => 65147, priceAmount => '6.99', priceCurrency => 'USD'); returns "https://secure.verotel.com/startorder?priceAmount=6.99&priceCurrency=USD&shopID=65147&type=purchase&version=3&signature=419265a47644c7852c4a595385b867a4ce87da7b" =cut =head2 get_subscription_URL($secret, %params) Return URL for subscription with signed parameters (only the parameters listed in the description of get_signature() are considered for signing). =head3 Example: get_subscription_URL('mySecret', shopID => 65147, subscriptionType => 'recurring', period => 'P1M'); returns "https://secure.verotel.com/startorder?period=P1M&shopID=65147&subscriptionType=recurring&type=subscription&version=3&signature=602c185d1ab001b84b8e5248b67539aae94aa7fb" =cut =head2 get_subscription_URL($secret, %params) Return URL for upgrade subscription with signed parameters (only the parameters listed in the description of get_signature() are considered for signing). =head3 Example: get_upgrade_subscription_URL('mySecret', shopID => 65147, subscriptionType => 'recurring', period => 'P1M'); returns "https://secure.verotel.com/startorder?period=P1M&shopID=65147&subscriptionType=recurring&type=upgradesubscription&version=3.4&signature=602c185d1ab001b84b8e5248b67539aae94aa7fb" =cut =head2 get_status_URL($secret, %params) Return URL for status with signed parameters (only the parameters listed in the description of get_signature() are considered for signing). =head3 Example: get_status_URL('mySecret', shopID => '65147', saleID => '1485'); returns "https://secure.verotel.com/salestatus?saleID=1485&shopID=65147&version=3&signature=c6f7c22553ba51e6171b34918652cf5099320f77" =cut =head2 get_cancel_subscription_URL($secret, %params) Return URL for cancel subscription with signed parameters (only the parameters listed in the description of get_signature() are considered for signing). =head3 Example: get_cancel_subscription_URL('mySecret', shopID => '65147', saleID => '1485'); returns "https://secure.verotel.com/cancel-subscription?saleID=1485&shopID=65147&version=3&signature=c6f7c22553ba51e6171b34918652cf5099320f77" =cut