mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Change all commission amount negative in line items
This commit is contained in:
parent
7ed24991af
commit
b429c2cda0
9 changed files with 23 additions and 27 deletions
|
|
@ -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 = (
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ exports[`BookingBreakdown provider transaction data matches snapshot 1`] = `
|
|||
</span>
|
||||
<span
|
||||
className={undefined}>
|
||||
-2
|
||||
2
|
||||
</span>
|
||||
</div>
|
||||
<hr
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue