Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix currency in booking breakdown #1221

Merged
merged 2 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version 2019-XX-XX

- [fix] Use currency of the `lineItem` on every line of the `BookingBreakdown` if possible.
[#1221](https://github.com/sharetribe/flex-template-web/pull/1221)
- [fix] AvailabilityPlan doesn't need to have entries for every day.
[#1214](https://github.com/sharetribe/flex-template-web/pull/1214)
- [change] Default transaction process alias changed.
Expand Down
3 changes: 2 additions & 1 deletion src/components/BookingBreakdown/LineItemRefundMaybe.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const lineItemsTotal = lineItems => {
const amount = lineItems.reduce((total, item) => {
return total.plus(item.lineTotal.amount);
}, new Decimal(0));
return new Money(amount, config.currency);
const currency = lineItems[0] ? lineItems[0].lineTotal.currency : config.currency;
return new Money(amount, currency);
};

/**
Expand Down
3 changes: 2 additions & 1 deletion src/components/BookingBreakdown/LineItemSubTotalMaybe.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const lineItemsTotal = lineItems => {
const amount = lineItems.reduce((total, item) => {
return total.plus(item.lineTotal.amount);
}, new Decimal(0));
return new Money(amount, config.currency);
const currency = lineItems[0] ? lineItems[0].lineTotal.currency : config.currency;
return new Money(amount, currency);
};

/**
Expand Down