DEFRA/ivory-front-office

View on GitHub
server/flow.yml

Summary

Maintainability
Test Coverage
# =====================
# ===== Main flow =====
# =====================

home:
  path: "/"
  handlers: home/home.handlers
  next: item-type
  tags:
    - always

who-owns-item:
  path: "/who-owns-item"
  handlers: who-owns/who-owns-item.handlers
  title: Who owns the item?
  view: common/option/single/single-option
  isQuestionPage: true
  next:
    query: isOwner
    when:
      'true': owner-name
      'false': agent-name

dealing-intent:
  path: "/dealing-intent"
  handlers: dealing-intent/dealing-intent.handlers
  title: What do you plan to do with the item?
  view: common/option/single/single-option
  isQuestionPage: true
  next: check-your-answers

check-your-answers:
  path: "/check-your-answers"
  handlers: check-your-answers/check-your-answers.handlers
  title: Check your answers
  view: check-your-answers/check-your-answers
  next: payment

restore:
  path: "/restore/{id}"
  handlers: restore/restore.handlers
  next:
    query: isSubmitted
    when:
      'true': registration-document
      'false': check-your-answers
  tags:
    - always

confirmation-notify:
  path: "/confirmation-notify"
  handlers: confirmation/confirmation-notify.handlers
  next: confirmation
  tags:
    - submitted

confirmation:
  path: "/confirmation"
  handlers: confirmation/confirmation.handlers
  title: Registration complete
  view: confirmation/confirmation
  tags:
    - submitted
    - hide-back-link

registration-document:
  path: "/registration-document"
  handlers: registration/registration-document.handlers
  title: Registration
  view: registration/registration-document
  tags:
    - submitted
    - hide-back-link

# =====================
# ===== Item flow =====
# =====================

item-type:
  path: "/item-type"
  handlers: item/item-type.handlers
  title: What type of item is it?
  view: common/option/single/single-option
  isQuestionPage: true
  next:
    query: itemTypeSelected
    when:
      apply-to-register-to-sell-an-item-to-a-museum: apply-to-register-to-sell-an-item-to-a-museum
      apply-for-an-rmi-certificate: apply-for-an-rmi-certificate
      other-has-photos: item-age-exemption-declaration
      other-has-no-photos: add-photograph

apply-to-register-to-sell-an-item-to-a-museum:
  path: "/apply-to-register-to-sell-an-item-to-a-museum"
  handlers: item/apply-to-register-to-sell-an-item-to-a-museum.handlers
  title: Apply to register to sell an item to a museum
  view: item/apply-to-register-to-sell-an-item-to-a-museum

apply-for-an-rmi-certificate:
  path: "/apply-for-an-rmi-certificate"
  handlers: item/apply-for-an-rmi-certificate.handlers
  title: Apply for a certificate for a rare and most important (RMI) item
  view: item/apply-for-an-rmi-certificate

item-description:
  path: "/item-description"
  handlers: item/item-description.handlers
  title: Describe the item
  view: item/item-description
  isQuestionPage: true
  next:
    query: requiresAgeExemptionDeclaration
    when:
      'true': item-age-exemption-declaration
      'false': who-owns-item

item-age-exemption-declaration:
  path: "/item-age-exemption-declaration"
  handlers: item/item-age-exemption-declaration.handlers
  view: common/declaration/declaration
  isQuestionPage: true
  next: item-volume-exemption-declaration

item-volume-exemption-declaration:
  path: "/item-volume-exemption-declaration"
  handlers: item/item-volume-exemption-declaration.handlers
  view: common/declaration/declaration
  isQuestionPage: true
  next: who-owns-item


# =====================
# ==== Photos flow ====
# =====================

add-photograph:
  path: "/add-photograph"
  handlers: photos/add-photograph.handlers
  title:
    query: hasPhotos
    when:
      'true': Add another photo
      'false': Add a photo
  view: photos/add-photograph
  isQuestionPage: true
  next: manage-photographs

remove-photograph:
  path: "/remove-photograph/{id}"
  handlers: photos/remove-photograph.handlers
  title: Remove a photo
  view: photos/remove-photograph
  next:
    query: lastPhoto
    when:
      'true': add-photograph
      'false': manage-photographs
  tags:
    - ignore

manage-photographs:
  path: "/manage-photographs"
  handlers: photos/manage-photographs.handlers
  title: Your photos
  view: photos/manage-photographs
  next: item-description


# ======================
# ===== Agent flow =====
# ======================

agent:
  path: "/agent"
  handlers: agent/agent.handlers
  title: How are you acting on behalf of the owner?
  view: common/option/single/single-option
  isQuestionPage: true
  next: 'agent-name'

agent-name:
  path: "/agent-name"
  handlers: agent/agent-name.handlers
  title: Contact name
  view: common/person/name/person-name
  next:
    query: lookUpEnabled
    when:
      'true': agent-address-find
      'false': agent-address-full

agent-address-find:
  path: "/agent-address"
  handlers: agent/address/agent-address-find.handlers
  title: Your address
  view: common/address/find/address-find
  next: agent-address-select
  tags:
    - ignore

agent-address-select:
  path: "/agent-address-select"
  handlers: agent/address/agent-address-select.handlers
  title: Your address
  view: common/address/select/address-select
  next: agent-address-full
  tags:
    - ignore

agent-address-full:
  path: "/agent-address-full"
  handlers: agent/address/agent-address-manual.handlers
  title: Your address
  view: common/address/manual/address-manual
  next: agent-email

agent-email:
  path: "/agent-email"
  handlers: agent/agent-email.handlers
  title: Your email address
  view: common/person/email/person-email
  isQuestionPage: true
  next: owner-name


# ======================
# ===== Owner flow =====
# ======================

owner-name:
  path: "/owner-name"
  handlers: owner/owner-name.handlers
  view: common/person/name/person-name
  title:
    query: isOwner
    when:
      'true': Your name
      'false': Owner's name
  next:
    query: lookUpEnabled
    when:
      'true': owner-address-find
      'false': owner-address-full

owner-address-find:
  path: "/owner-address"
  handlers: owner/address/owner-address-find.handlers
  view: common/address/find/address-find
  title:
    query: isOwner
    when:
      'true': Your address
      'false': Owner's address
  next: owner-address-select
  tags:
    - ignore

owner-address-select:
  path: "/owner-address-select"
  handlers: owner/address/owner-address-select.handlers
  view: common/address/select/address-select
  title:
    query: isOwner
    when:
      'true': Your address
      'false': Owner's address
  next: owner-address-full
  tags:
    - ignore

owner-address-full:
  path: "/owner-address-full"
  handlers: owner/address/owner-address-manual.handlers
  view: common/address/manual/address-manual
  title:
    query: isOwner
    when:
      'true': Your address
      'false': Owner's address
  next:
    query: isOwner
    when:
      'true': owner-email
      'false': dealing-intent

owner-email:
  path: "/owner-email"
  handlers: owner/owner-email.handlers
  title:
    query: isOwner
    when:
      'true': Your email address
      'false': Owner's email address
  view: common/person/email/person-email
  isQuestionPage: true
  next: dealing-intent


# ======================
# ==== Payment flow ====
# ======================

payment:
  path: "/payment"
  handlers: payment/payment.handlers
  next:
    query: paymentEnabled
    when:
      'false': confirmation
  tags:
    - always

check-payment:
  path: "/check-payment/{id}"
  handlers: payment/check-payment.handlers
  next: confirmation-notify
  tags:
    - always