Change all commission amount negative in line items

This commit is contained in:
Mikko Koski 2017-06-30 11:29:48 +03:00 committed by Vesa Luusua
parent 7ed24991af
commit b429c2cda0
9 changed files with 23 additions and 27 deletions

View file

@ -2,7 +2,6 @@
* This component will show the booking info and calculated total price.
* I.e. dates and other details related to payment decision in receipt format.
*/
import _ from 'lodash';
import React, { PropTypes } from 'react';
import { FormattedMessage, FormattedHTMLMessage, intlShape, injectIntl } from 'react-intl';
import Decimal from 'decimal.js';
@ -51,11 +50,8 @@ export const BookingBreakdownComponent = props => {
/>
);
const nightPurchase = _.find(lineItems, item => item.code === 'line-item.purchase/night');
const providerCommission = _.find(
lineItems,
item => item.code === 'line-item.commission/provider'
);
const nightPurchase = lineItems.find(item => item.code === 'line-item.purchase/night');
const providerCommission = lineItems.find(item => item.code === 'line-item.commission/provider');
const nightCount = nightPurchase.quantity.toFixed();
const nightCountMessage = (

View file

@ -65,8 +65,8 @@ describe('BookingBreakdown', () => {
},
{
code: 'line-item.commission/provider',
lineTotal: new types.Money(200, 'USD'),
unitPrice: new types.Money(200, 'USD'),
lineTotal: new types.Money(-200, 'USD'),
unitPrice: new types.Money(-200, 'USD'),
},
]}
intl={fakeIntl}

View file

@ -170,7 +170,7 @@ exports[`BookingBreakdown provider transaction data matches snapshot 1`] = `
</span>
<span
className={undefined}>
-2
2
</span>
</div>
<hr

View file

@ -64,11 +64,11 @@ exports[`OrderDetailsPanel matches snapshot 1`] = `
Object {
"code": "line-item.commission/provider",
"lineTotal": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
"unitPrice": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
},

View file

@ -63,11 +63,11 @@ exports[`SaleDetailsPanel matches snapshot 1`] = `
Object {
"code": "line-item.commission/provider",
"lineTotal": Money {
"amount": 1000,
"amount": -1000,
"currency": "USD",
},
"unitPrice": Money {
"amount": 1000,
"amount": -1000,
"currency": "USD",
},
},

View file

@ -68,11 +68,11 @@ exports[`InboxPage matches snapshot 1`] = `
Object {
"code": "line-item.commission/provider",
"lineTotal": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
"unitPrice": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
},
@ -145,11 +145,11 @@ exports[`InboxPage matches snapshot 1`] = `
Object {
"code": "line-item.commission/provider",
"lineTotal": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
"unitPrice": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
},
@ -299,11 +299,11 @@ exports[`InboxPage matches snapshot 3`] = `
Object {
"code": "line-item.commission/provider",
"lineTotal": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
"unitPrice": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
},
@ -376,11 +376,11 @@ exports[`InboxPage matches snapshot 3`] = `
Object {
"code": "line-item.commission/provider",
"lineTotal": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
"unitPrice": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
},

View file

@ -26,11 +26,11 @@ exports[`OrderPage matches snapshot 1`] = `
Object {
"code": "line-item.commission/provider",
"lineTotal": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
"unitPrice": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
},

View file

@ -27,11 +27,11 @@ exports[`SalePage matches snapshot 1`] = `
Object {
"code": "line-item.commission/provider",
"lineTotal": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
"unitPrice": Money {
"amount": 100,
"amount": -100,
"currency": "USD",
},
},

View file

@ -101,8 +101,8 @@ export const createTransaction = options => {
},
{
code: 'line-item.commission/provider',
unitPrice: commission,
lineTotal: commission,
unitPrice: new Money(commission.amount * -1, commission.currency),
lineTotal: new Money(commission.amount * -1, commission.currency),
},
],
},