move "payee" to a new() option, use "RECURRIN" for check # if one is missing...?
authorivan <ivan>
Sat, 25 Mar 2006 09:36:28 +0000 (09:36 +0000)
committerivan <ivan>
Sat, 25 Mar 2006 09:36:28 +0000 (09:36 +0000)
Changes
OpenECHO.pm
t/bad_check.t
t/check.t
t/crypt_bad_check.t
t/crypt_check.t

diff --git a/Changes b/Changes
index b8d0000..0f4b029 100644 (file)
--- 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
index 682c488..68a4400 100644 (file)
@@ -223,7 +223,7 @@ sub submit {
         license_num       => 'ec_id_number',\r
         license_state     => 'ec_id_state',\r
         #license_dob       =>\r
-        payee             => 'ec_payee',\r
+        #get from new() args instead# payee             => 'ec_payee',\r
         check_number      => 'ec_serial_number',\r
 \r
         #recurring_billing => 'cnp_recurring',\r
@@ -235,7 +235,7 @@ sub submit {
     #XXX counter field shouldn't be just a random integer (but it does need a\r
     #default this way i guess...\r
     $self->{_content}{counter} = int(rand(2**31));\r
-    \r
+\r
     if ( $self->transaction_type =~ /^[EA][VS]$/ ) {\r
       #ccexp_month & ccexp_year\r
       $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/\r
@@ -246,6 +246,19 @@ sub submit {
       $self->{_content}{ccexp_year} = $year;\r
     }\r
 \r
+    if ( $self->transaction_type =~ /^D[DVCH]$/ ) { #echeck\r
+\r
+      #check number kludge... "periodic bill payments" don't have check #s!\r
+      $self->{_content}{ec_serial_number} = 'RECURRIN'\r
+      #$self->{_content}{ec_serial_number} = '00000000'\r
+        if ! length($self->{_content}{ec_serial_number})\r
+        && $self->{_content}{ec_payment_type} =~ /^(PPD)?$/i;\r
+\r
+      ( $self->{_content}{ec_payee} = $self->payee )\r
+        or croak "'payee' option required when instantiating new ".\r
+                 "Business::OnlinePayment::OpenECHO object\n";\r
+    }\r
+\r
     $self->{_content}{cnp_recurring} = 'Y'\r
       if exists($self->{_content}{recurring_billing})\r
       && $self->{_content}{recurring_billing} =~ /^y/i;\r
@@ -655,8 +668,7 @@ Content required: type, login, password, action, amount, first_name, last_name,
 \r
 =head2 Check\r
 \r
-Not yet implemented...\r
-#Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code, bank_name.\r
+Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code, bank_name. (...more)\r
 \r
 =head1 PREREQUISITES\r
 \r
index 4102922..37e1243 100644 (file)
@@ -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
index f8c83a3..21d9c77 100644 (file)
--- 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
index f47f53e..cdbb8ac 100644 (file)
@@ -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
index d0c09ab..808dc07 100644 (file)
@@ -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