diff --git a/src/components/BookingBreakdown/BookingBreakdown.example.js b/src/components/BookingBreakdown/BookingBreakdown.example.js index a41ffcc0..3050038c 100644 --- a/src/components/BookingBreakdown/BookingBreakdown.example.js +++ b/src/components/BookingBreakdown/BookingBreakdown.example.js @@ -7,13 +7,15 @@ export const Checkout = { props: { bookingStart: new Date(Date.UTC(2017, 3, 14)), bookingEnd: new Date(Date.UTC(2017, 3, 16)), - userRole: "customer", - lineItems: [{ - code: "line-item.purchase/night", - quantity: new Decimal(2), - unitPrice: new types.Money(4500, 'USD'), - lineTotal: new types.Money(9000, 'USD'), - }], + userRole: 'customer', + lineItems: [ + { + code: 'line-item.purchase/night', + quantity: new Decimal(2), + unitPrice: new types.Money(4500, 'USD'), + lineTotal: new types.Money(9000, 'USD'), + }, + ], payinTotal: new types.Money(9000, 'USD'), }, }; @@ -23,13 +25,15 @@ export const CustomerOrder = { props: { bookingStart: new Date(Date.UTC(2017, 3, 14)), bookingEnd: new Date(Date.UTC(2017, 3, 16)), - userRole: "customer", - lineItems: [{ - code: "line-item.purchase/night", - quantity: new Decimal(2), - unitPrice: new types.Money(4500, 'USD'), - lineTotal: new types.Money(9000, 'USD'), - }], + userRole: 'customer', + lineItems: [ + { + code: 'line-item.purchase/night', + quantity: new Decimal(2), + unitPrice: new types.Money(4500, 'USD'), + lineTotal: new types.Money(9000, 'USD'), + }, + ], payinTotal: new types.Money(9000, 'USD'), }, }; @@ -39,17 +43,20 @@ export const ProviderSale = { props: { bookingStart: new Date(Date.UTC(2017, 3, 14)), bookingEnd: new Date(Date.UTC(2017, 3, 16)), - userRole: "provider", - lineItems: [{ - code: "line-item.purchase/night", - quantity: new Decimal(2), - unitPrice: new types.Money(4500, 'USD'), - lineTotal: new types.Money(9000, 'USD'), - }, { - code: "line-item.commission/provider", - unitPrice: new types.Money(-2000, 'USD'), - lineTotal: new types.Money(-2000, 'USD'), - }], + userRole: 'provider', + lineItems: [ + { + code: 'line-item.purchase/night', + quantity: new Decimal(2), + unitPrice: new types.Money(4500, 'USD'), + lineTotal: new types.Money(9000, 'USD'), + }, + { + code: 'line-item.commission/provider', + unitPrice: new types.Money(-2000, 'USD'), + lineTotal: new types.Money(-2000, 'USD'), + }, + ], payoutTotal: new types.Money(7000, 'USD'), }, }; @@ -59,17 +66,20 @@ export const ProviderSaleZeroCommission = { props: { bookingStart: new Date(Date.UTC(2017, 3, 14)), bookingEnd: new Date(Date.UTC(2017, 3, 16)), - userRole: "provider", - lineItems: [{ - code: "line-item.purchase/night", - quantity: new Decimal(2), - unitPrice: new types.Money(4500, 'USD'), - lineTotal: new types.Money(9000, 'USD'), - }, { - code: "line-item.commission/provider", - unitPrice: new types.Money(0, 'USD'), - lineTotal: new types.Money(0, 'USD'), - }], + userRole: 'provider', + lineItems: [ + { + code: 'line-item.purchase/night', + quantity: new Decimal(2), + unitPrice: new types.Money(4500, 'USD'), + lineTotal: new types.Money(9000, 'USD'), + }, + { + code: 'line-item.commission/provider', + unitPrice: new types.Money(0, 'USD'), + lineTotal: new types.Money(0, 'USD'), + }, + ], payoutTotal: new types.Money(9000, 'USD'), }, }; @@ -79,17 +89,20 @@ export const ProviderSaleSingleNight = { props: { bookingStart: new Date(Date.UTC(2017, 3, 14)), bookingEnd: new Date(Date.UTC(2017, 3, 15)), - userRole: "provider", - lineItems: [{ - code: "line-item.purchase/night", - quantity: new Decimal(1), - unitPrice: new types.Money(4500, 'USD'), - lineTotal: new types.Money(4500, 'USD'), - },{ - code: "line-item.commission/provider", - lineTotal: new types.Money(-2000, 'USD'), - unitPrice: new types.Money(-2000, 'USD'), - }], + userRole: 'provider', + lineItems: [ + { + code: 'line-item.purchase/night', + quantity: new Decimal(1), + unitPrice: new types.Money(4500, 'USD'), + lineTotal: new types.Money(4500, 'USD'), + }, + { + code: 'line-item.commission/provider', + unitPrice: new types.Money(-2000, 'USD'), + lineTotal: new types.Money(-2000, 'USD'), + }, + ], payoutTotal: new types.Money(2500, 'USD'), }, }; diff --git a/src/components/BookingBreakdown/BookingBreakdown.js b/src/components/BookingBreakdown/BookingBreakdown.js index 1329f1ee..cc7627a6 100644 --- a/src/components/BookingBreakdown/BookingBreakdown.js +++ b/src/components/BookingBreakdown/BookingBreakdown.js @@ -71,20 +71,20 @@ export const BookingBreakdownComponent = props => { // If commission is passed it will be shown as a fee already reduces from the total price let commissionInfo = null; - if (userRole === "provider") { + if (userRole === 'provider') { const commission = providerCommission.lineTotal; const commissionAsNumber = commission ? convertMoneyToNumber(commission, subUnitDivisor) : 0; const formattedCommission = commission - ? intl.formatNumber(new Decimal(commissionAsNumber).negated().toNumber(), currencyConfig) - : null; + ? intl.formatNumber(new Decimal(commissionAsNumber).negated().toNumber(), currencyConfig) + : null; commissionInfo = (