Function tfgSyncFeedStatus
This function is run internally on the server by cron
(scripts/runTfgReportsSend.php, together with tfgSendToUfgApi) and is
not intended to be called by the API client. For client-side scenarios use
tfgResendReservation (manual re-send of a single reservation) or
tfgGetReportFiles (manual mode โ generate downloadable files).
Checks the asynchronous validation status of TFG feeds previously submitted through the
API channel (phase b of the TFG communication flow). For every reservation in
R2_TFG_REPORTS with LAST_CHANNEL='API' and
SEND_STATUS IN ('api-pending-1','api-pending-2') that has a
LAST_FEED_NUMBER, it logs in (POST /login โ Bearer token) and
calls GET /tfg/api/v1/pt/feeds/{feedNumber}. The returned status is mapped to
SEND_STATUS and persisted per reservation:
IN_PROCESSINGโapi-pending-2ACCEPTEDโapi-okNOT_ACCEPTED/ERRONEOUSโapi-error(withSEND_STATUS_ERRORfilled fromvalidationErrors[])
Every HTTP request to TFG (LOGIN, FEED_STATUS) is recorded as a
separate row in TFG_EXT_API_LOG (with ID_R2 for status calls).
Enable switch (required): tfg-export-mode
(API โ konfiguracja โ rezerwacje โ tfg-export-mode, read as
userDBConfig['api']['reservation']['tfg-export-mode']) must be set to
tfg-api. Values: off / manual / tfg-api.
If it is not tfg-api, the function returns immediately with
status = SKIPPED (no login, no TFG_EXT_API_LOG entries, no state changes).
This parameter is instance-wide (no branch suffix).
TFG auth (required, per branch) โ loaded from CRMParameters
(DIC_PARAMETRY, category API โ konfiguracja โ rezerwacje,
keys suffixed with :idCompany):
tfg-export-api-urlโ TFG API base URLtfg-export-user-loginโ API user logintfg-export-user-passwordโ API user passwordtfg-export-certโ client certificate, base64-encoded.p12(mTLS)tfg-export-cert-passโ certificate (key) password
url/login/password are empty the function returns
error 400003.
This function is intended to run from cron together with tfgSendToUfgApi
(sync first, then send), so that gated corrections (KOREKTA /
ROZWIAZANIE / USUNIECIE) are unblocked once a prior feed reaches
api-ok.
Arguments
- params :
array ( [ 'idCompany' ] = '' // REQUIRED, branch id (= R2.ID_FIRMY, scope) )
Returns
status-OK|FAIL|SKIPPED(whentfg-export-modeโtfg-api)idCompany- the branch id usedsummary- counters: checked, api-ok, api-error, api-pending-2, ERRORchecked- per reservation:{ idR2, feedNumber, feedStatus, sendStatus }errors- array of error records (code, message)
Example
require_once ( 'classUddsOx.php' ) ; $udds = new classUddsOx ; $udds->customerCode = [your_customerCode] ; $udds->login = [your_login] ; $udds->password = [your_password] ; $udds->serverUrl = 'http://api.dlaoperatora.pl/udds/' ; $yourParams = array(); $yourParams [ 'idCompany' ] = '21624' ; $ret = $udds->tfgSyncFeedStatus ( $yourParams ) ;
Returns $ret =
array ( 'status' => 'OK', 'idCompany' => '21624', 'summary' => array ( 'checked'=>1, 'api-ok'=>1, 'api-error'=>0, 'api-pending-2'=>0, 'ERROR'=>0 ), 'checked' => array ( array ( 'idR2'=>446, 'feedNumber'=>'N-A-2026-197', 'feedStatus'=>'ACCEPTED', 'sendStatus'=>'api-ok' ) ), 'errors' => array (), )