feat(MED-131): update readme for medipost and jobs
This commit is contained in:
39
README.md
39
README.md
@@ -100,3 +100,42 @@ To access admin pages follow these steps:
|
|||||||
|
|
||||||
- [View emails](http://localhost:1080/#/)
|
- [View emails](http://localhost:1080/#/)
|
||||||
- Mail server is running on `localhost:1025` without password
|
- Mail server is running on `localhost:1025` without password
|
||||||
|
|
||||||
|
## Medipost flow
|
||||||
|
|
||||||
|
1. Customer adds analysis to cart in **B2B** storefront
|
||||||
|
2. Customer checks out from cart and is redirected to **Montonio**
|
||||||
|
3. Customer pays and is redirected back to **B2B** `GET B2B/home/cart/montonio-callback?order-token=$JWT`
|
||||||
|
- **Medusa** order is created and cart is emptied
|
||||||
|
- email is sent to customer
|
||||||
|
4. When **Montonio** has confirmed payment, it will call **Medusa** webhook endpoint and **Medusa** will mark order payment as captured.
|
||||||
|
**Medusa** sends `POST B2B/api/order/medipost-create` with `medusaOrderId`. B2B sends order XML as private message to Medipost.
|
||||||
|
This could possibly later happen on montonio-callback URL also but currently not possible in Medusa
|
||||||
|
|
||||||
|
In background a job will call `POST B2B/api/job/sync-analysis-results` every n minutes and sync private messages with responses from **Medipost**.
|
||||||
|
|
||||||
|
In local dev environment, you can create a private message with analysis responses in **Medipost** system for a submitted order:
|
||||||
|
`POST B2B/api/order/medipost-test-response body={medusaOrderId:'input here'}`
|
||||||
|
After that run `POST /api/job/sync-analysis-results` and analysis results should be synced.
|
||||||
|
|
||||||
|
In local dev environment, you can import products from B2B to Medusa with this API:
|
||||||
|
|
||||||
|
- `POST /api/job/sync-analysis-groups-store`
|
||||||
|
- Syncs required data of `analyses`, `analysis_elements` data from **B2B** to **Medusa** and creates relevant products and categories.
|
||||||
|
If product or category already exists, then it is not recreated. Old entries are not deleted either currently.
|
||||||
|
|
||||||
|
## Jobs
|
||||||
|
|
||||||
|
Required headers:
|
||||||
|
|
||||||
|
- `x-jobs-api-key` in UUID format
|
||||||
|
|
||||||
|
Endpoints:
|
||||||
|
|
||||||
|
- `POST /api/job/sync-analysis-groups`
|
||||||
|
- Queries **Medipost** for public messages list and takes analysis info from the latest event.
|
||||||
|
Updates `analyses` and `analysis_elements` lists in **B2B**.
|
||||||
|
- `POST /api/job/sync-analysis-results`
|
||||||
|
- Queries **Medipost** for latest private message that has a response and updates order analysis results from lab results data.
|
||||||
|
- `POST /api/job/sync-connected-online`
|
||||||
|
- TODO
|
||||||
|
|||||||
Reference in New Issue
Block a user