diff --git a/src/components/BookingBreakdown/BookingBreakdown.js b/src/components/BookingBreakdown/BookingBreakdown.js
index 995c4a86..9b550f7e 100644
--- a/src/components/BookingBreakdown/BookingBreakdown.js
+++ b/src/components/BookingBreakdown/BookingBreakdown.js
@@ -3,7 +3,7 @@
* I.e. dates and other details related to payment decision in receipt format.
*/
import React from 'react';
-import PropTypes from 'prop-types';
+import { bool, oneOf, string } from 'prop-types';
import { FormattedMessage, FormattedHTMLMessage, intlShape, injectIntl } from 'react-intl';
import classNames from 'classnames';
import { types } from '../../util/sdkLoader';
@@ -24,11 +24,8 @@ const isValidCommission = commissionLineItem => {
);
};
-export const BookingBreakdownComponent = props => {
- const { rootClassName, className, userRole, transaction, booking, intl } = props;
-
- const isProvider = userRole === 'provider';
- const classes = classNames(rootClassName || css.root, className);
+const BreakdownItems = props => {
+ const { transaction, booking, isProvider, intl } = props;
const nightPurchase = transaction.attributes.lineItems.find(
item => item.code === 'line-item/night' && !item.reversal
@@ -132,6 +129,29 @@ export const BookingBreakdownComponent = props => {
);
}
+ return (
+
+ {unitPriceItem}
+ {unitsItem}
+ {subTotalItem}
+ {commissionItem}
+ {refundItem}
+
+ );
+};
+
+BreakdownItems.propTypes = {
+ transaction: propTypes.transaction.isRequired,
+ booking: propTypes.booking.isRequired,
+ isProvider: bool.isRequired,
+ intl: intlShape.isRequired,
+};
+
+export const BookingBreakdownComponent = props => {
+ const { rootClassName, className, userRole, transaction, booking, intl } = props;
+
+ const isProvider = userRole === 'provider';
+ const classes = classNames(rootClassName || css.root, className);
let providerTotalMessageId = 'BookingBreakdown.providerTotalDefault';
if (propTypes.txIsDelivered(transaction)) {
@@ -155,11 +175,12 @@ export const BookingBreakdownComponent = props => {
return (
- {unitPriceItem}
- {unitsItem}
- {subTotalItem}
- {commissionItem}
- {refundItem}
+
{totalLabel}
@@ -171,8 +192,6 @@ export const BookingBreakdownComponent = props => {
BookingBreakdownComponent.defaultProps = { rootClassName: null, className: null };
-const { oneOf, string } = PropTypes;
-
BookingBreakdownComponent.propTypes = {
rootClassName: string,
className: string,
diff --git a/src/components/BookingBreakdown/__snapshots__/BookingBreakdown.test.js.snap b/src/components/BookingBreakdown/__snapshots__/BookingBreakdown.test.js.snap
index 2af3179a..4ae7d2a9 100644
--- a/src/components/BookingBreakdown/__snapshots__/BookingBreakdown.test.js.snap
+++ b/src/components/BookingBreakdown/__snapshots__/BookingBreakdown.test.js.snap
@@ -4,43 +4,45 @@ exports[`BookingBreakdown customer transaction data matches snapshot 1`] = `
-
-
-
- BookingBreakdown.pricePerNight
-
-
-
- 10
-
-
-
-
-
- BookingBreakdown.bookingPeriod
-
-
-
+
+
+ BookingBreakdown.pricePerNight
+
+
+
+ 10
+
+
+
+
+
+ BookingBreakdown.bookingPeriod
+
+
+
+
-
+ />
+
+
-
-
-
- BookingBreakdown.pricePerNight
-
-
-
- 10
-
-
-
-
-
- BookingBreakdown.bookingPeriod
-
-
-
+
+
+ BookingBreakdown.pricePerNight
+
+
+
+ 10
+
+
+
+
+
+ BookingBreakdown.bookingPeriod
+
+
+
+
-
+ />
+
+
-
-
-
- BookingBreakdown.pricePerNight
-
-
-
- 10
-
-
-
-
-
- BookingBreakdown.bookingPeriod
-
-
-
+
+
+ BookingBreakdown.pricePerNight
+
+
+
+ 10
+
+
+
+
+
+ BookingBreakdown.bookingPeriod
+
+
+
+
-
-
-
-
-
- BookingBreakdown.subTotal
+ />
-
-
+
- 20
-
-
-
-
-
- BookingBreakdown.refund
+
+
+ BookingBreakdown.subTotal
+
-
-
+ 20
+
+
+
- -20
-
+
+
+ BookingBreakdown.refund
+
+
+
+ -20
+
+
-
-
-
- BookingBreakdown.pricePerNight
-
-
-
- 10
-
-
-
-
-
- BookingBreakdown.bookingPeriod
-
-
-
+
+
+ BookingBreakdown.pricePerNight
+
+
+
+ 10
+
+
+
+
+
+ BookingBreakdown.bookingPeriod
+
+
+
+
-
-
-
-
-
- BookingBreakdown.subTotal
+ />
-
-
+
- 20
-
-
-
-
-
- BookingBreakdown.commission
+
+
+ BookingBreakdown.subTotal
+
-
-
+ 20
+
+
+
- -2
-
+
+
+ BookingBreakdown.commission
+
+
+
+ -2
+
+