# gRPC Order service
`grpc_order_url` (dev) = `https://beta-aggregator.evaly.com.bd/api/v1/order`
## Public Customer API
### Get Order
Method: `GET`
URL: `{grpc_order_url}/<invoicNumber>
Headers:
```json=
{
"Authorization": <token>
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {
"id": 3,
"invoice_number": "EVL1603145178776769000931",
"order_items": [
{
"id": 3,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_histories": [
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "2020-10-19T22:06:18Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
}
],
"order_type": "Regular"
}
}
```
### Place order
Method: `POST`
URL: `{grpc_order_url}/
Headers:
```json=
{
"Authorization": <token>
}
```
Request Body:
```json=
{
"order_items": [
{
"quantity": 2,
"shop_item_id": 1
},
{
"quantity": 2,
"shop_item_id": 2
}
],
"payment_method":"bkash",
"origin" : "Web",
"tracking_id": 19,
"delivery_address": "address",
"delivery_contact_number": "contact number"
}
```
Response:
```status_code: 201```
```json=
{
"message": "Successful",
"data": {
"orders": [
{
"id": 29,
"invoice_number": "EVL1603621281071957241763",
"order_items": [
{
"id": 29,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "2020-10-25T10:21:21Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"id": 30,
"invoice_number": "EVL1603621281071975404213",
"order_items": [
{
"id": 30,
"shop_item_id": 2,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 2,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "2020-10-25T10:21:21Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
}
]
}
}
```
### Place Express order
Method: `POST`
URL: `{grpc_order_url}/express
Headers:
```json=
{
"Authorization": <token>
}
```
Request Body:
```json=
{
"order_items": [
{
"quantity": 2,
"shop_item_id": 1
}
],
"payment_method":"bkash",
"origin" : "Web",
"tracking_id": 19,
"delivery_address": "address",
"delivery_contact_number": "contact number"
}
```
Response:
```status_code: 201```
```json=
{
"message": "Successful",
"data": {
"orders": [
{
"id": 31,
"invoice_number": "EVL1603621382082553369985",
"order_items": [
{
"id": 31,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "2020-10-25T10:23:02Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Express"
}
]
}
}
```
### Place Campaign order
Method: `POST`
URL: `{grpc_order_url}/campaign
Headers:
```json=
{
"Authorization": <token>
}
```
Request Body:
```json=
{
"order_items": [
{
"quantity": 2,
"shop_item_id": 1
}
],
"payment_method":"bkash",
"origin" : "Web",
"tracking_id": 19,
"delivery_address": "address",
"delivery_contact_number": "contact number"
}
```
Response:
```status_code: 201```
```json=
{
"message": "Successful",
"data": {
"orders": [
{
"id": 4,
"invoice_number": "EVL1605516695398024807532",
"order_items": [
{
"id": 4,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "01920520408",
"username": "01920520408",
"first_name": "john",
"last_name": "doe"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "2020-11-16T08:51:35Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Campaign"
}
]
}
}
```
### List customer order
Method: `GET`
URL: `{grpc_order_url}/
Headers:
```json=
{
"Authorization": <token>
}
```
Request Body:
```json=
{
"order_items": [
{
"quantity": 2,
"shop_item_id": 1
},
{
"quantity": 2,
"shop_item_id": 2
}
],
"payment_method":"bkash",
"origin" : "Web",
"tracking_id": 19,
"delivery_address": "address",
"delivery_contact_number": "contact number"
}
```
Response:
```status_code: 201```
```json=
{
"message": "Successful",
"data": {
"orders": [
{
"id": 1,
"invoice_number": "EVL1603144786423841000947",
"order_items": [
{
"id": 1,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "0001-01-01T00:00:00Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"id": 2,
"invoice_number": "EVL1603144786423865000876",
"order_items": [
{
"id": 2,
"shop_item_id": 2,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 2,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "0001-01-01T00:00:00Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
]
}
}
```
### Cancel Order
Method: `GET`
URL: `{grpc_order_url}/<invoicNumber>/cancel
Headers:
```json=
{
"Authorization": <token>
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {}
}
```
### Update Delivery Address
Method: `POST`
URL: `{grpc_order_url}/<invoicNumber>/update-address
Headers:
```json=
{
"Authorization": <token>
}
```
Request:
```status_code: 200```
```json=
{
"address": "somewhere new",
"reason": "changed place"
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {}
}
```
## Merchant API
### Get Order
Method: `GET`
URL: `{grpc_order_url}/merchant/<invoicNumber>
Headers:
```json=
{
"Authorization": <token>
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {
"id": 3,
"invoice_number": "EVL1603145178776769000931",
"order_items": [
{
"id": 3,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_histories": [
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "2020-10-19T22:06:18Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
}
],
"order_type": "Regular"
}
}
```
### List merchant order
Method: `GET`
URL: `{grpc_order_url}/merchant
Headers:
```json=
{
"Authorization": <token>
}
```
Request Body:
```json=
{
"order_items": [
{
"quantity": 2,
"shop_item_id": 1
},
{
"quantity": 2,
"shop_item_id": 2
}
],
"payment_method":"bkash",
"origin" : "Web",
"tracking_id": 19,
"delivery_address": "address",
"delivery_contact_number": "contact number"
}
```
Response:
```status_code: 201```
```json=
{
"message": "Successful",
"data": {
"orders": [
{
"id": 1,
"invoice_number": "EVL1603144786423841000947",
"order_items": [
{
"id": 1,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "0001-01-01T00:00:00Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"id": 2,
"invoice_number": "EVL1603144786423865000876",
"order_items": [
{
"id": 2,
"shop_item_id": 2,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 2,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "0001-01-01T00:00:00Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
]
}
}
```
### Cancel Order
Method: `GET`
URL: `{grpc_order_url}/merchant/<invoicNumber>/cancel
Headers:
```json=
{
"Authorization": <token>
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {}
}
```
### Update Order Status
Method: `POST`
URL: `{grpc_order_url}/merchant/<invoicNumber>/update-status
Headers:
```json=
{
"Authorization": <token>
}
```
Request:
```status_code: 200```
```json=
{
"status": "PROCESSING",
"reason": "emnei"
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {}
}
```
## Admin API
### Get Order
Method: `GET`
URL: `{grpc_order_url}/admin/<invoicNumber>
Headers:
```json=
{
"Authorization": <token>
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {
"id": 3,
"invoice_number": "EVL1603145178776769000931",
"order_items": [
{
"id": 3,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_histories": [
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "2020-10-19T22:06:18Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"invoice_number": "EVL1603145178776769000931",
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "CANCELLED",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "~",
"history_date": "2020-10-19T22:07:06Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
}
],
"order_type": "Regular"
}
}
```
### List Admin order
Method: `GET`
URL: `{grpc_order_url}/admin
Headers:
```json=
{
"Authorization": <token>
}
```
Request Body:
```json=
{
"order_items": [
{
"quantity": 2,
"shop_item_id": 1
},
{
"quantity": 2,
"shop_item_id": 2
}
],
"payment_method":"bkash",
"origin" : "Web",
"tracking_id": 19,
"delivery_address": "address",
"delivery_contact_number": "contact number"
}
```
Response:
```status_code: 201```
```json=
{
"message": "Successful",
"data": {
"orders": [
{
"id": 1,
"invoice_number": "EVL1603144786423841000947",
"order_items": [
{
"id": 1,
"shop_item_id": 1,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 1,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "0001-01-01T00:00:00Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
{
"id": 2,
"invoice_number": "EVL1603144786423865000876",
"order_items": [
{
"id": 2,
"shop_item_id": 2,
"quantity": 2,
"item_name": "blah",
"order_time_price": 400,
"product_slug": "blah",
"item_image": "blah"
}
],
"customer": {
"id": "tripping_card",
"username": "tripping_card",
"first_name": "Iron",
"last_name": "Man"
},
"quantity": 2,
"shop": {
"id": 2,
"name": "blah",
"slug": "blah",
"logo_image": "blah"
},
"status": "PENDING",
"payment_status": "UNPAID",
"payment_method": "bkash",
"origin": "Web",
"tracking_id": 19,
"total_amount": 800,
"history_type": "+",
"history_date": "0001-01-01T00:00:00Z",
"delivery_address": "address",
"delivery_contact_number": "contact number",
"order_type": "Regular"
},
]
}
}
```
### Cancel Order
Method: `GET`
URL: `{grpc_order_url}/admin/<invoicNumber>/cancel
Headers:
```json=
{
"Authorization": <token>
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {}
}
```
### Update Order Status
Method: `POST`
URL: `{grpc_order_url}/admin/<invoicNumber>/update-status
Headers:
```json=
{
"Authorization": <token>
}
```
Request:
```status_code: 200```
```json=
{
"status": "PROCESSING",
"reason": "reason"
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {}
}
```
### Update Delivery Address
Method: `POST`
URL: `{grpc_order_url}/admin/<invoicNumber>/update-address
Headers:
```json=
{
"Authorization": <token>
}
```
Request:
```status_code: 200```
```json=
{
"address": "somewhere new",
"reason": "changed place"
}
```
Response:
```status_code: 200```
```json=
{
"message": "Successful",
"data": {}
}
```