From a5167d9e33d24e4c091b44e79b05da08cf2e6fcb Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 25 Mar 2006 09:36:28 +0000 Subject: [PATCH] move "payee" to a new() option, use "RECURRIN" for check # if one is missing...? --- Changes | 2 ++ OpenECHO.pm | 20 ++++++++++++++++---- t/bad_check.t | 6 ++++-- t/check.t | 6 ++++-- t/crypt_bad_check.t | 6 ++++-- t/crypt_check.t | 6 ++++-- 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Changes b/Changes index b8d0000..0f4b029 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,8 @@ - tests: enable check.t and add crypt_check.t and {crypt_}bad_check.t - update with new test account - s/CHECK/ECHECK/, DOH + - move "payee" to a new() option, that makes more sense? + - use 'RECURRIN' for check # if one is missing...? 0.02 Mon Sep 13 17:14:29 2004 - update test account with new PIN diff --git a/OpenECHO.pm b/OpenECHO.pm index 682c488..68a4400 100644 --- a/OpenECHO.pm +++ b/OpenECHO.pm @@ -223,7 +223,7 @@ sub submit { license_num => 'ec_id_number', license_state => 'ec_id_state', #license_dob => - payee => 'ec_payee', + #get from new() args instead# payee => 'ec_payee', check_number => 'ec_serial_number', #recurring_billing => 'cnp_recurring', @@ -235,7 +235,7 @@ sub submit { #XXX counter field shouldn't be just a random integer (but it does need a #default this way i guess... $self->{_content}{counter} = int(rand(2**31)); - + if ( $self->transaction_type =~ /^[EA][VS]$/ ) { #ccexp_month & ccexp_year $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/ @@ -246,6 +246,19 @@ sub submit { $self->{_content}{ccexp_year} = $year; } + if ( $self->transaction_type =~ /^D[DVCH]$/ ) { #echeck + + #check number kludge... "periodic bill payments" don't have check #s! + $self->{_content}{ec_serial_number} = 'RECURRIN' + #$self->{_content}{ec_serial_number} = '00000000' + if ! length($self->{_content}{ec_serial_number}) + && $self->{_content}{ec_payment_type} =~ /^(PPD)?$/i; + + ( $self->{_content}{ec_payee} = $self->payee ) + or croak "'payee' option required when instantiating new ". + "Business::OnlinePayment::OpenECHO object\n"; + } + $self->{_content}{cnp_recurring} = 'Y' if exists($self->{_content}{recurring_billing}) && $self->{_content}{recurring_billing} =~ /^y/i; @@ -655,8 +668,7 @@ Content required: type, login, password, action, amount, first_name, last_name, =head2 Check -Not yet implemented... -#Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code, bank_name. +Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code, bank_name. (...more) =head1 PREREQUISITES diff --git a/t/bad_check.t b/t/bad_check.t index 4102922..37e1243 100644 --- a/t/bad_check.t +++ b/t/bad_check.t @@ -8,7 +8,9 @@ if ( $@ ) { use Business::OnlinePayment; # checks are broken it seems -my $ctx = new Business::OnlinePayment("OpenECHO"); +my $ctx = new Business::OnlinePayment("OpenECHO", + payee => 'Tofu Heavy Enterprises, GmbH', +); $ctx->content( type => 'ECHECK', 'login' => '123>4685706', @@ -23,7 +25,7 @@ $ctx->content( routing_code => '026009593', bank_name => 'First National Test Bank', phone => '420-420-5454', - payee => 'Tofu Heavy Enterprises, GmbH', + #payee => 'Tofu Heavy Enterprises, GmbH', check_number => '420', ); $ctx->test_transaction(1); # test, dont really charge diff --git a/t/check.t b/t/check.t index f8c83a3..21d9c77 100644 --- a/t/check.t +++ b/t/check.t @@ -8,7 +8,9 @@ if ( $@ ) { use Business::OnlinePayment; # checks are broken it seems -my $ctx = new Business::OnlinePayment("OpenECHO"); +my $ctx = new Business::OnlinePayment( "OpenECHO", + 'payee' => 'Tofu Heavy Enterprises, GmbH', +); $ctx->content( type => 'ECHECK', 'login' => '123>4685706', @@ -23,7 +25,7 @@ $ctx->content( routing_code => '026009593', bank_name => 'First National Test Bank', phone => '420-420-5454', - payee => 'Tofu Heavy Enterprises, GmbH', + #payee => 'Tofu Heavy Enterprises, GmbH', check_number => '420', ); $ctx->test_transaction(1); # test, dont really charge diff --git a/t/crypt_bad_check.t b/t/crypt_bad_check.t index f47f53e..cdbb8ac 100644 --- a/t/crypt_bad_check.t +++ b/t/crypt_bad_check.t @@ -12,7 +12,9 @@ if ( $@ ) { use Business::OnlinePayment; # checks are broken it seems -my $ctx = new Business::OnlinePayment("OpenECHO"); +my $ctx = new Business::OnlinePayment("OpenECHO", + payee => 'Tofu Heavy Enterprises, GmbH', +); $ctx->content( type => 'ECHECK', 'login' => '123>4685706', @@ -27,7 +29,7 @@ $ctx->content( routing_code => '026009593', bank_name => 'First National Test Bank', phone => '420-420-5454', - payee => 'Tofu Heavy Enterprises, GmbH', + #payee => 'Tofu Heavy Enterprises, GmbH', check_number => '420', ); $ctx->test_transaction(1); # test, dont really charge diff --git a/t/crypt_check.t b/t/crypt_check.t index d0c09ab..808dc07 100644 --- a/t/crypt_check.t +++ b/t/crypt_check.t @@ -12,7 +12,9 @@ if ( $@ ) { use Business::OnlinePayment; # checks are broken it seems -my $ctx = new Business::OnlinePayment("OpenECHO"); +my $ctx = new Business::OnlinePayment("OpenECHO", + payee => 'Tofu Heavy Enterprises, GmbH', +); $ctx->content( type => 'ECHECK', 'login' => '123>4685706', @@ -27,7 +29,7 @@ $ctx->content( routing_code => '026009593', bank_name => 'First National Test Bank', phone => '420-420-5454', - payee => 'Tofu Heavy Enterprises, GmbH', + #payee => 'Tofu Heavy Enterprises, GmbH', check_number => '420', ); $ctx->test_transaction(1); # test, dont really charge -- 2.11.0