Skip to content

Instantly share code, notes, and snippets.

@kaw2k
Created September 18, 2015 17:24
Show Gist options
  • Save kaw2k/6ffa562899a751b0edec to your computer and use it in GitHub Desktop.
Save kaw2k/6ffa562899a751b0edec to your computer and use it in GitHub Desktop.
.then((details) => {
const newDetails = _.merge(details, {
creditLines: _.map(credit => {
if (!credit.creditTransaction) { return credit; }
const taxCredit = parseFloat(credit.creditTransaction.taxAmount, 10);
const tax = parseFloat(credit.originalTransaction.taxAmount, 10);
const lineTotal = parseFloat(credit.creditTransaction.lineTotal, 10);
return _.merge(credit, {
lineTotal: lineTotal - tax - taxCredit
});
}, details.creditLines)
});
this.dispatch(ActionTypes.billing.CREDIT_DETAIL, [
originalTransactionId,
newDetails
]);
return newDetails;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment