Function tfgResendReservation
Manually re-sends a single reservation to TFG through the API channel โ meant to be
triggered from the application by an operator (e.g. after a connection error or an unclear feed
state). Unlike the cron function tfgSendToUfgApi, this endpoint does not apply the
prior-status gating (isGatedByPriorStatus): it is a deliberate single action and
the correct operation ordering is validated by TFG itself.
Flow:
- Phase A (verify): if the reservation already has a
LAST_FEED_NUMBERand a non-finalSEND_STATUS(api-pending-1/api-pending-2/api-error), it callsGET /tfg/api/v1/pt/feeds/{feedNumber}and refreshes the local state (this alone may resolve the case โ e.g. TFG had actually accepted the feed despite our timeout โapi-ok). - Phase B (act):
resolveOperationon the refreshed state โNOWEDANE/KOREKTA/ROZWIAZANIEโPOST /tfg/api/v1/pt/feeds(1 contract). If the resolver returnsPOMINthere is nothing new to send (e.g. a correction was rejected asynchronously โ the operator must fix the reservation data, which creates a new snapshot, before a resend makes sense).
Every HTTP request to TFG (LOGIN, FEED_STATUS, FEED_SEND) is
recorded as a separate row in TFG_EXT_API_LOG (with ID_R2). The action
is also logged to TFG_REPORTS_HISTORY with TYP='RESEND_API'.
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. 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.
Arguments
- params :
array ( [ 'idCompany' ] = '' // REQUIRED, branch id (= R2.ID_FIRMY, scope) [ 'idReservation' ] = 0 // single ID_R2 (this OR webId is required) [ 'webId' ] = '' // single R2.WEB_ID )
Returns
status-OK|PARTIAL|FAIL|VERIFIED(only phase A ran, nothing to send) |SKIPPED(whentfg-export-modeโtfg-api) |OUT_OF_SCOPE(reservation outside TFG reporting scope)idCompany/idR2- the branch and reservation usedverified- phase A result{ feedNumber, feedStatus, sendStatus }ornullresent- phase B result{ operacja, feedNumber, status, sendStatus, idExtApiLog }ornullerrors- 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' ; $yourParams [ 'idReservation' ] = 446 ; $ret = $udds->tfgResendReservation ( $yourParams ) ;
Returns $ret =
array ( 'status' => 'OK', 'idCompany' => '21624', 'idR2' => 446, 'verified' => array ( 'feedNumber'=>'N-A-2026-197', 'feedStatus'=>'ERRONEOUS', 'sendStatus'=>'api-error' ), 'resent' => array ( 'operacja'=>'KOREKTA', 'feedNumber'=>'K-A-2026-231', 'status'=>'ACCEPTED', 'sendStatus'=>'api-pending-1', 'idExtApiLog'=>1284 ), 'errors' => array (), )