FoxPost COD settlement — endpoints, storage, rights

The FoxPost endpoints, the client’s own credentials, the settlement table, invoice linking, the bulk query and permissions.

The FoxPost cash-on-delivery settlement is handled in the bank import module. It calls the foxpost library with the client's own FoxPost credentials, saves the result to a settlement table and links it to invoices (bank/foxpost model).

Endpoints

EndpointBehaviour
foxposttestconnection test (number of rows in the last 7 days)
foxpostfetchfetch the COD settlement for a period, save it and link invoices
foxpostcsvCSV import; the library's normaliser processes the file
foxpostaccount, foxpostaccountsaveload and save the client's FoxPost account; saving also assigns the Drive “foxpost” company folder (system/emailtask::addCompanyFolder)
foxpostqueryallruns for every active FoxPost account in scope (or the filtered client); summary and failure reasons — called by the invoice list's “FoxPost query” button

Data model

Table names carry the installation's own prefix in the database: foxpost (client account: API key or basic user), cod_settlement (settlement rows with invoice link). A global setting can be used if the client has no account.

Checks

  • Client > 0 and within content scope (getAllowedCompanyIds); library configured (error_fox_not_configured); dates or CSV required (error_fox_input, error_fox_csv); for the bulk query without accounts error_fox_no_accounts.
  • Step B of the recognition engine uses the FoxPost settlement for suggestions (“collected − fee = transfer”).

Permissions

  • The FoxPost endpoints check the bank/bankimport::run key together with core modify; foxposttest and foxpostaccount check only the function right.
  • The invoice list's “FoxPost query” button also shows on the bank/bankimport::run key (the controller never checks finance/invoice::run).