Fix location and iconName
This commit is contained in:
parent
a9edb90fbe
commit
7a5d32a269
3 changed files with 27 additions and 28 deletions
|
|
@ -38,6 +38,27 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
|||
return tx;
|
||||
};
|
||||
|
||||
var _getIconName = function(tx) {
|
||||
var icon = tx.mcc || tx.category || null;
|
||||
if (!icon || root.iconMap[icon] == undefined) return 'default';
|
||||
return root.iconMap[icon];
|
||||
};
|
||||
|
||||
var _processDescription = function(tx) {
|
||||
if (lodash.isArray(tx.description)) {
|
||||
return tx.description[0];
|
||||
}
|
||||
return tx.description;
|
||||
};
|
||||
|
||||
var _processLocation = function(tx) {
|
||||
if (tx.merchant.city && tx.merchant.state) {
|
||||
return tx.merchant.city + ', ' + tx.merchant.state;
|
||||
} else {
|
||||
return tx.merchant.city || tx.merchant.state || '';
|
||||
}
|
||||
};
|
||||
|
||||
var _fromTransaction = function(txn, runningBalance) {
|
||||
var dateTime = _buildDate(txn.date, txn.time);
|
||||
var merchant = _lowercaseMerchant(txn.merchant);
|
||||
|
|
@ -102,6 +123,11 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
|||
}
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < activityList.length; i++) {
|
||||
activityList[i].icon = _getIconName(activityList[i]);
|
||||
activityList[i].desc = _processDescription(activityList[i]);
|
||||
activityList[i].merchant['location'] = _processLocation(activityList[i]);
|
||||
}
|
||||
return activityList;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue