move "payee" to a new() option, use "RECURRIN" for check # if one is missing...?
[Business-OnlinePayment-OpenECHO.git] / OpenECHO.pm
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