svn commit: r797327 - /ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r797327 - /ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl

mor-2
Author: mor
Date: Fri Jul 24 05:30:00 2009
New Revision: 797327

URL: http://svn.apache.org/viewvc?rev=797327&view=rev
Log:
Added credit card masking on Order Detail Page.

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl?rev=797327&r1=797326&r2=797327&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl Fri Jul 24 05:30:00 2009
@@ -16,6 +16,22 @@
 specific language governing permissions and limitations
 under the License.
 -->
+<#macro maskCreditCardNumber cardNumber>
+  <#assign cardNumberDisplay = "">
+  <#if cardNumber?has_content>
+    <#assign size = cardNumber?length - 4>
+    <#if (size > 0)>
+      <#list 0 .. size-1 as foo>
+        <#assign cardNumberDisplay = cardNumberDisplay + "*">
+      </#list>
+      <#assign cardNumberDisplay = cardNumberDisplay + cardNumber[size .. size + 3]>
+    <#else>
+      <#-- but if the card number has less than four digits (ie, it was entered incorrectly), display it in full -->
+      <#assign cardNumberDisplay = cardNumber>
+    </#if>
+  </#if>
+  ${cardNumberDisplay?if_exists}
+</#macro>
 
 <div class="screenlet">
   <div class="screenlet-title-bar">
@@ -203,7 +219,8 @@
 
                       <#if security.hasEntityPermission("PAY_INFO", "_VIEW", session)>
                         ${creditCard.cardType}
-                        ${creditCard.cardNumber}
+                        <#assign cardNumber = creditCard.cardNumber?if_exists>
+                        <@maskCreditCardNumber cardNumber=cardNumber/>
                         ${creditCard.expireDate}
                         &nbsp;[<#if oppStatusItem?exists>${oppStatusItem.get("description",locale)}<#else>${orderPaymentPreference.statusId}</#if>]
                       <#else>
@@ -446,7 +463,7 @@
                  <#assign creditCard = paymentMethodValueMap.creditCard/>
                  <#if (creditCard?has_content)>
                    <#if security.hasEntityPermission("PAY_INFO", "_VIEW", session)>
-                     ${creditCard.cardType?if_exists} ${creditCard.cardNumber?if_exists} ${creditCard.expireDate?if_exists}
+                     ${creditCard.cardType?if_exists} <@maskCreditCardNumber cardNumber=creditCard.cardNumber?if_exists/> ${creditCard.expireDate?if_exists}
                    <#else>
                      ${Static["org.ofbiz.party.contact.ContactHelper"].formatCreditCard(creditCard)}
                    </#if>