# Assurance Order Management System V2
## Overview
Assurance Order Management System (AOMS) manages orders for the assurance protection products suite.
The product suite includes
* Post Sale Inspection (PSI)
* DealShield (TBD)
This document will focus addressing the PSI product.
## Architecture
The architecture consists of
1. CDC
2. Product Service (PS)
3. Assurance Product API (API)
Here's a visual overview:
```sequence
CDC -> PS: SQS FIFO Queue
```
### Change Data Capture (CDC)
CDC transmits data changes that occur at the AS400 boxes. These changes are enqueued to a SQS FIFO queue as XML messages based on the filter set by Wolman's Team *(this needs to be updated)*
### Product Service (PS)
PS is composed of two logical components:
* Message Processor
* API
* eligibility
* dealer subscription
* orders
#### Message Processor
Message Processor dequeues XML message from SQS FIFO queue, persists it (for auditing purposes) and gives it business context.
The three business contexts (or business events) are
* **sale**: if dealer has subscription and vehicle is eligible, then order
* **sale backdown**: If order associated with sale backdown, cancel
* **buyer change**: If previous buyer has an existing order, cancel. If new buyer subscribed and vehicle is eligible, then order
If this message fails, it gets sent to SQS Dead Letter Queue (DLQ).
#### API
This service will also host an API that will do the following:
* eligibility
* **POST /eligibility/vehicle/{ID}**: check vehicle product eligibility
* dealer subscription
* **GET /dealers/{5M}/subscription**: show dealer subscription
* **POST /dealers/{5M}/subscription**: create dealer subscription
* **PUT /dealers/{5M}/subscription**: update dealer subscription
* **DELETE /dealers/{5M}/subscription**: delete dealer subscription
* orders
* **GET /orders/{ID}**: show order
* **POST /orders**: place an order
* **PUT /orders/{ID}**: update order
* **DELETE /order/{ID}**: cancel order
* **GET /orders/dealer/{5M}**: list orders by dealer
* **GET /orders/auction/{ID}**: list orders by auction location
## API Layer
The API Layer acts a facade for communicating with all Product Service APIs.
For example, a client service wanted to check customer eligibilty for products
```sequence
Client -> API: POST /orders
API -> PS (PSI): POST /orders
API -> PS (DS): POST /orders
PS (PSI) -> API: response
PS (DS) -> API: response
API -> Client: response
```
## Tooling
* Github Enteprise
* Jenkins
* Java
* AWS Fargate
* AWS RDS MySQL
* AWS SQS
* Docker
## Todo
SQS FIFO DLQ processing