Merge pull request #775 from sharetribe/bookingbreakdown-feenote-bug

Fix: commission fee note showing when commission is not for current role
This commit is contained in:
Vesa Luusua 2018-03-21 16:46:04 +02:00 committed by GitHub
commit 22b71d3f27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,12 +30,11 @@ export const BookingBreakdownComponent = props => {
const isCustomer = userRole === 'customer';
const isProvider = userRole === 'provider';
const commissionLineItem = transaction.attributes.lineItems.find(
item =>
(item.code === LINE_ITEM_CUSTOMER_COMMISSION ||
item.code === LINE_ITEM_PROVIDER_COMMISSION) &&
!item.reversal
);
const hasCommissionLineItem = transaction.attributes.lineItems.find(item => {
const hasCustomerCommission = isCustomer && item.code === LINE_ITEM_CUSTOMER_COMMISSION;
const hasProviderCommission = isProvider && item.code === LINE_ITEM_PROVIDER_COMMISSION;
return (hasCustomerCommission || hasProviderCommission) && !item.reversal;
});
const classes = classNames(rootClassName || css.root, className);
@ -77,7 +76,7 @@ export const BookingBreakdownComponent = props => {
<hr className={css.totalDivider} />
<LineItemTotalPrice transaction={transaction} isProvider={isProvider} intl={intl} />
{commissionLineItem ? (
{hasCommissionLineItem ? (
<span className={css.feeInfo}>
<FormattedMessage id="BookingBreakdown.commissionFeeNote" />
</span>