#!/usr/bin/perl -w
use Test::More;
+require "t/lib/test_account.pl";
-my($login, $password, @opts) = ('TESTMERCHANT', '',
- 'default_Origin' => 'RECURRING' );
-plan tests => 43;
+my($login, $password, %opt) = test_account_or_skip('card');
+plan tests => 50;
use_ok 'Business::OnlinePayment';
# valid card number test
{
- my $tx = Business::OnlinePayment->new("IPPay", @opts);
+ my $tx = Business::OnlinePayment->new("IPPay", %opt);
$tx->content(%content);
tx_check(
$tx,
result_code => '000',
error_message => 'APPROVED',
authorization => qr/TEST\d{2}/,
- avs_code => 'U', # so rather pointless :\
+# avs_code => 'U', # so rather pointless :\
+ avs_code => 'Y', # so very pointless :\
cvv2_response => 'P', # ...
);
$voidable = $tx->order_number if $tx->is_success;
# invalid card number test
{
- my $tx = Business::OnlinePayment->new("IPPay", @opts);
+ my $tx = Business::OnlinePayment->new("IPPay", %opt);
$tx->content(%content, card_number => "4111111111111112" );
tx_check(
$tx,
desc => "invalid card_number",
is_success => 0,
- result_code => '912',
- error_message => 'INVALID CARD NUMBER',
+ result_code => '900', #'912' with old jetpay gw
+ error_message => 'Invalid card number. ', #'INVALID CARD NUMBER' w/old gw
authorization => qr/^$/,
avs_code => '', # so rather pointless :\
cvv2_response => '', # ...
# authorization only test
{
- my $tx = Business::OnlinePayment->new("IPPay", @opts);
+ my $tx = Business::OnlinePayment->new("IPPay", %opt);
$tx->content(%content, action => 'authorization only', amount => '3.00' );
tx_check(
$tx,
result_code => '000',
error_message => 'APPROVED',
authorization => qr/TEST\d{2}/,
- avs_code => 'U', # so rather pointless :\
+# avs_code => 'U', # so rather pointless :\
+ avs_code => 'Y', # so very pointless :\
cvv2_response => 'P', # ...
);
$postable = $tx->order_number if $tx->is_success;
$postable_amount = $content{amount} if $tx->is_success;
}
+# authorization void test
+SKIP: {
+ #XXX void is returning "The transaction type is not a valid transaction type."
+ # with current IPPay. did something change about the API, is this broken?
+ skip 'Reverse Authorization not currently working (against test account?)', 7;
+
+ my $tx = Business::OnlinePayment->new("IPPay", %opt);
+ $tx->content(%content, action => 'authorization only', amount => '3.00' );
+ $tx->test_transaction(1);
+ $tx->submit;
+
+ if ($tx->is_success) {
+ my $void_tx = Business::OnlinePayment->new("IPPay", %opt );
+
+ $tx->content(%content, action => 'reverse authorization',
+ order_number => $tx->order_number );
+ tx_check(
+ $tx,
+ desc => "reverse authorization",
+ is_success => 1,
+ result_code => '000',
+ error_message => 'APPROVED',
+ authorization => qr/TEST\d{2}/,
+ avs_code => '', # so rather pointless :\
+ cvv2_response => '', # ...
+ );
+ }
+ else {
+
+ }
+}
+
# post authorization test
SKIP: {
- my $tx = new Business::OnlinePayment( "IPPay", %opts );
+ my $tx = new Business::OnlinePayment( "IPPay", %opt );
$tx->content( %content, 'action' => "post authorization",
'amount' => $postable_amount, # not required
'order_number' => $postable,
# void test
SKIP: {
- my $tx = new Business::OnlinePayment( "IPPay", %opts );
+ my $tx = new Business::OnlinePayment( "IPPay", %opt );
$tx->content( %content, 'action' => "Void",
'order_number' => $voidable,
'authorization' => $voidable_auth,
# credit test
SKIP: {
- my $tx = new Business::OnlinePayment( "IPPay", %opts );
+ my $tx = new Business::OnlinePayment( "IPPay", %opt );
$tx->content( %content, 'action' => "credit");
tx_check(
$tx,
);
}
-sub expiration_date {
- my($month, $year) = (localtime)[4,5];
- $year++; # So we expire next year.
- $year %= 100; # y2k? What's that?
-
- return sprintf("%02d/%02d", $month, $year);
-}