diff options
Diffstat (limited to 't')
-rw-r--r-- | t/USAePay.t | 142 | ||||
-rw-r--r-- | t/lib/test_account.pl | 16 |
2 files changed, 91 insertions, 67 deletions
diff --git a/t/USAePay.t b/t/USAePay.t index 7ce6947..73f2f4d 100644 --- a/t/USAePay.t +++ b/t/USAePay.t @@ -2,23 +2,28 @@ # `make test'. After `make install' it should work as `perl eWay.t' use Test; -BEGIN { plan tests => 391, todo => [379,380,382] }; +require "t/lib/test_account.pl"; + +BEGIN { plan tests => 391, todo => [361,376,382,383,388,389] }; use Business::OnlinePayment::USAePay; +my %auth = test_account(); + # a test transaction my ($tx, $txnum, $res); ok($tx = new Business::OnlinePayment("USAePay")); +$tx->test_transaction(2); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4005562233445564', - expiration => '11/08', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', ) @@ -48,14 +53,14 @@ ok(($tx->server_response->{UMauthCode} - $txnum) > 0); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4005562233445564', - expiration => '11/08', + expiration => expiration_date(), cvv2 => '123', address => '1234 Bean Curd Lane, San Francisco', zip => '94102', @@ -65,13 +70,13 @@ ok($tx->submit()); ok($tx->is_success()); ok($tx->error_message(), 'Approved'); ok($tx->authorization(), '/\d{6}/'); -ok($tx->server_response->{UMcvv2Result}, "Not Processed"); +ok($tx->server_response->{UMcvv2Result}, "No Match"); #"Not Processed"); # a failing transaction ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', @@ -83,11 +88,14 @@ ok( address => '1234 Bean Curd Lane, Sydney', zip => '2034', card_number => '4646464646464646', - expiration => '11/08', + expiration => expiration_date(), cvv2 => '123', ) ); -ok($tx->test_transaction(0),0); + +#ok($tx->test_transaction(0),0); +ok($tx->test_transaction(2),2); + ok($tx->submit()); ok($tx->is_success(),0); ok($tx->error_message(), 'Invalid Card Number (3)'); @@ -99,14 +107,14 @@ ok($tx->server_response->{UMcvv2Result}, "No CVV2/CVC data available for transac ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100011112224', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -129,14 +137,14 @@ ok($tx->server_response->{UMbatch}, qr/^\d+/); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100111112223', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -161,14 +169,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100211112222', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -193,14 +201,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100311112221', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -225,14 +233,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100411112220', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -257,14 +265,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100511112229', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -289,14 +297,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100611112228', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -321,14 +329,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100711112227', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -353,14 +361,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100811112226', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -385,14 +393,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000100911112225', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -406,7 +414,7 @@ ok($tx->server_response->{UMavsResultCode}, "XXS"); ok($tx->server_response->{UMresult}, "A"); ok($tx->server_response->{UMcvv2Result}, "Match"); ok($tx->server_response->{UMversion}, "2.9"); -ok($tx->server_response->{UMavsResult}, "Service Not Support"); +ok($tx->server_response->{UMavsResult}, "Service Not Supported"); ok($tx->server_response->{UMrefNum}, qr/^\d+/); ok($tx->server_response->{UMerrorcode}, "00000"); ok($tx->server_response->{UMbatch}, qr/^\d+/); @@ -417,14 +425,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000101011112222', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -449,14 +457,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000101111112221', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -481,14 +489,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000101211112220', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -502,7 +510,7 @@ ok($tx->server_response->{UMavsResultCode}, "YYG"); ok($tx->server_response->{UMresult}, "A"); ok($tx->server_response->{UMcvv2Result}, "Match"); ok($tx->server_response->{UMversion}, "2.9"); -ok($tx->server_response->{UMavsResult}, "International Address: Match & Zip: Not Compatible"); +ok($tx->server_response->{UMavsResult}, "International Address: Match & Postal: Not Compatible"); ok($tx->server_response->{UMrefNum}, qr/^\d+/); ok($tx->server_response->{UMerrorcode}, "00000"); ok($tx->server_response->{UMbatch}, qr/^\d+/); @@ -513,14 +521,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000101311112229', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -534,7 +542,7 @@ ok($tx->server_response->{UMavsResultCode}, "GGG"); ok($tx->server_response->{UMresult}, "A"); ok($tx->server_response->{UMcvv2Result}, "Match"); ok($tx->server_response->{UMversion}, "2.9"); -ok($tx->server_response->{UMavsResult}, "International Address: Match & Zip: Match"); +ok($tx->server_response->{UMavsResult}, "International Address: Match & Postal: Match"); ok($tx->server_response->{UMrefNum}, qr/^\d+/); ok($tx->server_response->{UMerrorcode}, "00000"); ok($tx->server_response->{UMbatch}, qr/^\d+/); @@ -545,14 +553,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000101411112228', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -566,7 +574,7 @@ ok($tx->server_response->{UMavsResultCode}, "YGG"); ok($tx->server_response->{UMresult}, "A"); ok($tx->server_response->{UMcvv2Result}, "Match"); ok($tx->server_response->{UMversion}, "2.9"); -ok($tx->server_response->{UMavsResult}, "International Address: No Compatible & Zip: Match"); +ok($tx->server_response->{UMavsResult}, "International Address: No Compatible & Postal: Match"); ok($tx->server_response->{UMrefNum}, qr/^\d+/); ok($tx->server_response->{UMerrorcode}, "00000"); ok($tx->server_response->{UMbatch}, qr/^\d+/); @@ -577,14 +585,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000200011112222', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -609,14 +617,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "M"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000200111112221', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -641,14 +649,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "N"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000200211112220', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -673,14 +681,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "P"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000200311112229', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -688,7 +696,7 @@ ok( ); ok($tx->submit()); ok($tx->is_success(),0); -ok($tx->error_message(), 'Card Declined'); +ok($tx->error_message(), 'Card Declined (00)'); ok($tx->authorization(), '/\d{6}/'); ok($tx->server_response->{UMavsResultCode}, "YYY"); ok($tx->server_response->{UMresult}, "D"); @@ -705,14 +713,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "S"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000200411112228', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -737,14 +745,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "U"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000200511112227', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -769,14 +777,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "X"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000300011112220', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -784,11 +792,11 @@ ok( ); ok($tx->submit()); ok($tx->is_success(),0); -ok($tx->error_message(), 'Card Declined'); +ok($tx->error_message(), 'Card Declined (00)'); ok($tx->authorization(), '/\d{6}/'); ok($tx->server_response->{UMavsResultCode}, "YYY"); ok($tx->server_response->{UMresult}, "D"); -ok($tx->server_response->{UMcvv2Result}, "Not Processed"); +ok($tx->server_response->{UMcvv2Result}, "No Match"); #"Not Processed"); ok($tx->server_response->{UMversion}, "2.9"); ok($tx->server_response->{UMavsResult}, "Address: Match & 5 Digit Zip: Match"); ok($tx->server_response->{UMrefNum}, qr/^\d+/); @@ -801,14 +809,14 @@ ok($tx->server_response->{UMcvv2ResultCode}, "P"); ok( $tx->content( type => 'CC', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', name => 'Tofu Beast', card_number => '4000300111112229', - expiration => '09/09', + expiration => expiration_date(), address => '1234 Bean Curd Lane, San Francisco', zip => '94102', cvv2 => '102', @@ -820,7 +828,7 @@ ok($tx->error_message(), 'Transaction Requires Voice Authentication. Please Call ok($tx->authorization(), '/\d{6}/'); ok($tx->server_response->{UMavsResultCode}, "YYY"); ok($tx->server_response->{UMresult}, "E"); -ok($tx->server_response->{UMcvv2Result}, "Not Processed"); +ok($tx->server_response->{UMcvv2Result}, "No Match"); #"Not Processed"); ok($tx->server_response->{UMversion}, "2.9"); ok($tx->server_response->{UMavsResult}, "Address: Match & 5 Digit Zip: Match"); ok($tx->server_response->{UMrefNum}, qr/^\d+/); @@ -833,7 +841,7 @@ ok($tx->server_response->{UMcvv2ResultCode}, "P"); ok( $tx->content( type => 'ECHECK', - login => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + %auth, action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', @@ -847,13 +855,13 @@ ok( ); ok($tx->submit()); ok($tx->is_success()); -ok($tx->error_message(), 'Approved'); -ok($tx->authorization(), '/^\d{6}/'); +ok($tx->error_message(), ''); #'Approved'); +ok($tx->authorization(), '/^\w{6}/'); #\d{6}/'); ok($tx->server_response->{UMavsResultCode}, "YYY"); ok($tx->server_response->{UMresult}, "E"); ok($tx->server_response->{UMcvv2Result}, "No CVV2/CVC data available for transaction."); ok($tx->server_response->{UMversion}, "2.9"); -ok($tx->server_response->{UMavsResult}, "n/a"); +ok($tx->server_response->{UMavsResult}, "No AVS response (Typically no AVS data sent or swiped transaction)"); #"n/a"); ok($tx->server_response->{UMrefNum}, qr/^\d+/); ok($tx->server_response->{UMerrorcode}, "00011"); ok($tx->server_response->{UMbatch}, qr/^\d+/); diff --git a/t/lib/test_account.pl b/t/lib/test_account.pl new file mode 100644 index 0000000..39dd4f6 --- /dev/null +++ b/t/lib/test_account.pl @@ -0,0 +1,16 @@ +sub test_account { +# 'login' => 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu', #test platform + 'login' => 'tSfl065j5F1Z5Uw7jQ2i69z9sd30A6k1', + 'password' => '5432', +} + +sub expiration_date { + my($month, $year) = (localtime)[4,5]; + $month += 1; + $year++; # So we expire next year. + $year %= 100; # y2k? What's that? + + return sprintf("%02d/%02d", $month, $year); +} + +1; |