# Customer

# Get Customer Info

Sử dụng API này để lấy thông tin khách hàng, khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required

# Response

{
    "status": true,
    "messageCode": "",
    "messageContent": "",
    "data": {
        "items": {
            "companyId": 1,
            "id": 1,
            "customerName": "Example Name",
            "code": null,
            "avatar": "",
            "email": "example@gmail.com",
            "phone": "",
            "address": "TPHCM",
            "typeId": 1,
            "sizeId": 1,
            "industryId": 1,
            "website": "example.com",
            "rankId": 1,
            "industrialParkId": 1,
            "channelId": 1,
            "userInchargeId": 1,
            "taxCode": "3232676272",
            "createdBy": 3,
            "updatedBy": null,
            "createdAt": "2021-07-16T04:46:39.607Z",
            "updatedAt": "2021-07-23T02:20:20.555Z"
        }
    }
}
curl -X POST http://localhost:3000/customer/ei/getInfo \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{}'

# Update Customer Info

Sử dụng API này để cập nhật thông tin khách hàng, khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required
customerName String
avatar String
email String
phone String
address String
taxCode String
oldPassword String
newPassword String
confirmNewPassword String nhap lai Pass

# Response

{
    "status": true,
    "messageCode": "",
    "messageContent": "",
    "data": {
        "totalCnt": 0,
        "items": {
            "companyId": 1,
            "id": 1,
            "customerName": "A New Name",
            "code": null,
            "avatar": "example.com/image.jpg",
            "email": "example.gmail.com",
            "phone": "0978563258",
            "address": "TPHCM",
            "typeId": 1,
            "sizeId": 1,
            "industryId": 1,
            "website": "example.com",
            "rankId": 1,
            "industrialParkId": 1,
            "channelId": 1,
            "userInchargeId": 1,
            "taxCode": "3232676272",
            "createdBy": 3,
            "updatedBy": null,
            "createdAt": "2021-07-16T04:46:39.607Z",
            "updatedAt": {
                "val": "CURRENT_TIMESTAMP(3)"
            }
        }
    }
}
curl -X POST http://localhost:3000/customer/ei/updateInfo \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "customerName": "A New Name",
    "avatar": "example.com/image.jpg",
    "email": "example.gmail.com",
    "phone": "0978563258",
    "address": "TPHCM",
    "taxCode":"3232676272"
  }'

# GET ORDER LIST OF CUSTOMER

Sử dụng API này để lấy danh sách đơn hàng của khách hàng, khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required

# Response

{
    "status": true,
    "messageCode": "",
    "messageContent": "",
    "data": {
        "totalCnt": 1,
        "items": [
            {
                "id": 1,
                "customerId": 1,
                "name": "Đơn hàng 01",
                "phone": "0869155962",
                "email": "example@gmail.com",
                "address": "292 Ung Văn Khiêm",
                "city": "1",
                "district": "1",
                "town": "1",
                "deliveryDate": "2021-07-23T11:53:22.000Z",
                "estimatedDeliveryDate": "2021-07-23T11:53:22.000Z",
                "totalQty": 1,
                "totalPrice": 12000,
                "totalSalePrice": 13000,
                "status": 1,
                "presenter": null,
                "company_id": 0,
                "voucher_id": 0,
                "discountType": null,
                "wms": 0,
                "wms_checkout_id": 0,
                "wms_checkout_status": 0,
                "deleted": false,
                "createdBy": 1,
                "updatedBy": 1,
                "createdAt": null,
                "updatedAt": "2021-07-23T17:16:53.330Z"
            }
        ]
    }
}
curl -X POST http://localhost:3000/customer/ei/getOrderList \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{}'

# GET ORDER DETAIL OF ORDER

Sử dụng API này để lấy thông tin chi tiết đơn hàng, khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required
orderId String ✔️

# Response

