API returns reversal flag, our tests should give it too

This commit is contained in:
Vesa Luusua 2017-10-19 15:23:13 +03:00
parent 50dd6d05fc
commit 4b85ce658b
8 changed files with 84 additions and 0 deletions

View file

@ -42,6 +42,7 @@ export const Checkout = {
quantity: new Decimal(2),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(9000, 'USD'),
reversal: false,
},
],
}),
@ -65,6 +66,7 @@ export const CustomerOrder = {
quantity: new Decimal(2),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(9000, 'USD'),
reversal: false,
},
],
}),
@ -88,11 +90,13 @@ export const ProviderSale = {
quantity: new Decimal(2),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(9000, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(-2000, 'USD'),
lineTotal: new Money(-2000, 'USD'),
reversal: false,
},
],
}),
@ -116,11 +120,13 @@ export const ProviderSaleZeroCommission = {
quantity: new Decimal(2),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(9000, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(0, 'USD'),
lineTotal: new Money(0, 'USD'),
reversal: false,
},
],
}),
@ -144,11 +150,13 @@ export const ProviderSaleSingleNight = {
quantity: new Decimal(1),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(4500, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(-2000, 'USD'),
lineTotal: new Money(-2000, 'USD'),
reversal: false,
},
],
}),
@ -173,11 +181,13 @@ export const ProviderSalePreauthorized = {
quantity: new Decimal(1),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(4500, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(-2000, 'USD'),
lineTotal: new Money(-2000, 'USD'),
reversal: false,
},
],
}),
@ -202,11 +212,13 @@ export const ProviderSaleAccepted = {
quantity: new Decimal(1),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(4500, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(-2000, 'USD'),
lineTotal: new Money(-2000, 'USD'),
reversal: false,
},
],
}),
@ -231,11 +243,13 @@ export const ProviderSaleDeclined = {
quantity: new Decimal(1),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(4500, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(-2000, 'USD'),
lineTotal: new Money(-2000, 'USD'),
reversal: false,
},
],
}),
@ -260,11 +274,13 @@ export const ProviderSaleAutoDeclined = {
quantity: new Decimal(1),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(4500, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(-2000, 'USD'),
lineTotal: new Money(-2000, 'USD'),
reversal: false,
},
],
}),
@ -289,11 +305,13 @@ export const ProviderSaleDelivered = {
quantity: new Decimal(1),
unitPrice: new Money(4500, 'USD'),
lineTotal: new Money(4500, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(-2000, 'USD'),
lineTotal: new Money(-2000, 'USD'),
reversal: false,
},
],
}),

View file

@ -38,6 +38,7 @@ describe('BookingBreakdown', () => {
quantity: new Decimal(2),
lineTotal: new Money(2000, 'USD'),
unitPrice: new Money(1000, 'USD'),
reversal: false,
},
],
})}
@ -64,6 +65,7 @@ describe('BookingBreakdown', () => {
quantity: new Decimal(2),
lineTotal: new Money(2000, 'USD'),
unitPrice: new Money(1000, 'USD'),
reversal: false,
},
],
})}
@ -90,11 +92,13 @@ describe('BookingBreakdown', () => {
quantity: new Decimal(2),
lineTotal: new Money(2000, 'USD'),
unitPrice: new Money(1000, 'USD'),
reversal: false,
},
{
code: 'line-item/provider-commission',
lineTotal: new Money(-200, 'USD'),
unitPrice: new Money(-200, 'USD'),
reversal: false,
},
],
})}

View file

