mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 12:43:11 +10:00
Add transitions to the transaction shape
This commit is contained in:
parent
94700e19a2
commit
2b7e79b3b1
1 changed files with 20 additions and 0 deletions
|
|
@ -172,6 +172,19 @@ export const TX_TRANSITIONS = [
|
|||
TX_TRANSITION_MARK_DELIVERED,
|
||||
];
|
||||
|
||||
// Roles of actors that perform transaction transitions
|
||||
export const TX_TRANSITION_ACTOR_CUSTOMER = 'customer';
|
||||
export const TX_TRANSITION_ACTOR_PROVIDER = 'provider';
|
||||
export const TX_TRANSITION_ACTOR_SYSTEM = 'system';
|
||||
export const TX_TRANSITION_ACTOR_OPERATOR = 'operator';
|
||||
|
||||
export const TX_TRANSITION_ACTORS = [
|
||||
TX_TRANSITION_ACTOR_CUSTOMER,
|
||||
TX_TRANSITION_ACTOR_PROVIDER,
|
||||
TX_TRANSITION_ACTOR_SYSTEM,
|
||||
TX_TRANSITION_ACTOR_OPERATOR,
|
||||
];
|
||||
|
||||
const txLastTransition = tx => ensureTransaction(tx).attributes.lastTransition;
|
||||
|
||||
export const txIsPreauthorized = tx => txLastTransition(tx) === TX_TRANSITION_PREAUTHORIZE;
|
||||
|
|
@ -207,6 +220,13 @@ export const transaction = shape({
|
|||
reversal: bool.isRequired,
|
||||
})
|
||||
).isRequired,
|
||||
transitions: arrayOf(
|
||||
shape({
|
||||
at: instanceOf(Date).isRequired,
|
||||
by: oneOf(TX_TRANSITION_ACTORS).isRequired,
|
||||
transition: oneOf(TX_TRANSITIONS).isRequired,
|
||||
})
|
||||
).isRequired,
|
||||
}),
|
||||
booking,
|
||||
listing,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue