[freeside-commits] branch FREESIDE_4_BRANCH updated. c1822833ea22d3d32d2f67412b834d48bfdef7fb

Jonathan Prykop jonathan at 420.am
Mon Aug 29 16:46:03 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  c1822833ea22d3d32d2f67412b834d48bfdef7fb (commit)
      from  b09f61d517dc01dd2eae04b3e03a5b9e5dab1a0f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c1822833ea22d3d32d2f67412b834d48bfdef7fb
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Jul 25 16:32:30 2016 -0500

    RT#42393: Verification cust_pay_pending handling in history & report

diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm
index 0fc2cb7..7c1de9b 100644
--- a/FS/FS/cust_main/Billing_Realtime.pm
+++ b/FS/FS/cust_main/Billing_Realtime.pm
@@ -1950,6 +1950,7 @@ sub realtime_verify_bop {
     if ( $reverse->is_success ) {
 
       $cust_pay_pending->status('done');
+      $cust_pay_pending->statustext('reversed');
       my $cpp_authorized_err = $cust_pay_pending->replace;
       return $cpp_authorized_err if $cpp_authorized_err;
 
diff --git a/FS/FS/cust_pay_pending.pm b/FS/FS/cust_pay_pending.pm
index dfb07b8..3a8322e 100644
--- a/FS/FS/cust_pay_pending.pm
+++ b/FS/FS/cust_pay_pending.pm
@@ -455,6 +455,26 @@ sub decline {
   $self->replace;
 }
 
+=item reverse [ STATUSTEXT ]
+
+Sets the status of this pending payment to "done" (with statustext
+"reversed (manual)" unless otherwise specified).
+
+Currently only used when resolving pending payments manually.
+
+=cut
+
+# almost complete false laziness with decline,
+# but want to avoid confusion, in case any additional steps/defaults are ever added to either
+sub reverse {
+  my $self = shift;
+  my $statustext = shift || "reversed (manual)";
+
+  $self->status('done');
+  $self->statustext($statustext);
+  $self->replace;
+}
+
 # _upgrade_data
 #
 # Used by FS::Upgrade to migrate to a new database.
diff --git a/httemplate/edit/cust_pay_pending.html b/httemplate/edit/cust_pay_pending.html
index 0056bb9..7d480f3 100644
--- a/httemplate/edit/cust_pay_pending.html
+++ b/httemplate/edit/cust_pay_pending.html
@@ -4,6 +4,10 @@
 
     <CENTER><FONT SIZE="+1"><B>Are you sure you want to delete this pending payment?</B></FONT></CENTER>
 
+% } elsif (( $action eq 'complete' ) and $authorized) {
+
+    <CENTER><FONT SIZE="+1"><B>Payment was authorized but not captured.  Contact <% $cust_pay_pending->processor || 'the payment gateway' %> to establish the final disposition of this transaction.</B></FONT></CENTER>
+
 % } elsif ( $action eq 'complete' ) {
 
     <CENTER><FONT SIZE="+1"><B>No response was received from <% $cust_pay_pending->processor || 'the payment gateway' %> for this transaction.  Check <% $cust_pay_pending->processor || 'the payment gateway' %>'s reporting and determine if this transaction completed successfully.</B></FONT></CENTER>
@@ -97,8 +101,6 @@
 
 % } else {
 
-%#   if ( $action eq 'complete' ) {
-
     <INPUT TYPE="hidden" NAME="action" VALUE="">
 
     <TR>
@@ -106,18 +108,25 @@
         <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'insert_cust_pay'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/tick.png" ALT=""-->Yes, transaction completed sucessfully.</BUTTON>
       </TD>
 
-%     if ( $action eq 'complete' ) {
+%   if ( $action eq 'complete' ) {
         <TD>   </TD>
+%     if ($authorized) {
+        <TD ALIGN="center">
+          <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'reverse'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was reversed</BUTTON>
+        </TD>
+%     } else {
         <TD ALIGN="center">
           <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'decline'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was declined</BUTTON>
         </TD>
+%     }
         <TD>   </TD>
         <TD ALIGN="center">
           <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'delete'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was not received</BUTTON>
         </TD>
-      </TR>
 %   }
 
+    </TR>
+
     <TR><TD COLSPAN=5></TD></TR>
 
     <TR>
@@ -156,6 +165,8 @@ my $cust_pay_pending =
   })
   or die 'unknown paypendingnum';
 
+my $authorized = ($cust_pay_pending->status eq 'authorized') ? 1 : 0;
+
 my $conf = new FS::Conf;
 
 my $money_char = $conf->config('money_char') || '$';
diff --git a/httemplate/edit/process/cust_pay_pending.html b/httemplate/edit/process/cust_pay_pending.html
index 1bad6cf..0ff7d26 100644
--- a/httemplate/edit/process/cust_pay_pending.html
+++ b/httemplate/edit/process/cust_pay_pending.html
@@ -59,6 +59,15 @@ if ( $action eq 'delete' ) {
     $title = 'Pending payment completed (decline)';
   }
 
+} elsif ( $action eq 'reverse' ) {
+
+  $error = $cust_pay_pending->reverse;
+  if ( $error ) {
+    $title = 'Error reversing pending payment';
+  } else {
+    $title = 'Pending payment completed (reverse)';
+  }
+
 } else {
 
   die "unknown action $action";
diff --git a/httemplate/search/cust_pay_pending.html b/httemplate/search/cust_pay_pending.html
index 8662d19..697bdbb 100755
--- a/httemplate/search/cust_pay_pending.html
+++ b/httemplate/search/cust_pay_pending.html
@@ -17,7 +17,7 @@
 my %statusaction = (
   'new'        => 'delete',
   'pending'    => 'complete',
-  #'authorized' => '',
+  'authorized' => 'complete',
   'captured'   => 'capture',
   #'declined'   => '',
   #wouldn't need to take action on a done state#'done'
diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html
index 7979fdd..9803cab 100755
--- a/httemplate/search/elements/cust_pay_or_refund.html
+++ b/httemplate/search/elements/cust_pay_or_refund.html
@@ -101,29 +101,30 @@ my $title = '';
 $title = 'Unapplied ' if $unapplied;
 $title .= "\u$name_singular Search Results";
 
-my $link = '';
-if (    ( $curuser->access_right('View invoices') #remove in 2.5 (2.7?)
-          || ($curuser->access_right('View payments') && $table =~ /^cust_pay/)
-          || ($curuser->access_right('View refunds') && $table eq 'cust_refund')
-        )
-     && ! $opt{'disable_link'}
-   )
-{
-
-  my $key;
-  my $q = '';
-  if ( $table eq 'cust_pay_void' ) {
-    $key = 'paynum';
-    $q .= 'void=1;';
-  } elsif ( $table eq /^cust_(\w+)$/ ) {
-    $key = $1.'num';
-  }
-  
-  if ( $key ) {
-    $q .= "$key=";
-    $link = [ "${p}view/$table.html?$q", $key ]
-  }
-}
+###NOT USED???
+#my $link = '';
+#if (    ( $curuser->access_right('View invoices') #remove in 2.5 (2.7?)
+#          || ($curuser->access_right('View payments') && $table =~ /^cust_pay/)
+#          || ($curuser->access_right('View refunds') && $table eq 'cust_refund')
+#        )
+#     && ! $opt{'disable_link'}
+#   )
+#{
+#
+#  my $key;
+#  my $q = '';
+#  if ( $table eq 'cust_pay_void' ) {
+#    $key = 'paynum';
+#    $q .= 'void=1;';
+#  } elsif ( $table eq /^cust_(\w+)$/ ) {
+#    $key = $1.'num';
+#  }
+#  
+#  if ( $key ) {
+#    $q .= "$key=";
+#    $link = [ "${p}view/$table.html?$q", $key ]
+#  }
+#}
 
 my $cust_link = sub {
   my $cust_thing = shift;
@@ -176,12 +177,18 @@ if ( $opt{'pre_header'} ) {
   push @sort_fields, @{ $opt{'pre_fields'} };
 }
 
-my $sub_receipt = sub {
+my $sub_receipt = $opt{'disable_link'} ? '' : sub {
   my $obj = shift;
   my $objnum = $obj->primary_key . '=' . $obj->get($obj->primary_key);
+  my $table = $obj->table;
+  my $void = '';
+  if ($table eq 'cust_pay_void') {
+    $table = 'cust_pay';
+    $void = ';void=1';
+  }
 
   include('/elements/popup_link_onclick.html',
-    'action'  => $p.'view/cust_pay.html?link=popup;'.$objnum,
+    'action'  => $p.'view/'.$table.'.html?link=popup;'.$objnum.$void,
     'actionlabel' => emt('Payment Receipt'),
   );
 };
diff --git a/httemplate/view/cust_main/payment_history/pending_payment.html b/httemplate/view/cust_main/payment_history/pending_payment.html
index 3114923..cf7ef7c 100644
--- a/httemplate/view/cust_main/payment_history/pending_payment.html
+++ b/httemplate/view/cust_main/payment_history/pending_payment.html
@@ -12,6 +12,7 @@ my %statusaction = (
   'new'        => 'delete',
   'thirdparty' => 'delete',
   'pending'    => 'complete',
+  'authorized' => 'complete',
   'captured'   => 'capture',
 );
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main/Billing_Realtime.pm                |    1 +
 FS/FS/cust_pay_pending.pm                          |   20 +++++++
 httemplate/edit/cust_pay_pending.html              |   19 +++++--
 httemplate/edit/process/cust_pay_pending.html      |    9 ++++
 httemplate/search/cust_pay_pending.html            |    2 +-
 httemplate/search/elements/cust_pay_or_refund.html |   57 +++++++++++---------
 .../cust_main/payment_history/pending_payment.html |    1 +
 7 files changed, 79 insertions(+), 30 deletions(-)




More information about the freeside-commits mailing list