Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| moneyworks:billig_shipping_script [2026/02/18 17:15] – [Script Logic and Steps] Martin Falconer | moneyworks:billig_shipping_script [2026/02/18 18:59] (current) – Martin Falconer | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| - | The Billig shipping script, named ' | + | The Billig shipping script, named ' |
| - | It runs as a MW script and uses CURL to send shipping orders over tcp/http. It is triggered by selecting Sales Invoices and pressing the " | + | It runs as a MW script and uses CURL to send shipping orders over tcp/http. It is triggered by selecting Sales Invoices and pressing the " |
| ====== Technical documentation ====== | ====== Technical documentation ====== | ||
| Line 14: | Line 15: | ||
| * **Validates Delivery Addresses: | * **Validates Delivery Addresses: | ||
| * **Validates Country 2 Char representation: | * **Validates Country 2 Char representation: | ||
| + | |||
| + | ===== Missing features: ===== | ||
| + | |||
| + | * Unable to resend if send failure. | ||
| + | * No local record of sent orders (with MW SQLite, this could be done. Again, script is pretty busy already) | ||
| + | * If when adding a Sales Line to Sales Header fails.... no resend available as per above. Just gets left off order (has only happened a few times) | ||
| + | * UI feedback while working. Bit of a limitation of long running MW script. (Only recommend sending max of 10 Sales Invoices) | ||
| ===== BILLIG API Information: | ===== BILLIG API Information: | ||
| - | **API is locked down by IPs.** The available IPs are Martin' | + | **API is locked down by IPs.** The available IPs are Martin' |
| + | API looks like it is maintained by prentow.com (Contacts not added here as public page) | ||
| ==== Test Site Enpoints ==== | ==== Test Site Enpoints ==== | ||
| Line 46: | Line 55: | ||
| * A Sales Header is created using the Sales Header endpoint | * A Sales Header is created using the Sales Header endpoint | ||
| * Individual lines are added to Sales Header using the Lines Header endpoint | * Individual lines are added to Sales Header using the Lines Header endpoint | ||
| + | |||
| + | |||
| + | === Sales Header Fields (text from script) === | ||
| + | |||
| + | Document_No = " | ||
| + | External_Docuement_No = " | ||
| + | shippingCodeLines = See below how shippingCodeLines are calculated\\ | ||
| + | |||
| + | let pdata = " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + shippingCodeLines | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + "\n} | ||
| + | | ||
| + | === Sales Line Fields (text from script) === | ||
| + | |||
| + | Document_No = " | ||
| + | Line_No = sequential integer number. 1, 2, 3, etc...\\ | ||
| + | |||
| + | let pdata = " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | let pdata = pdata + " | ||
| + | | ||
| + | === Shipping Code Lines === | ||
| + | |||
| + | A few shipping codes are sent in the Sales Header. | ||
| + | * " | ||
| + | * " | ||
| + | |||
| + | The logic depends (as of today, 17th Feb 2026): | ||
| + | |||
| + | * If internal order is for customer " | ||
| + | * " | ||
| + | * " | ||
| + | * If destination country " | ||
| + | * " | ||
| + | * " | ||
| + | * If destination country " | ||
| + | * " | ||
| + | * " | ||
| + | * If destination country is none of the above, and not " | ||
| + | * " | ||
| + | * " | ||
| ==== Entry point: ==== | ==== Entry point: ==== | ||
| Line 72: | Line 138: | ||
| * Check order doesn' | * Check order doesn' | ||
| * Create Sales Header | * Create Sales Header | ||
| - | * Add lines to Sales Header | + | * Add lines to Sales Header, one by one |
| | | ||
