diff --git a/src/components/TransactionPanel/PanelHeading.js b/src/components/TransactionPanel/PanelHeading.js index b41275f9..86a45dd0 100644 --- a/src/components/TransactionPanel/PanelHeading.js +++ b/src/components/TransactionPanel/PanelHeading.js @@ -7,6 +7,8 @@ import { NamedLink } from '../../components'; import css from './TransactionPanel.css'; export const HEADING_ENQUIRED = 'enquired'; +export const HEADING_PAYMENT_PENDING = 'pending-payment'; +export const HEADING_PAYMENT_EXPIRED = 'payment-expired'; export const HEADING_REQUESTED = 'requested'; export const HEADING_ACCEPTED = 'accepted'; export const HEADING_DECLINED = 'declined'; @@ -74,7 +76,7 @@ const CustomerBannedInfoMaybe = props => { }; const HeadingProvider = props => { - const { className, id, values, isCustomerBanned } = props; + const { className, id, values, isCustomerBanned, children } = props; return (

@@ -82,6 +84,7 @@ const HeadingProvider = props => {

+ {children}
); @@ -125,6 +128,45 @@ const PanelHeading = props => { isCustomerBanned={isCustomerBanned} /> ); + case HEADING_PAYMENT_PENDING: + return isCustomer ? ( + + ) : ( + +

+ +

+
+ ); + case HEADING_PAYMENT_EXPIRED: + return isCustomer ? ( + + ) : ( + + ); case HEADING_REQUESTED: return isCustomer ? ( { const txPreauthorized = createTransaction({ id: 'sale-preauthorized', - lastTransition: TRANSITION_REQUEST, + lastTransition: TRANSITION_REQUEST_PAYMENT, ...baseTxAttrs, }); @@ -92,7 +93,7 @@ describe('TransactionPanel - Sale', () => { createTxTransition({ createdAt: new Date(Date.UTC(2017, 4, 1)), by: 'customer', - transition: TRANSITION_REQUEST, + transition: TRANSITION_REQUEST_PAYMENT, }), createTxTransition({ createdAt: new Date(Date.UTC(2017, 5, 1)), @@ -197,7 +198,7 @@ describe('TransactionPanel - Sale', () => { const transaction = createTransaction({ id: 'sale-tx', - lastTransition: TRANSITION_REQUEST, + lastTransition: TRANSITION_REQUEST_PAYMENT, total: new Money(16500, 'USD'), commission: new Money(1000, 'USD'), booking: createBooking('booking1', { @@ -252,7 +253,7 @@ describe('TransactionPanel - Order', () => { const txPreauthorized = createTransaction({ id: 'order-preauthorized', - lastTransition: TRANSITION_REQUEST, + lastTransition: TRANSITION_CONFIRM_PAYMENT, ...baseTxAttrs, }); @@ -287,7 +288,12 @@ describe('TransactionPanel - Order', () => { createTxTransition({ createdAt: new Date(Date.UTC(2017, 4, 1)), by: 'customer', - transition: TRANSITION_REQUEST, + transition: TRANSITION_REQUEST_PAYMENT, + }), + createTxTransition({ + createdAt: new Date(Date.UTC(2017, 4, 1, 0, 0, 1)), + by: 'customer', + transition: TRANSITION_CONFIRM_PAYMENT, }), createTxTransition({ createdAt: new Date(Date.UTC(2017, 5, 1)), @@ -393,7 +399,7 @@ describe('TransactionPanel - Order', () => { const end = new Date(Date.UTC(2017, 5, 13)); const tx = createTransaction({ id: 'order-tx', - lastTransition: TRANSITION_REQUEST, + lastTransition: TRANSITION_REQUEST_PAYMENT, total: new Money(16500, 'USD'), booking: createBooking('booking1', { start, diff --git a/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap b/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap index bc554292..24d52822 100644 --- a/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap +++ b/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap @@ -180,7 +180,12 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -325,7 +330,12 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -605,7 +615,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -922,7 +937,12 @@ exports[`TransactionPanel - Order autodeclined matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -1067,7 +1087,12 @@ exports[`TransactionPanel - Order autodeclined matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -1346,7 +1371,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -1664,7 +1694,12 @@ exports[`TransactionPanel - Order canceled matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -1809,7 +1844,12 @@ exports[`TransactionPanel - Order canceled matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -2089,7 +2129,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -2406,7 +2451,12 @@ exports[`TransactionPanel - Order declined matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -2551,7 +2601,12 @@ exports[`TransactionPanel - Order declined matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -2830,7 +2885,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -3148,7 +3208,12 @@ exports[`TransactionPanel - Order delivered matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -3298,7 +3363,12 @@ exports[`TransactionPanel - Order delivered matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -3583,7 +3653,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -3905,7 +3980,12 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -4050,7 +4130,12 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -4328,7 +4413,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -4591,7 +4681,7 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = ` Object { "attributes": Object { "createdAt": 2017-05-01T00:00:00.000Z, - "lastTransition": "transition/request", + "lastTransition": "transition/confirm-payment", "lastTransitionedAt": 2017-06-01T00:00:00.000Z, "lineItems": Array [ Object { @@ -4645,7 +4735,12 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -4736,7 +4831,7 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = ` Object { "attributes": Object { "createdAt": 2017-05-01T00:00:00.000Z, - "lastTransition": "transition/request", + "lastTransition": "transition/confirm-payment", "lastTransitionedAt": 2017-06-01T00:00:00.000Z, "lineItems": Array [ Object { @@ -4790,7 +4885,12 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -5015,7 +5115,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "attributes": Object { "createdAt": 2017-05-01T00:00:00.000Z, - "lastTransition": "transition/request", + "lastTransition": "transition/confirm-payment", "lastTransitionedAt": 2017-06-01T00:00:00.000Z, "lineItems": Array [ Object { @@ -5069,7 +5169,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -5387,7 +5492,12 @@ exports[`TransactionPanel - Sale accepted matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -5532,7 +5642,12 @@ exports[`TransactionPanel - Sale accepted matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -5812,7 +5927,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -6129,7 +6249,12 @@ exports[`TransactionPanel - Sale autodeclined matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -6274,7 +6399,12 @@ exports[`TransactionPanel - Sale autodeclined matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -6553,7 +6683,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -6871,7 +7006,12 @@ exports[`TransactionPanel - Sale canceled matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -7016,7 +7156,12 @@ exports[`TransactionPanel - Sale canceled matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -7296,7 +7441,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -7613,7 +7763,12 @@ exports[`TransactionPanel - Sale declined matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -7758,7 +7913,12 @@ exports[`TransactionPanel - Sale declined matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -8037,7 +8197,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -8355,7 +8520,7 @@ exports[`TransactionPanel - Sale delivered matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", }, Object { "by": "provider", @@ -8505,7 +8670,7 @@ exports[`TransactionPanel - Sale delivered matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", }, Object { "by": "provider", @@ -8790,7 +8955,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", }, Object { "by": "provider", @@ -9112,7 +9277,12 @@ exports[`TransactionPanel - Sale enquired matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -9257,7 +9427,12 @@ exports[`TransactionPanel - Sale enquired matches snapshot 1`] = ` Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -9535,7 +9710,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i Object { "by": "customer", "createdAt": 2017-05-01T00:00:00.000Z, - "transition": "transition/request", + "transition": "transition/request-payment", + }, + Object { + "by": "customer", + "createdAt": 2017-05-01T00:00:01.000Z, + "transition": "transition/confirm-payment", }, Object { "by": "provider", @@ -9743,7 +9923,7 @@ exports[`TransactionPanel - Sale preauthorized matches snapshot 1`] = ` listingDeleted={false} listingId="listing1" listingTitle="listing1 title" - panelHeadingState="requested" + panelHeadingState="pending-payment" providerName={