@ -137,6 +137,7 @@ exports[`OrderDetailsPanel accepted matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -148,6 +149,7 @@ exports[`OrderDetailsPanel accepted matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -321,6 +323,7 @@ exports[`OrderDetailsPanel accepted matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -332,6 +335,7 @@ exports[`OrderDetailsPanel accepted matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -543,6 +547,7 @@ exports[`OrderDetailsPanel autodeclined matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -554,6 +559,7 @@ exports[`OrderDetailsPanel autodeclined matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -727,6 +733,7 @@ exports[`OrderDetailsPanel autodeclined matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -738,6 +745,7 @@ exports[`OrderDetailsPanel autodeclined matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -953,6 +961,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -964,6 +973,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -1137,6 +1147,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1148,6 +1159,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -1359,6 +1371,7 @@ exports[`OrderDetailsPanel declined matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1370,6 +1383,7 @@ exports[`OrderDetailsPanel declined matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -1543,6 +1557,7 @@ exports[`OrderDetailsPanel declined matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1554,6 +1569,7 @@ exports[`OrderDetailsPanel declined matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -1765,6 +1781,7 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1776,6 +1793,7 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -1949,6 +1967,7 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1960,6 +1979,7 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -2175,6 +2195,7 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -2186,6 +2207,7 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -2359,6 +2381,7 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -2370,6 +2393,7 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",

View file

@ -143,6 +143,7 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -154,6 +155,7 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -282,6 +284,7 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -293,6 +296,7 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -510,6 +514,7 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -521,6 +526,7 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -649,6 +655,7 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -660,6 +667,7 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -892,6 +900,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -903,6 +912,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -1031,6 +1041,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1042,6 +1053,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -1259,6 +1271,7 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1270,6 +1283,7 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -1398,6 +1412,7 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1409,6 +1424,7 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -1626,6 +1642,7 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1637,6 +1654,7 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -1765,6 +1783,7 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -1776,6 +1795,7 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -2008,6 +2028,7 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -2019,6 +2040,7 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",
@ -2147,6 +2169,7 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 5500,
"currency": "USD",
@ -2158,6 +2181,7 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
"amount": -1000,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -1000,
"currency": "USD",

View file

@ -89,6 +89,7 @@ exports[`InboxPage matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "1",
"reversal": false,
"unitPrice": Money {
"amount": 1000,
"currency": "USD",
@ -100,6 +101,7 @@ exports[`InboxPage matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -189,6 +191,7 @@ exports[`InboxPage matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "1",
"reversal": false,
"unitPrice": Money {
"amount": 1000,
"currency": "USD",
@ -200,6 +203,7 @@ exports[`InboxPage matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -420,6 +424,7 @@ exports[`InboxPage matches snapshot 3`] = `
"currency": "USD",
},
"quantity": "1",
"reversal": false,
"unitPrice": Money {
"amount": 1000,
"currency": "USD",
@ -431,6 +436,7 @@ exports[`InboxPage matches snapshot 3`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",
@ -520,6 +526,7 @@ exports[`InboxPage matches snapshot 3`] = `
"currency": "USD",
},
"quantity": "1",
"reversal": false,
"unitPrice": Money {
"amount": 1000,
"currency": "USD",
@ -531,6 +538,7 @@ exports[`InboxPage matches snapshot 3`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",

View file

@ -24,6 +24,7 @@ exports[`OrderPage matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 333.3333333333333,
"currency": "USD",
@ -35,6 +36,7 @@ exports[`OrderPage matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",

View file

@ -31,6 +31,7 @@ exports[`SalePage matches snapshot 1`] = `
"currency": "USD",
},
"quantity": "3",
"reversal": false,
"unitPrice": Money {
"amount": 333.3333333333333,
"currency": "USD",
@ -42,6 +43,7 @@ exports[`SalePage matches snapshot 1`] = `
"amount": -100,
"currency": "USD",
},
"reversal": false,
"unitPrice": Money {
"amount": -100,
"currency": "USD",

View file

@ -114,11 +114,13 @@ export const createTransaction = options => {
quantity: new Decimal(nightCount),
unitPrice: new Money(total.amount / nightCount, total.currency),
lineTotal: total,
reversal: false,
},
{
code: 'line-item/provider-commission',
unitPrice: new Money(commission.amount * -1, commission.currency),
lineTotal: new Money(commission.amount * -1, commission.currency),
reversal: false,
},
],
},