store exp in cust_pay and pass to B:OP during refunds with paynum (#1662)
authorjeff <jeff>
Fri, 15 Jun 2007 00:58:18 +0000 (00:58 +0000)
committerjeff <jeff>
Fri, 15 Jun 2007 00:58:18 +0000 (00:58 +0000)
FS/FS/Schema.pm
FS/FS/cust_main.pm

index 463f637..b0677be 100644 (file)
@@ -526,6 +526,7 @@ sub tables_hashref {
                                                  # eventually
         'payinfo',  'varchar',   'NULL', 512, '', '', #see cust_main above
        'paymask', 'varchar', 'NULL', $char_d, '', '', 
+        'paydate',  'varchar', 'NULL', 10, '', '', 
         'paybatch', 'varchar',   'NULL', $char_d, '', '', #for auditing purposes.
         'closed',    'char', 'NULL', 1, '', '', 
       ],
index b219c6c..c798c4f 100644 (file)
@@ -2566,10 +2566,11 @@ sub realtime_bop {
   $content{invoice_number} = $options{'invnum'}
     if exists($options{'invnum'}) && length($options{'invnum'});
 
+  my $paydate = '';
   if ( $method eq 'CC' ) { 
 
     $content{card_number} = $payinfo;
-    my $paydate = exists($options{'paydate'})
+    $paydate = exists($options{'paydate'})
                     ? $options{'paydate'}
                     : $self->paydate;
     $paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
@@ -2753,6 +2754,7 @@ sub realtime_bop {
        'payby'    => $method2payby{$method},
        'payinfo'  => $payinfo,
        'paybatch' => $paybatch,
+       'paydate'  => $paydate,
     } );
     my $error = $cust_pay->insert($options{'manual'} ? ( 'manual' => 1 ) : () );
     if ( $error ) {
@@ -3105,8 +3107,8 @@ sub realtime_refund_bop {
 
     if ( $cust_pay ) {
       $content{card_number} = $payinfo = $cust_pay->payinfo;
-      #$self->paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
-      #$content{expiration} = "$2/$1";
+      $cust_pay->paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/ &&
+      ($content{expiration} = "$2/$1");  # where available
     } else {
       $content{card_number} = $payinfo = $self->payinfo;
       $self->paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;