refund-process.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {
  2. OnTransitionEndFn,
  3. OnTransitionErrorFn,
  4. OnTransitionStartFn,
  5. Transitions,
  6. } from '../../common/finite-state-machine/types';
  7. import { InjectableStrategy } from '../../common/types/injectable-strategy';
  8. import {
  9. CustomRefundStates,
  10. RefundState,
  11. RefundTransitionData,
  12. } from '../../service/helpers/refund-state-machine/refund-state';
  13. /**
  14. * @description
  15. * A RefundProcess is used to define the way the refund process works as in: what states a Refund can be
  16. * in, and how it may transition from one state to another. Using the `onTransitionStart()` hook, a
  17. * RefundProcess can perform checks before allowing a state transition to occur, and the `onTransitionEnd()`
  18. * hook allows logic to be executed after a state change.
  19. *
  20. * For detailed description of the interface members, see the {@link StateMachineConfig} docs.
  21. *
  22. * @docsCategory refund
  23. */
  24. export interface RefundProcess<State extends keyof CustomRefundStates | string> extends InjectableStrategy {
  25. transitions?: Transitions<State, State | RefundState> & Partial<Transitions<RefundState | State>>;
  26. onTransitionStart?: OnTransitionStartFn<State | RefundState, RefundTransitionData>;
  27. onTransitionEnd?: OnTransitionEndFn<State | RefundState, RefundTransitionData>;
  28. onTransitionError?: OnTransitionErrorFn<State | RefundState>;
  29. }
  30. /**
  31. * @description
  32. * Used to define extensions to or modifications of the default refund process.
  33. *
  34. * For detailed description of the interface members, see the {@link StateMachineConfig} docs.
  35. *
  36. * @deprecated Use RefundProcess
  37. */
  38. export interface CustomRefundProcess<State extends keyof CustomRefundStates | string>
  39. extends RefundProcess<State> {}