CRM-20331, added code to show card type and pan truncation besides payment method...
authorPradeep Nayak <pradpnayak@gmail.com>
Thu, 23 Mar 2017 12:54:57 +0000 (18:24 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Thu, 23 Mar 2017 12:54:57 +0000 (18:24 +0530)
----------------------------------------
* CRM-20331: Add card type and pan truncation besides payment method
  https://issues.civicrm.org/jira/browse/CRM-20331

CRM/Contribute/BAO/Contribution.php

index 60b197bd78dfaa63166884febba6f437412a480f..399e76f5a885f50fe0c3702e730d7a5808f7dfa6 100644 (file)
@@ -4053,7 +4053,7 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']})
         SELECT GROUP_CONCAT(fa.`name`) as financial_account,
           ft.total_amount,
           ft.payment_instrument_id,
-          ft.trxn_date, ft.trxn_id, ft.status_id, ft.check_number, con.currency
+          ft.trxn_date, ft.trxn_id, ft.status_id, ft.check_number, ft.currency, ft.pan_truncation, ft.card_type
 
         FROM civicrm_contribution con
           LEFT JOIN civicrm_entity_financial_trxn eft ON (eft.entity_id = con.id AND eft.entity_table = 'civicrm_contribution')
@@ -4075,6 +4075,14 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']})
       while ($resultDAO->fetch()) {
         $paidByLabel = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'payment_instrument_id', $resultDAO->payment_instrument_id);
         $paidByName = CRM_Core_PseudoConstant::getName('CRM_Core_BAO_FinancialTrxn', 'payment_instrument_id', $resultDAO->payment_instrument_id);
+        if ($resultDAO->card_type) {
+          $creditCardType = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'card_type', $resultDAO->card_type);
+          $pantruncation = '';
+          if ($resultDAO->pan_truncation) {
+            $pantruncation = ": {$resultDAO->pan_truncation}";
+          }
+          $paidByLabel .= " ({$creditCardType}{$pantruncation})";
+        }
         $val = array(
           'total_amount' => $resultDAO->total_amount,
           'financial_type' => $resultDAO->financial_account,