Skip to content

Commit

Permalink
Changed my reservations page reservation tags
Browse files Browse the repository at this point in the history
My reservations page will now show a state label when a normal paid reservation is waiting for a payment. This will indicate that the user's payment has been aborted.
  • Loading branch information
SanttuA committed Sep 13, 2023
1 parent 4c89849 commit dc12732
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/shared/reservation-state-label/ReservationStateLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import Label from 'shared/label';
import { injectT } from 'i18n';

function ReservationStateLabel({ reservation, t }) {
if (!reservation.needManualConfirmation && reservation.state !== 'cancelled') {
const states = constants.RESERVATION_STATE;
const statesToExclude = [states.CANCELLED, states.WAITING_FOR_PAYMENT];

if (!reservation.needManualConfirmation && !statesToExclude.includes(reservation.state)) {
return <span />;
}
const { labelBsStyle, labelTextId } = constants.RESERVATION_STATE_LABELS[reservation.state];
Expand Down
10 changes: 10 additions & 0 deletions app/shared/reservation-state-label/ReservationStateLabel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ describe('shared/reservation-state-label/ReservationStateLabel', () => {
const state = 'requested';
getTests(needManualConfirmation, state);
});

describe('if reservation state is "waiting_for_payment"', () => {
const state = 'waiting_for_payment';
getTests(needManualConfirmation, state);
});
});

describe('if reservation does not need manual confirmation', () => {
Expand All @@ -80,6 +85,11 @@ describe('shared/reservation-state-label/ReservationStateLabel', () => {
getTests(needManualConfirmation, state);
});

describe('if reservation state is "waiting_for_payment"', () => {
const state = 'waiting_for_payment';
getTests(needManualConfirmation, state);
});

describe('if reservation state is "confirmed"', () => {
const state = 'confirmed';

Expand Down

0 comments on commit dc12732

Please sign in to comment.