Subject: | Add support for Reverse Authorization in IPPay |
Hi,
The attached patch adds support for Reverse Authorization in
Business-OnlinePayment-IPPay-0.06.
Although the patch is for 0.06 we've actually had it in production for
some time using the 0.04 version of IPPay.
Finally thought it might be time to give others the benefit :)
Per the README file, patch attached in unified diff format.
Doug
Subject: | 0.06_to_mt_ext.diff |
diff -r -u /Business-OnlinePayment-IPPay-0.06/IPPay.pm ./IPPay.pm
--- /Business-OnlinePayment-IPPay-0.06/IPPay.pm 2011-01-26 13:15:38.000000000 -0800
+++ ./IPPay.pm 2012-05-04 14:39:59.000000000 -0700
@@ -28,6 +28,7 @@
'Post Authorization',
'Void',
'Credit',
+ 'Reverse Authorization',
],
'ECHECK' => [
'Normal Authorization',
@@ -89,6 +90,7 @@
( 'normal authorization' => 'SALE',
'authorization only' => 'AUTHONLY',
'post authorization' => 'CAPT',
+ 'reverse authorization' => 'REVERSEAUTH',
'void' => 'VOID',
'credit' => 'CREDIT',
);
@@ -189,6 +191,8 @@
}elsif ( $action eq 'post authorization' && $type eq 'CC') {
push @required_fields, qw( order_number );
+ }elsif ( $action eq 'reverse authorization' && $type eq 'CC') {
+ push @required_fields, qw( order_number card_number expiration amount );
}elsif ( $action eq 'void') {
push @required_fields, qw( order_number amount );
@@ -521,6 +525,7 @@
normal authorization
authorization only
+ reverse authorization
post authorization
credit
void
diff -r -u /Business-OnlinePayment-IPPay-0.06/t/card.t ./t/card.t
--- /Business-OnlinePayment-IPPay-0.06/t/card.t 2011-01-26 13:14:26.000000000 -0800
+++ ./t/card.t 2012-05-04 11:35:13.000000000 -0700
@@ -4,7 +4,7 @@
require "t/lib/test_account.pl";
my($login, $password, %opt) = test_account_or_skip('card');
-plan tests => 43;
+plan tests => 50;
use_ok 'Business::OnlinePayment';
@@ -89,6 +89,34 @@
$postable_amount = $content{amount} if $tx->is_success;
}
+# authorization void test
+{
+ my $tx = Business::OnlinePayment->new("IPPay", @opts);
+ $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", @opts);
+
+ $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", %opt );