[freeside-commits] branch FREESIDE_3_BRANCH updated. 4e091a88af83ba9293a1747aaf754439dcc4cd39
Jonathan Prykop
jonathan at 420.am
Mon Nov 9 18:14:38 PST 2015
The branch, FREESIDE_3_BRANCH has been updated
via 4e091a88af83ba9293a1747aaf754439dcc4cd39 (commit)
from 09bdc89b2cf12d7b4f4dd1376975b4c9164b4249 (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 4e091a88af83ba9293a1747aaf754439dcc4cd39
Author: Jonathan Prykop <jonathan at freeside.biz>
Date: Mon Nov 9 19:58:47 2015 -0600
RT#36806: Add message template substitution to show last four digits of credit card number [v3 merge]
diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm
index 9c2b284..5c6392c 100644
--- a/FS/FS/msg_template.pm
+++ b/FS/FS/msg_template.pm
@@ -508,6 +508,17 @@ my $usage_warning = sub {
# If you add anything, be sure to add a description in
# httemplate/edit/msg_template.html.
sub substitutions {
+ my $payinfo_sub = sub {
+ my $obj = shift;
+ ($obj->payby eq 'CARD' || $obj->payby eq 'CHEK')
+ ? $obj->paymask
+ : $obj->decrypt($obj->payinfo)
+ };
+ my $payinfo_end = sub {
+ my $obj = shift;
+ my $payinfo = &$payinfo_sub($obj);
+ substr($payinfo, -4);
+ };
{ 'cust_main' => [qw(
display_custnum agentnum agent_name
@@ -654,11 +665,8 @@ sub substitutions {
# overrides the one in cust_main in cases where a cust_pay is passed
[ payby => sub { FS::payby->shortname(shift->payby) } ],
[ date => sub { time2str("%a %B %o, %Y", shift->_date) } ],
- [ payinfo => sub {
- my $cust_pay = shift;
- ($cust_pay->payby eq 'CARD' || $cust_pay->payby eq 'CHEK') ?
- $cust_pay->paymask : $cust_pay->decrypt($cust_pay->payinfo)
- } ],
+ [ 'payinfo' => $payinfo_sub ],
+ [ 'payinfo_end' => $payinfo_end ],
],
# for refund receipts
'cust_refund' => [
@@ -666,11 +674,8 @@ sub substitutions {
[ refund => sub { sprintf("%.2f", shift->refund) } ],
[ payby => sub { FS::payby->shortname(shift->payby) } ],
[ date => sub { time2str("%a %B %o, %Y", shift->_date) } ],
- [ payinfo => sub {
- my $cust_refund = shift;
- ($cust_refund->payby eq 'CARD' || $cust_refund->payby eq 'CHEK') ?
- $cust_refund->paymask : $cust_refund->decrypt($cust_refund->payinfo)
- } ],
+ [ 'payinfo' => $payinfo_sub ],
+ [ 'payinfo_end' => $payinfo_end ],
],
# for payment decline messages
# try to support all cust_pay fields
@@ -682,11 +687,8 @@ sub substitutions {
[ paid => sub { sprintf("%.2f", shift->paid) } ],
[ payby => sub { FS::payby->shortname(shift->payby) } ],
[ date => sub { time2str("%a %B %o, %Y", shift->_date) } ],
- [ payinfo => sub {
- my $pending = shift;
- ($pending->payby eq 'CARD' || $pending->payby eq 'CHEK') ?
- $pending->paymask : $pending->decrypt($pending->payinfo)
- } ],
+ [ 'payinfo' => $payinfo_sub ],
+ [ 'payinfo_end' => $payinfo_end ],
],
};
}
diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html
index 4bfdd62..0478a80 100644
--- a/httemplate/edit/msg_template.html
+++ b/httemplate/edit/msg_template.html
@@ -294,6 +294,7 @@ my %substitutions = (
'$payby' => 'Payment method',
'$date' => 'Payment date',
'$payinfo' => 'Card/account# (masked)',
+ '$payinfo_end' => 'Card/account last 4 digits',
'$error' => 'Decline reason',
],
'cust_refund' => [
@@ -302,6 +303,7 @@ my %substitutions = (
'$payby' => 'Refund method',
'$date' => 'Refund date',
'$payinfo' => 'Card/account# (masked)',
+ '$payinfo_end' => 'Card/account last 4 digits',
],
);
-----------------------------------------------------------------------
Summary of changes:
FS/FS/msg_template.pm | 32 +++++++++++++++++---------------
httemplate/edit/msg_template.html | 2 ++
2 files changed, 19 insertions(+), 15 deletions(-)
More information about the freeside-commits
mailing list