diff --git a/src/components/BookingBreakdown/BookingBreakdown.example.js b/src/components/BookingBreakdown/BookingBreakdown.example.js index b5adb477..1ff5658f 100644 --- a/src/components/BookingBreakdown/BookingBreakdown.example.js +++ b/src/components/BookingBreakdown/BookingBreakdown.example.js @@ -217,12 +217,12 @@ export const ProviderSaleAccepted = { }, }; -export const ProviderSaleRejected = { +export const ProviderSaleDeclined = { component: BookingBreakdown, props: { userRole: 'provider', transaction: exampleTransaction({ - lastTransition: propTypes.TX_TRANSITION_REJECT, + lastTransition: propTypes.TX_TRANSITION_DECLINE, payinTotal: new Money(4500, 'USD'), payoutTotal: new Money(2500, 'USD'), lineItems: [ @@ -246,12 +246,12 @@ export const ProviderSaleRejected = { }, }; -export const ProviderSaleAutoRejected = { +export const ProviderSaleAutoDeclined = { component: BookingBreakdown, props: { userRole: 'provider', transaction: exampleTransaction({ - lastTransition: propTypes.TX_TRANSITION_AUTO_REJECT, + lastTransition: propTypes.TX_TRANSITION_AUTO_DECLINE, payinTotal: new Money(4500, 'USD'), payoutTotal: new Money(2500, 'USD'), lineItems: [ diff --git a/src/components/BookingBreakdown/BookingBreakdown.js b/src/components/BookingBreakdown/BookingBreakdown.js index bd93781e..990c3402 100644 --- a/src/components/BookingBreakdown/BookingBreakdown.js +++ b/src/components/BookingBreakdown/BookingBreakdown.js @@ -123,8 +123,8 @@ export const BookingBreakdownComponent = props => { let providerTotalMessageId = 'BookingBreakdown.providerTotalDefault'; if (propTypes.txIsDelivered(transaction)) { providerTotalMessageId = 'BookingBreakdown.providerTotalDelivered'; - } else if (propTypes.txIsRejectedOrAutorejected(transaction)) { - providerTotalMessageId = 'BookingBreakdown.providerTotalRejected'; + } else if (propTypes.txIsDeclinedOrAutodeclined(transaction)) { + providerTotalMessageId = 'BookingBreakdown.providerTotalDeclined'; } else if (propTypes.txIsCanceled(transaction)) { providerTotalMessageId = 'BookingBreakdown.providerTotalCanceled'; } diff --git a/src/components/OrderDetailsPanel/OrderDetailsPanel.js b/src/components/OrderDetailsPanel/OrderDetailsPanel.js index a85f8881..1aed8688 100644 --- a/src/components/OrderDetailsPanel/OrderDetailsPanel.js +++ b/src/components/OrderDetailsPanel/OrderDetailsPanel.js @@ -46,11 +46,11 @@ const orderTitle = (transaction, listingLink, customerName) => { ); - } else if (propTypes.txIsRejected(transaction)) { - return ; - } else if (propTypes.txIsAutorejected(transaction)) { + } else if (propTypes.txIsDeclined(transaction)) { + return ; + } else if (propTypes.txIsAutodeclined(transaction)) { return ( - + ); } else if (propTypes.txIsCanceled(transaction)) { return ; @@ -83,17 +83,17 @@ const orderMessage = (transaction, listingTitle, providerName) => { values={{ providerName, transitionDate }} /> ); - } else if (propTypes.txIsRejected(transaction)) { + } else if (propTypes.txIsDeclined(transaction)) { return ( ); - } else if (propTypes.txIsAutorejected(transaction)) { + } else if (propTypes.txIsAutodeclined(transaction)) { return ( ); diff --git a/src/components/OrderDetailsPanel/OrderDetailsPanel.test.js b/src/components/OrderDetailsPanel/OrderDetailsPanel.test.js index d351d619..59b1bd39 100644 --- a/src/components/OrderDetailsPanel/OrderDetailsPanel.test.js +++ b/src/components/OrderDetailsPanel/OrderDetailsPanel.test.js @@ -33,15 +33,15 @@ const txAccepted = createTransaction({ ...baseTxAttrs, }); -const txRejected = createTransaction({ - id: 'order-rejected', - lastTransition: propTypes.TX_TRANSITION_REJECT, +const txDeclined = createTransaction({ + id: 'order-declined', + lastTransition: propTypes.TX_TRANSITION_DECLINE, ...baseTxAttrs, }); -const txAutoRejected = createTransaction({ - id: 'order-autorejected', - lastTransition: propTypes.TX_TRANSITION_AUTO_REJECT, +const txAutoDeclined = createTransaction({ + id: 'order-autodeclined', + lastTransition: propTypes.TX_TRANSITION_AUTO_DECLINE, ...baseTxAttrs, }); @@ -70,15 +70,15 @@ describe('OrderDetailsPanel', () => { ); expect(tree).toMatchSnapshot(); }); - it('rejected matches snapshot', () => { + it('declined matches snapshot', () => { const tree = renderShallow( - + ); expect(tree).toMatchSnapshot(); }); - it('autorejected matches snapshot', () => { + it('autodeclined matches snapshot', () => { const tree = renderShallow( - + ); expect(tree).toMatchSnapshot(); }); diff --git a/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap b/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap index becfd49c..eab72027 100644 --- a/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap +++ b/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap @@ -418,7 +418,7 @@ exports[`OrderDetailsPanel accepted matches snapshot 1`] = ` `; -exports[`OrderDetailsPanel autorejected matches snapshot 1`] = ` +exports[`OrderDetailsPanel autodeclined matches snapshot 1`] = `
@@ -471,7 +471,7 @@ exports[`OrderDetailsPanel autorejected matches snapshot 1`] = `

`; +exports[`OrderDetailsPanel declined matches snapshot 1`] = ` +
+
+
+
+ +
+
+
+ +
+
+

+ + listing1 title + , + } + } + /> +

+
+ + + , + } + } + /> +
+
+
+
+

+ +

+ +
+
+
+
+ +
+
+
+ +
+
+

+ listing1 title +

+

+ +

+
+

+ +

+ +
+
+
+
+`; + exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
`; - -exports[`OrderDetailsPanel rejected matches snapshot 1`] = ` -
-
-
-
- -
-
-
- -
-
-

- - listing1 title - , - } - } - /> -

-
- - - , - } - } - /> -
-
-
-
-

- -

- -
-
-
-
- -
-
-
- -
-
-

- listing1 title -

-

- -

-
-

- -

- -
-
-
-
-`; diff --git a/src/components/SaleDetailsPanel/SaleDetailsPanel.css b/src/components/SaleDetailsPanel/SaleDetailsPanel.css index 35fbdb5c..ff1af6ec 100644 --- a/src/components/SaleDetailsPanel/SaleDetailsPanel.css +++ b/src/components/SaleDetailsPanel/SaleDetailsPanel.css @@ -210,7 +210,7 @@ } } -.rejectButton { +.declineButton { margin-right: 6.5px; } diff --git a/src/components/SaleDetailsPanel/SaleDetailsPanel.js b/src/components/SaleDetailsPanel/SaleDetailsPanel.js index 3897119f..1bf83318 100644 --- a/src/components/SaleDetailsPanel/SaleDetailsPanel.js +++ b/src/components/SaleDetailsPanel/SaleDetailsPanel.js @@ -43,17 +43,17 @@ const saleTitle = (transaction, listingLink, customerName) => { values={{ customerName, listingLink }} /> ); - } else if (propTypes.txIsRejected(transaction)) { + } else if (propTypes.txIsDeclined(transaction)) { return ( ); - } else if (propTypes.txIsAutorejected(transaction)) { + } else if (propTypes.txIsAutodeclined(transaction)) { return ( ); @@ -92,11 +92,11 @@ const saleMessage = (transaction, customerName) => { return ; } else if (propTypes.txIsAccepted(transaction)) { return ; - } else if (propTypes.txIsRejected(transaction)) { - return ; - } else if (propTypes.txIsAutorejected(transaction)) { + } else if (propTypes.txIsDeclined(transaction)) { + return ; + } else if (propTypes.txIsAutodeclined(transaction)) { return ( - + ); } else if (propTypes.txIsCanceled(transaction)) { return ; @@ -115,11 +115,11 @@ export const SaleDetailsPanelComponent = props => { className, transaction, onAcceptSale, - onRejectSale, + onDeclineSale, acceptInProgress, - rejectInProgress, + declineInProgress, acceptSaleError, - rejectSaleError, + declineSaleError, intl, } = props; const currentTransaction = ensureTransaction(transaction); @@ -161,16 +161,16 @@ export const SaleDetailsPanelComponent = props => { : null; const canShowButtons = propTypes.txIsPreauthorized(currentTransaction) && !isCustomerBanned; - const buttonsDisabled = acceptInProgress || rejectInProgress; + const buttonsDisabled = acceptInProgress || declineInProgress; const acceptErrorMessage = acceptSaleError ?

: null; - const rejectErrorMessage = rejectSaleError + const declineErrorMessage = declineSaleError ?

- +

: null; @@ -178,15 +178,15 @@ export const SaleDetailsPanelComponent = props => { ?
{acceptErrorMessage} - {rejectErrorMessage} + {declineErrorMessage}
onRejectSale(currentTransaction.id)} + onClick={() => onDeclineSale(currentTransaction.id)} > - + {

{message}

{acceptErrorMessage} - {rejectErrorMessage} + {declineErrorMessage}
{actionButtons}
@@ -270,7 +270,7 @@ SaleDetailsPanelComponent.defaultProps = { rootClassName: null, className: null, acceptSaleError: null, - rejectSaleError: null, + declineSaleError: null, }; const { string, func, bool, instanceOf } = PropTypes; @@ -280,11 +280,11 @@ SaleDetailsPanelComponent.propTypes = { className: string, transaction: propTypes.transaction.isRequired, onAcceptSale: func.isRequired, - onRejectSale: func.isRequired, + onDeclineSale: func.isRequired, acceptInProgress: bool.isRequired, - rejectInProgress: bool.isRequired, + declineInProgress: bool.isRequired, acceptSaleError: instanceOf(Error), - rejectSaleError: instanceOf(Error), + declineSaleError: instanceOf(Error), // from injectIntl intl: intlShape.isRequired, diff --git a/src/components/SaleDetailsPanel/SaleDetailsPanel.test.js b/src/components/SaleDetailsPanel/SaleDetailsPanel.test.js index a05272ee..d611815b 100644 --- a/src/components/SaleDetailsPanel/SaleDetailsPanel.test.js +++ b/src/components/SaleDetailsPanel/SaleDetailsPanel.test.js @@ -35,15 +35,15 @@ const txAccepted = createTransaction({ ...baseTxAttrs, }); -const txRejected = createTransaction({ - id: 'sale-rejected', - lastTransition: propTypes.TX_TRANSITION_REJECT, +const txDeclined = createTransaction({ + id: 'sale-declined', + lastTransition: propTypes.TX_TRANSITION_DECLINE, ...baseTxAttrs, }); -const txAutoRejected = createTransaction({ - id: 'sale-autorejected', - lastTransition: propTypes.TX_TRANSITION_AUTO_REJECT, +const txAutoDeclined = createTransaction({ + id: 'sale-autodeclined', + lastTransition: propTypes.TX_TRANSITION_AUTO_DECLINE, ...baseTxAttrs, }); @@ -64,9 +64,9 @@ describe('SaleDetailsPanel', () => { const props = { transaction: txPreauthorized, onAcceptSale: noop, - onRejectSale: noop, + onDeclineSale: noop, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, intl: fakeIntl, }; const tree = renderShallow(); @@ -76,33 +76,33 @@ describe('SaleDetailsPanel', () => { const props = { transaction: txAccepted, onAcceptSale: noop, - onRejectSale: noop, + onDeclineSale: noop, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, intl: fakeIntl, }; const tree = renderShallow(); expect(tree).toMatchSnapshot(); }); - it('rejected matches snapshot', () => { + it('declined matches snapshot', () => { const props = { - transaction: txRejected, + transaction: txDeclined, onAcceptSale: noop, - onRejectSale: noop, + onDeclineSale: noop, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, intl: fakeIntl, }; const tree = renderShallow(); expect(tree).toMatchSnapshot(); }); - it('autorejected matches snapshot', () => { + it('autodeclined matches snapshot', () => { const props = { - transaction: txAutoRejected, + transaction: txAutoDeclined, onAcceptSale: noop, - onRejectSale: noop, + onDeclineSale: noop, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, intl: fakeIntl, }; const tree = renderShallow(); @@ -112,9 +112,9 @@ describe('SaleDetailsPanel', () => { const props = { transaction: txCanceled, onAcceptSale: noop, - onRejectSale: noop, + onDeclineSale: noop, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, intl: fakeIntl, }; const tree = renderShallow(); @@ -124,9 +124,9 @@ describe('SaleDetailsPanel', () => { const props = { transaction: txDelivered, onAcceptSale: noop, - onRejectSale: noop, + onDeclineSale: noop, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, intl: fakeIntl, }; const tree = renderShallow(); @@ -149,9 +149,9 @@ describe('SaleDetailsPanel', () => { const props = { transaction, onAcceptSale: noop, - onRejectSale: noop, + onDeclineSale: noop, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, intl: fakeIntl, }; const panel = shallow(); diff --git a/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap b/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap index 2e97f0b9..61fde118 100644 --- a/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap +++ b/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap @@ -367,7 +367,7 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
`; -exports[`SaleDetailsPanel autorejected matches snapshot 1`] = ` +exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
@@ -437,7 +437,7 @@ exports[`SaleDetailsPanel autorejected matches snapshot 1`] = `

@@ -500,7 +500,7 @@ exports[`SaleDetailsPanel autorejected matches snapshot 1`] = ` Object { "attributes": Object { "createdAt": 2017-05-01T00:00:00.000Z, - "lastTransition": "transition/auto-reject", + "lastTransition": "transition/auto-decline", "lastTransitionedAt": 2017-06-10T00:00:00.000Z, "lineItems": Array [ Object { @@ -560,7 +560,7 @@ exports[`SaleDetailsPanel autorejected matches snapshot 1`] = ` "type": "user", }, "id": UUID { - "uuid": "sale-autorejected", + "uuid": "sale-autodeclined", }, "listing": Object { "attributes": Object { @@ -639,7 +639,7 @@ exports[`SaleDetailsPanel autorejected matches snapshot 1`] = ` Object { "attributes": Object { "createdAt": 2017-05-01T00:00:00.000Z, - "lastTransition": "transition/auto-reject", + "lastTransition": "transition/auto-decline", "lastTransitionedAt": 2017-06-10T00:00:00.000Z, "lineItems": Array [ Object { @@ -699,7 +699,7 @@ exports[`SaleDetailsPanel autorejected matches snapshot 1`] = ` "type": "user", }, "id": UUID { - "uuid": "sale-autorejected", + "uuid": "sale-autodeclined", }, "listing": Object { "attributes": Object { @@ -842,7 +842,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = ` onClick={[Function]} > @@ -1116,6 +1116,373 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `

`; +exports[`SaleDetailsPanel declined matches snapshot 1`] = ` +
+
+
+
+ +
+
+
+ +
+
+
+ +
+

+ + listing1 title + , + } + } + /> +

+

+ + + , + } + } + /> +

+
+
+
+

+ +

+ +
+
+
+
+ +
+
+

+ +

+
+ +
+
+
+
+`; + exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
@@ -1864,370 +2231,3 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
`; - -exports[`SaleDetailsPanel rejected matches snapshot 1`] = ` -
-
-
-
- -
-
-
- -
-
-
- -
-

- - listing1 title - , - } - } - /> -

-

- - - , - } - } - /> -

-
-
-
-

- -

- -
-
-
-
- -
-
-

- -

-
- -
-
-
-
-`; diff --git a/src/containers/InboxPage/InboxPage.css b/src/containers/InboxPage/InboxPage.css index ea07c49b..e9603f11 100644 --- a/src/containers/InboxPage/InboxPage.css +++ b/src/containers/InboxPage/InboxPage.css @@ -401,7 +401,7 @@ .lastTransitionedAtCanceled, .lastTransitionedAtAccepted, -.lastTransitionedAtRejected, +.lastTransitionedAtDeclined, .lastTransitionedAtDelivered { color: var(--matterColorAnti); } diff --git a/src/containers/InboxPage/InboxPage.js b/src/containers/InboxPage/InboxPage.js index 4cc3fa31..a0155bd7 100644 --- a/src/containers/InboxPage/InboxPage.js +++ b/src/containers/InboxPage/InboxPage.js @@ -46,11 +46,11 @@ const txState = (intl, tx, isOrder) => { id: 'InboxPage.stateAccepted', }), }; - } else if (propTypes.txIsRejectedOrAutorejected(tx)) { + } else if (propTypes.txIsDeclinedOrAutodeclined(tx)) { return { nameClassName: css.nameDeclined, bookingClassName: css.bookingDeclined, - lastTransitionedAtClassName: css.lastTransitionedAtRejected, + lastTransitionedAtClassName: css.lastTransitionedAtDeclined, stateClassName: css.stateDeclined, state: intl.formatMessage({ id: 'InboxPage.stateDeclined', diff --git a/src/containers/SalePage/SalePage.duck.js b/src/containers/SalePage/SalePage.duck.js index cfff2b5c..10759335 100644 --- a/src/containers/SalePage/SalePage.duck.js +++ b/src/containers/SalePage/SalePage.duck.js @@ -14,9 +14,9 @@ export const ACCEPT_SALE_REQUEST = 'app/SalePage/ACCEPT_SALE_REQUEST'; export const ACCEPT_SALE_SUCCESS = 'app/SalePage/ACCEPT_SALE_SUCCESS'; export const ACCEPT_SALE_ERROR = 'app/SalePage/ACCEPT_SALE_ERROR'; -export const REJECT_SALE_REQUEST = 'app/SalePage/REJECT_SALE_REQUEST'; -export const REJECT_SALE_SUCCESS = 'app/SalePage/REJECT_SALE_SUCCESS'; -export const REJECT_SALE_ERROR = 'app/SalePage/REJECT_SALE_ERROR'; +export const DECLINE_SALE_REQUEST = 'app/SalePage/DECLINE_SALE_REQUEST'; +export const DECLINE_SALE_SUCCESS = 'app/SalePage/DECLINE_SALE_SUCCESS'; +export const DECLINE_SALE_ERROR = 'app/SalePage/DECLINE_SALE_ERROR'; // ================ Reducer ================ // @@ -25,9 +25,9 @@ const initialState = { fetchSaleError: null, transactionRef: null, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, acceptSaleError: null, - rejectSaleError: null, + declineSaleError: null, }; export default function checkoutPageReducer(state = initialState, action = {}) { @@ -44,18 +44,18 @@ export default function checkoutPageReducer(state = initialState, action = {}) { return { ...state, fetchInProgress: false, fetchSaleError: payload }; case ACCEPT_SALE_REQUEST: - return { ...state, acceptInProgress: true, acceptSaleError: null, rejectSaleError: null }; + return { ...state, acceptInProgress: true, acceptSaleError: null, declineSaleError: null }; case ACCEPT_SALE_SUCCESS: return { ...state, acceptInProgress: false }; case ACCEPT_SALE_ERROR: return { ...state, acceptInProgress: false, acceptSaleError: payload }; - case REJECT_SALE_REQUEST: - return { ...state, rejectInProgress: true, rejectSaleError: null, acceptSaleError: null }; - case REJECT_SALE_SUCCESS: - return { ...state, rejectInProgress: false }; - case REJECT_SALE_ERROR: - return { ...state, rejectInProgress: false, rejectSaleError: payload }; + case DECLINE_SALE_REQUEST: + return { ...state, declineInProgress: true, declineSaleError: null, acceptSaleError: null }; + case DECLINE_SALE_SUCCESS: + return { ...state, declineInProgress: false }; + case DECLINE_SALE_ERROR: + return { ...state, declineInProgress: false, declineSaleError: payload }; default: return state; @@ -64,8 +64,8 @@ export default function checkoutPageReducer(state = initialState, action = {}) { // ================ Selectors ================ // -export const acceptOrRejectInProgress = state => { - return state.SalePage.acceptInProgress || state.SalePage.rejectInProgress; +export const acceptOrDeclineInProgress = state => { + return state.SalePage.acceptInProgress || state.SalePage.declineInProgress; }; // ================ Action creators ================ // @@ -78,9 +78,9 @@ const acceptSaleRequest = () => ({ type: ACCEPT_SALE_REQUEST }); const acceptSaleSuccess = () => ({ type: ACCEPT_SALE_SUCCESS }); const acceptSaleError = e => ({ type: ACCEPT_SALE_ERROR, error: true, payload: e }); -const rejectSaleRequest = () => ({ type: REJECT_SALE_REQUEST }); -const rejectSaleSuccess = () => ({ type: REJECT_SALE_SUCCESS }); -const rejectSaleError = e => ({ type: REJECT_SALE_ERROR, error: true, payload: e }); +const declineSaleRequest = () => ({ type: DECLINE_SALE_REQUEST }); +const declineSaleSuccess = () => ({ type: DECLINE_SALE_SUCCESS }); +const declineSaleError = e => ({ type: DECLINE_SALE_ERROR, error: true, payload: e }); // ================ Thunks ================ // @@ -130,8 +130,8 @@ export const fetchSale = id => export const acceptSale = id => (dispatch, getState, sdk) => { - if (acceptOrRejectInProgress(getState())) { - return Promise.reject(new Error('Accept or reject already in progress')); + if (acceptOrDeclineInProgress(getState())) { + return Promise.reject(new Error('Accept or decline already in progress')); } dispatch(acceptSaleRequest()); @@ -153,26 +153,26 @@ export const acceptSale = id => }); }; -export const rejectSale = id => +export const declineSale = id => (dispatch, getState, sdk) => { - if (acceptOrRejectInProgress(getState())) { - return Promise.reject(new Error('Accept or reject already in progress')); + if (acceptOrDeclineInProgress(getState())) { + return Promise.reject(new Error('Accept or decline already in progress')); } - dispatch(rejectSaleRequest()); + dispatch(declineSaleRequest()); return sdk.transactions - .transition({ id, transition: propTypes.TX_TRANSITION_REJECT, params: {} }, { expand: true }) + .transition({ id, transition: propTypes.TX_TRANSITION_DECLINE, params: {} }, { expand: true }) .then(response => { dispatch(addMarketplaceEntities(response)); - dispatch(rejectSaleSuccess()); + dispatch(declineSaleSuccess()); dispatch(fetchCurrentUserNotifications()); return response; }) .catch(e => { - dispatch(rejectSaleError(e)); + dispatch(declineSaleError(e)); log.error(e, 'redect-sale-failed', { txId: id, - transition: propTypes.TX_TRANSITION_REJECT, + transition: propTypes.TX_TRANSITION_DECLINE, }); throw e; }); diff --git a/src/containers/SalePage/SalePage.js b/src/containers/SalePage/SalePage.js index a5b8d467..ef8c4e7b 100644 --- a/src/containers/SalePage/SalePage.js +++ b/src/containers/SalePage/SalePage.js @@ -7,7 +7,7 @@ import * as propTypes from '../../util/propTypes'; import { ensureListing, ensureTransaction } from '../../util/data'; import { getMarketplaceEntities } from '../../ducks/marketplaceData.duck'; import { isScrollingDisabled } from '../../ducks/UI.duck'; -import { acceptSale, rejectSale, loadData } from './SalePage.duck'; +import { acceptSale, declineSale, loadData } from './SalePage.duck'; import { NamedRedirect, SaleDetailsPanel, Page } from '../../components'; import { TopbarContainer } from '../../containers'; @@ -21,13 +21,13 @@ export const SalePageComponent = props => { currentUser, fetchSaleError, acceptSaleError, - rejectSaleError, + declineSaleError, acceptInProgress, - rejectInProgress, + declineInProgress, intl, logoutError, onAcceptSale, - onRejectSale, + onDeclineSale, params, scrollingDisabled, transaction, @@ -61,11 +61,11 @@ export const SalePageComponent = props => { className={detailsClassName} transaction={currentTransaction} onAcceptSale={onAcceptSale} - onRejectSale={onRejectSale} + onDeclineSale={onDeclineSale} acceptInProgress={acceptInProgress} - rejectInProgress={rejectInProgress} + declineInProgress={declineInProgress} acceptSaleError={acceptSaleError} - rejectSaleError={rejectSaleError} + declineSaleError={declineSaleError} /> : loadingOrFailedFetching; @@ -89,7 +89,7 @@ SalePageComponent.defaultProps = { currentUser: null, fetchSaleError: null, acceptSaleError: null, - rejectSaleError: null, + declineSaleError: null, logoutError: null, transaction: null, }; @@ -101,13 +101,13 @@ SalePageComponent.propTypes = { currentUser: propTypes.currentUser, fetchSaleError: instanceOf(Error), acceptSaleError: instanceOf(Error), - rejectSaleError: instanceOf(Error), + declineSaleError: instanceOf(Error), acceptInProgress: bool.isRequired, - rejectInProgress: bool.isRequired, + declineInProgress: bool.isRequired, intl: intlShape.isRequired, logoutError: instanceOf(Error), onAcceptSale: func.isRequired, - onRejectSale: func.isRequired, + onDeclineSale: func.isRequired, params: shape({ id: string }).isRequired, scrollingDisabled: bool.isRequired, tab: oneOf(['details', 'discussion']).isRequired, @@ -118,9 +118,9 @@ const mapStateToProps = state => { const { fetchSaleError, acceptSaleError, - rejectSaleError, + declineSaleError, acceptInProgress, - rejectInProgress, + declineInProgress, transactionRef, } = state.SalePage; const { authInfoError, logoutError } = state.Auth; @@ -134,9 +134,9 @@ const mapStateToProps = state => { currentUser, fetchSaleError, acceptSaleError, - rejectSaleError, + declineSaleError, acceptInProgress, - rejectInProgress, + declineInProgress, logoutError, scrollingDisabled: isScrollingDisabled(state), transaction, @@ -146,7 +146,7 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { onAcceptSale: transactionId => dispatch(acceptSale(transactionId)), - onRejectSale: transactionId => dispatch(rejectSale(transactionId)), + onDeclineSale: transactionId => dispatch(declineSale(transactionId)), }; }; diff --git a/src/containers/SalePage/SalePage.test.js b/src/containers/SalePage/SalePage.test.js index 2c5a74a4..386c3c1c 100644 --- a/src/containers/SalePage/SalePage.test.js +++ b/src/containers/SalePage/SalePage.test.js @@ -36,13 +36,13 @@ describe('SalePage', () => { }, authInProgress: false, acceptInProgress: false, - rejectInProgress: false, + declineInProgress: false, currentUserHasListings: false, isAuthenticated: false, onLogout: noop, onManageDisableScrolling: noop, onAcceptSale: noop, - onRejectSale: noop, + onDeclineSale: noop, params: { id: txId }, scrollingDisabled: false, transaction, diff --git a/src/containers/SalePage/__snapshots__/SalePage.test.js.snap b/src/containers/SalePage/__snapshots__/SalePage.test.js.snap index ffa23b92..67ea3f27 100644 --- a/src/containers/SalePage/__snapshots__/SalePage.test.js.snap +++ b/src/containers/SalePage/__snapshots__/SalePage.test.js.snap @@ -13,10 +13,10 @@ exports[`SalePage matches snapshot 1`] = ` acceptInProgress={false} acceptSaleError={null} className="undefined" + declineInProgress={false} + declineSaleError={null} onAcceptSale={[Function]} - onRejectSale={[Function]} - rejectInProgress={false} - rejectSaleError={null} + onDeclineSale={[Function]} transaction={ Object { "attributes": Object { diff --git a/src/translations/en.json b/src/translations/en.json index c364e082..5592e2fc 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -25,7 +25,7 @@ "BookingBreakdown.providerTotalCanceled": "Total price", "BookingBreakdown.providerTotalDefault": "You'll make", "BookingBreakdown.providerTotalDelivered": "You made", - "BookingBreakdown.providerTotalRejected": "You would have made", + "BookingBreakdown.providerTotalDeclined": "You would have made", "BookingBreakdown.subTotal": "Subtotal", "BookingBreakdown.refund": "Refund", "BookingBreakdown.total": "Total price", @@ -238,8 +238,8 @@ "OrderDetailsPanel.orderAcceptedStatus": "{providerName} accepted the request on {transitionDate}.", "OrderDetailsPanel.orderAcceptedSubtitle": "You have booked {listingLink}", "OrderDetailsPanel.orderAcceptedTitle": "Woohoo {customerName}!", - "OrderDetailsPanel.orderAutoRejectedStatus": "The request expired on {transitionDate}. {providerName} never replied to the request.", - "OrderDetailsPanel.orderAutoRejectedTitle": "You requested to book {listingLink}", + "OrderDetailsPanel.orderAutoDeclinedStatus": "The request expired on {transitionDate}. {providerName} never replied to the request.", + "OrderDetailsPanel.orderAutoDeclinedTitle": "You requested to book {listingLink}", "OrderDetailsPanel.orderCanceledStatus": "The request was cancelled on {transitionDate}", "OrderDetailsPanel.orderCanceledTitle": "You booked {listingLink}", "OrderDetailsPanel.orderDeliveredStatus": " ", @@ -247,8 +247,8 @@ "OrderDetailsPanel.orderPreauthorizedStatus": "{providerName} has been notified about the booking request, so sit back and relax.", "OrderDetailsPanel.orderPreauthorizedSubtitle": "You have requested to book {listingLink}", "OrderDetailsPanel.orderPreauthorizedTitle": "Great success, {customerName}!", - "OrderDetailsPanel.orderRejectedStatus": "Unfortunately {providerName} declined the request on {transitionDate}.", - "OrderDetailsPanel.orderRejectedTitle": "You requested to book {listingLink}", + "OrderDetailsPanel.orderDeclinedStatus": "Unfortunately {providerName} declined the request on {transitionDate}.", + "OrderDetailsPanel.orderDeclinedTitle": "You requested to book {listingLink}", "OrderPage.fetchOrderFailed": "Fetching order data failed.", "OrderPage.loadingData": "Loading order data.", "OrderPage.title": "Order details: {listingTitle}", @@ -388,20 +388,20 @@ "SaleDetailsPanel.listingAcceptedTitle": "Woohoo! You accepted a request from {customerName} for {listingLink}", "SaleDetailsPanel.listingCanceledTitle": "{customerName} booked {listingLink}", "SaleDetailsPanel.listingDeliveredTitle": "{customerName} booked {listingLink}", - "SaleDetailsPanel.listingRejectedTitle": "{customerName} requested to book {listingLink}", + "SaleDetailsPanel.listingDeclinedTitle": "{customerName} requested to book {listingLink}", "SaleDetailsPanel.listingRequestedTitle": "{customerName} has requested to book {listingLink}", - "SaleDetailsPanel.rejectSaleFailed": "Oops, rejecting failed. Please try again.", + "SaleDetailsPanel.declineSaleFailed": "Oops, declining failed. Please try again.", "SaleDetailsPanel.saleAcceptedStatus": "You accepted the request on {formattedDate}.", - "SaleDetailsPanel.saleAutoRejectedStatus": "You did not react to the request on time. The request expired on {formattedDate}.", + "SaleDetailsPanel.saleAutoDeclinedStatus": "You did not react to the request on time. The request expired on {formattedDate}.", "SaleDetailsPanel.saleCanceledStatus": "The request was cancelled on {formattedDate}.", "SaleDetailsPanel.saleDeliveredStatus": "You delivered the order on {formattedDate}.", - "SaleDetailsPanel.saleRejectedStatus": "You declined the request on {formattedDate}.", + "SaleDetailsPanel.saleDeclinedStatus": "You declined the request on {formattedDate}.", "SaleDetailsPanel.saleRequestedStatus": "{customerName} is waiting for your response.", "SalePage.acceptButton": "Accept", "SalePage.fetchSaleFailed": "Fetching sale data failed.", "SalePage.loadingData": "Loading sale data.", - "SalePage.rejectButton": "Decline", - "SalePage.rejectSaleFailed": "Rejecting sale failed.", + "SalePage.declineButton": "Decline", + "SalePage.declineSaleFailed": "Declining sale failed.", "SalePage.title": "Sale details: {title}", "SearchMapInfoCard.noImage": "No image", "SearchPage.foundResults": "{count, number} {count, plural, one {sauna} other {saunas}} found", diff --git a/src/util/propTypes.js b/src/util/propTypes.js index 35aaf038..a68e26c2 100644 --- a/src/util/propTypes.js +++ b/src/util/propTypes.js @@ -143,14 +143,14 @@ export const booking = shape({ // provider sees the transaction in the SalePage. export const TX_TRANSITION_PREAUTHORIZE = 'transition/preauthorize'; -// When the provider accepts or rejects a transaction from the -// SalePage, it is transitioned with the accept or reject transition. +// When the provider accepts or declines a transaction from the +// SalePage, it is transitioned with the accept or decline transition. export const TX_TRANSITION_ACCEPT = 'transition/accept'; -export const TX_TRANSITION_REJECT = 'transition/reject'; +export const TX_TRANSITION_DECLINE = 'transition/decline'; -// If the backend automatically rejects the transaction, it is -// transitioned with the auto-reject transition. -export const TX_TRANSITION_AUTO_REJECT = 'transition/auto-reject'; +// If the backend automatically declines the transaction, it is +// transitioned with the auto-decline transition. +export const TX_TRANSITION_AUTO_DECLINE = 'transition/auto-decline'; // Admin can also cancel the transition. export const TX_TRANSITION_CANCEL = 'transition/cancel'; @@ -162,8 +162,8 @@ export const TX_TRANSITION_MARK_DELIVERED = 'transition/mark-delivered'; export const TX_TRANSITIONS = [ TX_TRANSITION_PREAUTHORIZE, TX_TRANSITION_ACCEPT, - TX_TRANSITION_REJECT, - TX_TRANSITION_AUTO_REJECT, + TX_TRANSITION_DECLINE, + TX_TRANSITION_AUTO_DECLINE, TX_TRANSITION_CANCEL, TX_TRANSITION_MARK_DELIVERED, ]; @@ -174,11 +174,11 @@ export const txIsPreauthorized = tx => txLastTransition(tx) === TX_TRANSITION_PR export const txIsAccepted = tx => txLastTransition(tx) === TX_TRANSITION_ACCEPT; -export const txIsRejected = tx => txLastTransition(tx) === TX_TRANSITION_REJECT; +export const txIsDeclined = tx => txLastTransition(tx) === TX_TRANSITION_DECLINE; -export const txIsAutorejected = tx => txLastTransition(tx) === TX_TRANSITION_AUTO_REJECT; +export const txIsAutodeclined = tx => txLastTransition(tx) === TX_TRANSITION_AUTO_DECLINE; -export const txIsRejectedOrAutorejected = tx => txIsRejected(tx) || txIsAutorejected(tx); +export const txIsDeclinedOrAutodeclined = tx => txIsDeclined(tx) || txIsAutodeclined(tx); export const txIsCanceled = tx => txLastTransition(tx) === TX_TRANSITION_CANCEL; diff --git a/src/util/routes.js b/src/util/routes.js index d9b52ca3..6ae64bda 100644 --- a/src/util/routes.js +++ b/src/util/routes.js @@ -33,7 +33,7 @@ export const pathByRouteName = (nameToFind, routes, params = {}) => * exact flag set to false. If not, an array containing just the first matched exact route is returned. */ export const matchPathname = (pathname, routeConfiguration) => { - const matchedRoutes = routeConfiguration.reduce( + const matchedRoutes = routeConfiguration.reduce( (matches, route) => { const { path, exact = true } = route; const match = matchPath(pathname, { path, exact });