Skip to main content

Create new Transfer Order

Use this api to create multiple tf at one.

Flow: When call the api, tf service will create new tf order in the service db.
Then, the tf service will create jobs that sync tf order to ax.
After sync ax success, tf service will call a shipper from delivery service.

URL : /api/create-transfer-order

Method : POST

Validate Rule

"list.*.order_number" => ['required', 'string'],
"list.*.employee_id" => ['required', 'string'],
"list.*.from_warehouse" => ['required', 'string'],
"list.*.to_warehouse" => ['required', 'string'],
"list.*.distance" => ['nullable', 'numeric'],
"list.*.description" => ['nullable', 'string'],
"list.*.items" => ['required', 'array'],
"list.*.items.*.sku" => ['required', 'string'],
"list.*.items.*.unit" => ['required', 'string'],
"list.*.items.*.price" => ['required', 'integer'],
"list.*.items.*.quantity" => ['required', 'integer'],
"sync_ax" =>['nullable', 'boolean'],
"source" =>['nullable', 'string'],

Input

{
"source": "EMS",
"sync_ax": null,
"list": [
{
"order_number": "12312111",
"employee_id": "800756",
"from_warehouse": "HLC",
"to_warehouse": "LVS",
"description": "abc",
"distance": 1.56,
"items": [
{
"sku": "P00001",
"unit": "Hop",
"quantity": 2,
"price": 5000
},
{
"sku": "P00008",
"unit": "Hop",
"quantity": 1,
"price": 12000
}
]
}
]
}

The api can create multiple transfer at once, depending on how many items are in the list of params

Success Response

Code : 200 OK

Content example

{
"success": true,
"errors": null,
"errorCode": null,
"data": [
{
"order_number": "12312111",
"transfer_id": null,
"tf_request_id": "TFRQ35406",
"from_warehouse": "HLC",
"to_warehouse": "LVS",
"distance": 1.56,
"description": "abc",
"employee_name": "Hua Thanh Vinh",
"employee_id": "800756",
"receipt_date": null,
"ship_date": null,
"ops_note": null,
"source": "EMS",
"transfer_status": null,
"sync_ax_status": 0,
"created_at": "2023-05-31T04:13:11.000000Z"
}
]
}

Error Response

Code : 400 BAD REQUEST

Content :

{
"success": false,
"errors": {
"list.0.items.0.unit": [
"The list.0.items.0.unit field is required."
]
},
"errorCode": "INVALID_INPUT",
"data": null
}