X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpayment_history%2Fpayment.html;h=0ed2f8003512e96d54c9437a52bf4c064ec60793;hb=f3738a9fcd588d32eea9b0af6a3e884293c0c6e5;hp=bf88a6607cf948b19d2aa315be0ad8a54836881e;hpb=85f0e2caa759102f68fe28278faf5f65c7b33b3c;p=freeside.git diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html index bf88a6607..0ed2f8003 100644 --- a/httemplate/view/cust_main/payment_history/payment.html +++ b/httemplate/view/cust_main/payment_history/payment.html @@ -154,18 +154,19 @@ if ( $apply && $opt{'pkg-balances'} && $cust_pay->pkgnum ) { my $refund = ''; my $refund_days = $opt{'card_refund-days'} || 120; -my $refund_right = ''; -$refund_right = 'Refund credit card payment' if $cust_pay->payby eq 'CARD'; -$refund_right = 'Refund Echeck payment' if $cust_pay->payby eq 'CHEK'; +my @refund_right = grep { $opt{$_} } $FS::CurrentUser::CurrentUser->refund_rights($cust_pay->payby); if ( $cust_pay->closed !~ /^Y/i - && $cust_pay->payby =~ /^(CARD|CHEK)$/ + && $cust_pay->payby =~ /^(CARD|CHEK|BILL)$/ && time-$cust_pay->_date < $refund_days*86400 && $cust_pay->unrefunded > 0 - && $opt{$refund_right} + && scalar(@refund_right) ) { + my $refundtitle = ($cust_pay->payby =~ /^(CARD|CHEK)$/) + ? emt('Send a refund for this payment to the payment gateway') + : emt('Record a refund for this payment'); $refund = qq! (' . emt('refund') . ')'; }