agent-virtualize credit card surcharge percentage, RT#72961
authorIvan Kohler <ivan@freeside.biz>
Sun, 16 Oct 2016 22:11:35 +0000 (15:11 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sun, 16 Oct 2016 22:11:35 +0000 (15:11 -0700)
FS/FS/ClientAPI/MasonComponent.pm
FS/FS/ClientAPI/MyAccount.pm
FS/FS/cust_main/Billing_Realtime.pm
httemplate/misc/payment.cgi

index 493e0c0..3a4bfe1 100644 (file)
@@ -62,7 +62,7 @@ my %session_callbacks = (
       'process-display'    => scalar($conf->config('selfservice_process-display')),
       'process-skip_first' => $conf->exists('selfservice_process-skip_first'),
       'num_payments'       => scalar($cust_main->cust_pay), 
-      'surcharge_percentage' => scalar($conf->config('credit-card-surcharge-percentage')),
+      'surcharge_percentage' => scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum)),
     );
     @$argsref = ( %args );
 
index 23fbf6c..3d01c0d 100644 (file)
@@ -868,7 +868,6 @@ sub payment_info {
 
       'save_unchecked' => $conf->exists('selfservice-save_unchecked'),
 
-      'credit_card_surcharge_percentage' => scalar($conf->config('credit-card-surcharge-percentage')),
     };
 
   }
@@ -929,6 +928,8 @@ sub payment_info {
   $return{payunique} = "webui-MyAccount-$_date-$$-". rand() * 2**32; #new
   $return{paybatch} = $return{payunique};  #back compat
 
+  $return{credit_card_surcharge_percentage} = $conf->config('credit-card-surcharge-percentage', $cust_main->agentnum);
+
   return { 'error' => '',
            %return,
          };
index 5d35fc2..bc98b88 100644 (file)
@@ -353,8 +353,8 @@ sub realtime_bop {
 
   my $cc_surcharge = 0;
   my $cc_surcharge_pct = 0;
-  $cc_surcharge_pct = $conf->config('credit-card-surcharge-percentage') 
-    if $conf->config('credit-card-surcharge-percentage')
+  $cc_surcharge_pct = $conf->config('credit-card-surcharge-percentage', $self->agentnum
+    if $conf->config('credit-card-surcharge-percentage', $self->agentnum)
     && $options{method} eq 'CC';
 
   # always add cc surcharge if called from event 
index 64fbe8a..4fa3df7 100644 (file)
@@ -19,7 +19,7 @@
        'num_payments'       => scalar($cust_main->cust_pay), 
        'surcharge_percentage' =>
          ( $payby eq 'CARD'
-             ? scalar($conf->config('credit-card-surcharge-percentage'))
+             ? scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum))
              : 0
          ),
   &>