{
    "status": true,
    "messageCode": "",
    "messageContent": "",
    "data": {
        "totalCnt": 1,
        "items": [
            {
                "id": 1,
                "quantity": 1,
                "price": 12000,
                "totalPrice": 12000,
                "supId": null,
                "is_receive": false,
                "status": 0,
                "deliveryDate": null,
                "checkoutId": 1,
                "productName": "productName",
                "productImg": "",
                "productModel": null,
                "productId": 1,
                "deleted": false,
                "createdBy": 1,
                "updatedBy": 1,
                "createdAt": "2021-07-23T12:35:49.000Z",
                "updatedAt": "2021-07-23T18:57:31.898Z",
                "product": {
                    "id": 1,
                    "name": "Lưỡi cưa 001",
                    "slug": null,
                    "eic": null,
                    "mpn": null,
                    "uom": null,
                    "companyId": 0,
                    "supplierId": 1,
                    "description": null,
                    "content": null,
                    "specification": null,
                    "categoryId": 1,
                    "images": null,
                    "tags": null,
                    "price": 12000,
                    "supplierPrice": 11000,
                    "promotionCode": null,
                    "warrantyZone": null,
                    "shipMethodId": 1,
                    "specialRequest": null,
                    "rate": 0,
                    "brand": null,
                    "deleted": 0,
                    "createdBy": 0,
                    "updatedBy": null,
                    "startDate": null,
                    "endDate": null,
                    "upSellId": null,
                    "groupingId": null,
                    "crossSellIds": null,
                    "productCustomIds": null,
                    "createdAt": null,
                    "updatedAt": null,
                    "supplier": {
                        "id": 1,
                        "name": "Nhà cung cấp 01",
                        "address": "291 Trường Chinh",
                        "email": "example@gmail.com",
                        "phone": 978562369,
                        "company": null,
                        "taxCode": 1258974569,
                        "code": "65468946521",
                        "shortDesc": null,
                        "desc": null,
                        "type": null,
                        "deleted": 0,
                        "status": 1,
                        "createdBy": 0,
                        "updatedBy": 0,
                        "createdAt": null,
                        "updatedAt": null
                    }
                }
            }
        ]
    }
}
curl -X POST http://localhost:3000/customer/ei/getOrderDetail \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "orderId": "1",
  }'

# Get Customer Follow Supplier

Sử dụng API này để khi Customer ấn nút theo dõi Supplier, hoặc ấn để hủy theo dõi nếu đã theo dõi trước đó. Sử dụng Khi Customer đã đăng nhập.

# Endpoint

# Parameters

Name Type Description Required
supplierId Number ✔️

# Response

{
    "status": true,
    "messageCode": "",
    "messageContent": "",
    "data": {
        "totalCnt": 1,
        "items": {
            "createdAt": {
                "val": "CURRENT_TIMESTAMP(3)"
            },
            "updatedAt": {
                "val": "CURRENT_TIMESTAMP(3)"
            },
            "deleted": false,
            "id": 17,
            "customerId": 13,
            "supplierId": 1,
            "createdBy": 13
        }
    }
}
curl -X POST http://localhost:3000/customer/ei/followSupplier \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
      "supplierId": 1
    }'

# Check If The Customer Has Followed The Supplier

Sử dụng API này để kiểm tra Customer đã theo dõi Supplier hay chưa. Sử dụng Khi Customer đã đăng nhập.

# Endpoint

# Parameters

Name Type Description Required
supplierId Number ✔️

# Response

{
    "status": true,
    "messageCode": "",
    "messageContent": "followed",
    "data": {
        "totalCnt": 0,
        "items": {
            "id": 17,
            "customerId": 13,
            "supplierId": 1,
            "createdAt": "2021-08-04T11:57:28.411Z",
            "updatedAt": "2021-08-04T11:57:28.411Z",
            "createdBy": 13,
            "updatedBy": null,
            "deleted": false
        }
    }
}
curl -X POST http://localhost:3000/customer/ei/isFollowed \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
      "supplierId": 1
    }'