| 1 | #!/usr/bin/perl -w |
| 2 | |
| 3 | use Test::Morescip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Test/More/ skip_all => 'Authorize.net test account throwing errors about duplicates'; |
| 4 | requirescip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/require(). "t/lib/test_account.pl"; |
| 5 | |
| 6 | my($login, $password) = test_account_or_skipscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/test_account_or_skip().('arb'); |
| 7 | planscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/plan(). tests => 5; |
| 8 | |
| 9 | use_okscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/use_ok(). 'Business::OnlinePayment'; |
| 10 | |
| 11 | my $tx = Business::OnlinePayment->newscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/new().("AuthorizeNet"); |
| 12 | $tx->contentscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/content().( |
| 13 | type => 'VISA', |
| 14 | login => $login, |
| 15 | password => $password, |
| 16 | action => 'Recurring Authorization', |
| 17 | description => 'Business::OnlinePayment::ARB visa test', |
| 18 | amount => '49.95', |
| 19 | invoice_number => '100100', |
| 20 | customer_id => 'jsk', |
| 21 | first_name => 'Tofu', |
| 22 | last_name => 'Beast', |
| 23 | address => '123 Anystreet', |
| 24 | city => 'Anywhere', |
| 25 | state => 'UT', |
| 26 | zip => '84058', |
| 27 | card_number => '4007000000027', |
| 28 | expiration => expiration_datescip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/expiration_date().(), |
| 29 | interval => '1 month', |
| 30 | start => tomorrowscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/tomorrow().(), |
| 31 | periods => '3', |
| 32 | ); |
| 33 | $tx->test_transactionscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/test_transaction().(1); # test, dont really charge |
| 34 | $tx->submitscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/submit().(); |
| 35 | |
| 36 | okscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/ok().($tx->is_successscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/is_success().()) or diagscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/diag(). $tx->error_messagescip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/error_message().; |
| 37 | |
| 38 | my $subscription = $tx->order_numberscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/order_number().(); |
| 39 | likescip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/like().($subscription, qr/^[0-9]{1,13}$/, "Get order number"); |
| 40 | |
| 41 | SKIP: { |
| 42 | |
| 43 | skipscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/skip(). "No order number", 2 unless $subscription; |
| 44 | |
| 45 | $tx->contentscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/content().( |
| 46 | login => $login, |
| 47 | password => $password, |
| 48 | action => 'Modify Recurring Authorization', |
| 49 | subscription => $subscription, |
| 50 | amount => '19.95', |
| 51 | ); |
| 52 | $tx->test_transactionscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/test_transaction().(1); |
| 53 | $tx->submitscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/submit().(); |
| 54 | okscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/ok().($tx->is_successscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/is_success().()) or diagscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/diag(). $tx->error_messagescip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/error_message().; |
| 55 | |
| 56 | $tx->contentscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/content().( |
| 57 | login => $login, |
| 58 | password => $password, |
| 59 | action => 'Cancel Recurring Authorization', |
| 60 | subscription => $subscription, |
| 61 | ); |
| 62 | $tx->test_transactionscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/test_transaction().(1); |
| 63 | $tx->submitscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/submit().(); |
| 64 | okscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/ok().($tx->is_successscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/is_success().()) or diagscip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 main/diag(). $tx->error_messagescip-perl cpan Business-OnlinePayment-AuthorizeNet 3.23 Business/OnlinePayment/error_message().; |
| 65 | } |