Files
worker/docs/order.sh
Phuoc Nguyen 4913a4e04b create order
2025-11-21 16:50:43 +07:00

90 lines
3.6 KiB
Bash

#Get list of order status
curl --location --request POST 'https://land.dbiz.com//api/method/building_material.building_material.api.sales_order.get_order_status_list' \
--header 'Cookie: sid=a98c0b426abd8af3b0fd92407ef96937acda888a9a63bf3c580447d4; full_name=Hsadqdqwed; sid=42d89a7465571e04e0ee47a5bb1dd73563ff4f30ef9f7370ed490275; system_user=no; user_id=123%40gmail.com; user_image=/files/avatar_0987654321_1763631288.jpg' \
--header 'X-Frappe-Csrf-Token: a2bc5e9342441ff895ad2781e99a4c3fae4cad1250ae40c51f90067a' \
--header 'Content-Type: application/json' \
--data ''
#Response list of order status
{
"message": [
{
"status": "Pending approval",
"label": "Chờ phê duyệt",
"color": "Warning",
"index": 1
},
{
"status": "Processing",
"label": "Đang xử lý",
"color": "Warning",
"index": 2
},
{
"status": "Completed",
"label": "Hoàn thành",
"color": "Success",
"index": 3
},
{
"status": "Rejected",
"label": "Từ chối",
"color": "Danger",
"index": 4
},
{
"status": "Cancelled",
"label": "HỦY BỎ",
"color": "Danger",
"index": 5
}
]
}
#get payment list
curl --location 'https://land.dbiz.com//api/method/frappe.client.get_list' \
--header 'X-Frappe-Csrf-Token: a2bc5e9342441ff895ad2781e99a4c3fae4cad1250ae40c51f90067a' \
--header 'Cookie: sid=a98c0b426abd8af3b0fd92407ef96937acda888a9a63bf3c580447d4; full_name=phuoc; sid=a98c0b426abd8af3b0fd92407ef96937acda888a9a63bf3c580447d4; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
--header 'Content-Type: application/json' \
--data '{
"doctype": "Payment Terms Template",
"fields": ["name","custom_description"],
"limit_page_length": 0
}'
#response payment list
{
"message": [
{
"name": "Thanh toán hoàn toàn",
"custom_description": "Thanh toán ngay được chiết khấu 2%"
},
{
"name": "Thanh toán trả trước",
"custom_description": "Trả trước (≥20%), còn lại thanh toán trong vòng 30 ngày"
}
]
}
#create order
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.sales_order.save' \
--header 'Cookie: sid=a98c0b426abd8af3b0fd92407ef96937acda888a9a63bf3c580447d4; full_name=phuoc; sid=c0f46dc2ed23d58c013daa7d1813b36caf04555472b792cdb74e0d61; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
--header 'X-Frappe-Csrf-Token: a2bc5e9342441ff895ad2781e99a4c3fae4cad1250ae40c51f90067a' \
--header 'Content-Type: application/json' \
--data '{
"transaction_date": "2025-11-20", // Ngày tạo
"delivery_date": "2025-11-20", // Ngày dự kiến giao
"shipping_address_name": "Lam Address-Billing",
"customer_address": "Lam Address-Billing",
"description": "Order description", // Ghi chú
"payment_terms" : "Thanh toán hoàn toàn", // Lấy name từ GET PAYMENT TERM
"items": [
{
"item_id": "HOA E02",
"qty_entered": 2, // SỐ lượng User tự nhập
"primary_qty" : 2.56, // SỐ lượng sau khi quy đổi
"price_entered": 10000 // Đơn giá
}
]
}'