erkovacs / erko-eth-project

MSc. Thesis project - dApp for performing Double Blind Clinical Studies
0 stars 0 forks source link

Feature/Create mock external service for order management #18

Closed erkovacs closed 3 years ago

erkovacs commented 3 years ago

It should be a simple rest api:

POST /voucher {address} => initiate session and generate voucher, return voucher POST /orders {order_id, voucher} => create order, return {external_order_id}

External service should determine, on the basis of order id and voucher, if the user is to receive treatment or placebo. At no point will user authenticate, and the provided address and other info will not be linked to them personally.

erkovacs commented 3 years ago

Voucher endpoint created: https://60605b9104b05d0017ba25b2.mockapi.io/api/v1/voucher

erkovacs commented 3 years ago

Order endpoint created: https://60605b9104b05d0017ba25b2.mockapi.io/api/v1/order

erkovacs commented 3 years ago

API can be used:

https://60605b9104b05d0017ba25b2.mockapi.io/api/v1/:endpoint

POST /voucher

{
    "responseId": "1",
    "voucher": "a6b21ef0-f768-4b5b-8457-60a6b2a73a60",
    "createdAt": "2021-03-28T10:05:22.086Z",
    "success": true,
    "phone": "0724123456",
    "fax": "",
    "county": "Arad",
    "locality": "Arad",
    "code": "123123",
    "street": "Str. Garoafelor",
    "number": "3",
    "entrance": "2",
    "block": "C-6",
    "floor": "3",
    "apartmentNumber": "21",
    "notes": "Test"
  }
erkovacs commented 3 years ago

POST /order

{
    "externalOrderId": "1",
    "success": true,
    "orderId": "37",
    "voucher": "a6b21ef0-f768-4b5b-8457-60a6b2a73a60"
  }
erkovacs commented 3 years ago

GET /order?orderId=<order id>

<no params>