Business::OnlinePayment::BankOfAmerica
authorivan <ivan>
Tue, 25 Sep 2001 15:55:48 +0000 (15:55 +0000)
committerivan <ivan>
Tue, 25 Sep 2001 15:55:48 +0000 (15:55 +0000)
FS/FS/cust_main.pm
httemplate/docs/config.html

index 8b9dedb..d66d08c 100644 (file)
@@ -1150,6 +1150,8 @@ sub collect {
             $paylast = $self->getfield('first');
             $payname =  "$payfirst $paylast";
           }
+
+          my( $action1, $action2 ) = split(/\s*\,\s*/, $bop_action );
         
           my $transaction =
             new Business::OnlinePayment( $bop_processor, @bop_options );
@@ -1157,7 +1159,8 @@ sub collect {
             'type'           => 'CC',
             'login'          => $bop_login,
             'password'       => $bop_password,
-            'action'         => $bop_action,
+            'action'         => $action1,
+            'description'    => 'Internet Services',
             'amount'         => $amount,
             'invoice_number' => $cust_bill->invnum,
             'customer_id'    => $self->custnum,
@@ -1171,10 +1174,42 @@ sub collect {
             'country'        => $self->country,
             'card_number'    => $self->payinfo,
             'expiration'     => $exp,
+            'referer'        => 'http://cleanwhisker.420.am/',
           );
           $transaction->submit();
 
-          if ( $transaction->is_success()) {
+          if ( $transaction->is_success() && $action2 ) {
+            my $auth = $transaction->authorization;
+            my $ordernum = $transaction->order_number;
+            #warn "********* $auth ***********\n";
+            #warn "********* $ordernum ***********\n";
+            my $capture =
+              new Business::OnlinePayment( $bop_processor, @bop_options );
+
+            $capture->content(
+              action         => $action2,
+              login          => $bop_login,
+              password       => $bop_password,
+              order_number   => $ordernum,
+              amount         => $amount,
+              authorization  => $auth,
+              description    => 'Internet Services',
+            );
+
+            $capture->submit();
+
+            unless ( $capture->is_success ) {
+              my $e = "Authorization sucessful but capture failed, invnum #".
+                      $cust_bill->invnum. ': '.  $capture->result_code.
+                      ": ". $capture->error_message;
+              warn $e;
+              return $e;
+            }
+
+          }
+
+          if ( $transaction->is_success() ) {
+
             my $cust_pay = new FS::cust_pay ( {
                'invnum'   => $cust_bill->invnum,
                'paid'     => $amount,
@@ -1663,7 +1698,7 @@ sub append_fuzzyfiles {
 
 =head1 VERSION
 
-$Id: cust_main.pm,v 1.34 2001-09-20 00:13:07 ivan Exp $
+$Id: cust_main.pm,v 1.35 2001-09-25 15:55:48 ivan Exp $
 
 =head1 BUGS
 
index 424985b..0e085b0 100644 (file)
@@ -37,7 +37,7 @@ All further configuration files and directories are located in
   <li><a name="apachemachines">apachemachines</a> - Your Apache machines, one per line.  This enables export of `/etc/apache/vhosts.conf', which can be included in your Apache configuration via the <a href="http://www.apache.org/docs/mod/core.html#include">Include</a> directive.
   <li><a name="bindprimary">bindprimary</a> - Your BIND primary nameserver.  This enables export of /var/named/named.conf and zone files into /var/named
   <li><a name="bindsecondaries">bindsecondaries</a> - Your BIND secondary nameservers, one per line.  This enables export of /var/named/named.conf
-  <li><a name="business-onlinepayment">business-onlinepayment</a> - <a href="http://search.cpan.org/search?dist=Business-OnlinePayment">Business::OnlinePayment</a> support, at least three lines: processor, login, and password.  An optional fourth line specifies the action.  Optional additional lines are passed to Business::OnlinePayment as %processor_options.
+  <li><a name="business-onlinepayment">business-onlinepayment</a> - <a href="http://search.cpan.org/search?dist=Business-OnlinePayment">Business::OnlinePayment</a> support, at least three lines: processor, login, and password.  An optional fourth line specifies the action or actions (multiple actions are separated with `,': for example: `Authorization Only, Post Authorization').    Optional additional lines are passed to Business::OnlinePayment as %processor_options.
   <li><a name="bsdshellmachines">bsdshellmachines</a> - Your BSD flavored shell (and mail) machines, one per line.  This enables export of `/etc/passwd' and `/etc/master.passwd'.
   <li><a name="countrydefault">countrydefault</a> - Default two-letter country code (if not supplied, the default is `US')
   <li>cybercash3.2 - <a href="http://www.cybercash.com/cybercash/services/technology.html">CyberCash v3.2</a> support.  Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly' or `mauthcapture').  CCMckLib3_2.pm, CCMckDirectLib3_2.pm and CCMckErrno3_2 are required.