\DreamKas
DreamKas service interaction class
Synopsis
class DreamKas
{
- // constants
- const URL_ME = '?module=dreamkas';
- const URL_API = 'https://kabinet.dreamkas.ru/api/';
- const URL_DREAMKAS_RECEIPTS = '?module=dreamkas&getreceipts=true';
- const URL_DREAMKAS_CASHIERS = '?module=dreamkas&getcashiers=true';
- const URL_DREAMKAS_OPERATIONS = '?module=dreamkas&getoperations=true';
- const URL_DREAMKAS_GOODS = '?module=dreamkas&getgoods=true';
- const URL_DREAMKAS_CASH_MACHINES = '?module=dreamkas&getcashmachines=true';
- const URL_DREAMKAS_WEBHOOKS = '?module=dreamkas&getwebhookss=true';
- const URL_DREAMKAS_RECEIPT_DETAILS = '?module=dreamkas&getreceiptdetails=true';
- const URL_DREAMKAS_FORCE_CACHE_UPDATE = '?module=dreamkas&forcecacheupdate=true';
- const RECEIPT_FISCALIZE_TIMEOUT = '7';
- const RECEIPT_PRODUCT_TYPE = 'SERVICE';
- const RECEIPT_OPERATION_TYPE = 'SALE';
- const RECEIPT_QUANTITY_DIVIDER = '1000';
- const DREAMKAS_CACHE_KEY = 'DREAMKAS_DATA';
- const DREAMKAS_NOTYS_CAHCE_KEY = 'DREAMKAS_NOTIFICATIONS';
- // members
- protected $ubConfig = NULL;
- protected $messages = NULL;
- protected $ubCache = NULL;
- protected string $authToken = '';
- protected bool $alwaysFiscalizeAll = false;
- protected bool $defaultCashMachineID = '';
- protected bool $defaultTaxType = '';
- protected bool $notysEnabled = false;
- protected integer $notysCachingTimeout = 8;
- protected array $basicHTTPHeaders = ;
- protected array $cashMachines = ;
- protected array $cashMachines4Selector = ;
- protected array $sellPos2SrvTypeMapping = ;
- protected array $sellingPositions = ;
- protected array $sellingPositionsIDsNames = ;
- protected array $localFiscalOperations = ;
- protected array $webhooks = ;
- protected string $lastErrorMEssage = '';
- protected integer $cacheLifeTime = 1800;
- protected array $dataCahched = ;
- protected array $bs2RelationsProcessed = ;
- protected array $bs2RelationsUnProcessed = ;
- protected array $bs2RelationsUnProcFiscOpKey = ;
- protected array $paymentTypes = ;
- protected array $taxTypes = ;
- protected array $taxTypesVAT = ;
- // methods
- public void __construct()
- protected void initMessages()
- protected void loadOptions()
- public getUbMsgHelperInstance()
- public array getDataForCache()
- public void refreshCacheForced()
- protected mixed getCashiers()
- public mixed getCashMachines()
- protected mixed getFiscalOperations()
- protected array getFiscalOperationsLocal()
- public string getFiscalOperationLocalBody()
- public false|string getFiscalOperationLocalData()
- public void incrFiscalOperationRepeatsCount()
- public string getLastErrorMessage()
- public mixed getSellingPositions()
- protected mixed getReceipts()
- public mixed getReceiptDetails()
- protected string getUBSerial()
- protected void getWebHooks()
- protected mixed getSelectorWebControl()
- public string getTaxTypesVATSelector()
- protected array getCashMachines4Selector()
- protected array getSellPosIDsNames()
- protected void getSellPos2SrvTypeMapping()
- public int|mixed getBS2RecIDbyFiscOpID()
- protected void getBS2RelationsProcessed()
- protected void getBS2RelationsUnProcessed()
- protected void setBS2Relations()
- public mixed getUKVUserData()
- public string getInetUserMobile()
- public string getInetUserEmail()
- protected int|string checkSellPosIsMapped2SrvType()
- public string setSellingPositionSrvType()
- public void delSellingPositionSrvType()
- protected string errorToString()
- public string/JSON prepareCheckFiscalData()
- public void fiscalizeCheck()
- protected void updateFiscalOperationsLocalStorage()
- public string get_BS2FiscalizePaymentCtrlsJS()
- public void putNotificationData2Cache()
- public string web_FiscalizePaymentCtrls()
- public string web_ReceiptDetailsTableRow()
- public void web_FiscalOperationDetailsTableRow()
- public string web_MainButtonsControls()
- public string web_FiscalOperationsFilter()
- public string web_ReceiptsFilter()
- public void web_WebhooksForm()
- public void renderCashiersListJSON()
- public string renderCashiersJQDT()
- public void renderCashMachinesListJSON()
- public string renderCashMachinesJQDT()
- public void renderSellPositionsListJSON()
- public string renderSellPositionsJQDT()
- public void renderFiscalOperationsListJSON()
- public string renderFiscalOperationsJQDT()
- public void renderReceiptsListJSON()
- public string renderReceiptsJQDT()
- public void renderWebhooksListJSON()
- public void renderWebhooksJQDT()
- public void renderWebhookAddForm()
- public void renderWebhookEditForm()
- public void createeditdeleteWebhook()
- public void processWebhookRequest()
- protected void processWebhookChange()
Constants
Name | Value |
---|---|
URL_ME | '?module=dreamkas' |
URL_API | 'https://kabinet.dreamkas.ru/api/' |
URL_DREAMKAS_RECEIPTS | '?module=dreamkas&getreceipts=true' |
URL_DREAMKAS_CASHIERS | '?module=dreamkas&getcashiers=true' |
URL_DREAMKAS_OPERATIONS | '?module=dreamkas&getoperations=true' |
URL_DREAMKAS_GOODS | '?module=dreamkas&getgoods=true' |
URL_DREAMKAS_CASH_MACHINES | '?module=dreamkas&getcashmachines=true' |
URL_DREAMKAS_WEBHOOKS | '?module=dreamkas&getwebhookss=true' |
URL_DREAMKAS_RECEIPT_DETAILS | '?module=dreamkas&getreceiptdetails=true' |
URL_DREAMKAS_FORCE_CACHE_UPDATE | '?module=dreamkas&forcecacheupdate=true' |
RECEIPT_FISCALIZE_TIMEOUT | '7' |
RECEIPT_PRODUCT_TYPE | 'SERVICE' |
RECEIPT_OPERATION_TYPE | 'SALE' |
RECEIPT_QUANTITY_DIVIDER | '1000' |
DREAMKAS_CACHE_KEY | 'DREAMKAS_DATA' |
DREAMKAS_NOTYS_CAHCE_KEY | 'DREAMKAS_NOTIFICATIONS' |
Members
protected
- $alwaysFiscalizeAll
—
bool
Placeholder for DREAMKAS_ALWAYS_FISCALIZE_ALL alter.ini option - $authToken
—
string
Dreamkas auth token placeholder - $basicHTTPHeaders
—
array
Plcaeholder for basic and common HTTP headers for Dreamkas connecting and authenticating - $bs2RelationsProcessed
—
array
Dreamkas to Banksta2 processed relations data with receipts IDs already - $bs2RelationsUnProcFiscOpKey
—
array
Dreamkas to Banksta2 relations data with fiscal operation ID as a key and without receipts IDs yet - $bs2RelationsUnProcessed
—
array
Dreamkas to Banksta2 unprocessed relations data without receipts IDs yet - $cacheLifeTime
—
int
Placeholder for DREAMKAS_CACHE_LIFETIME from alter.ini - $cashMachines
—
array
Placeholder for all cash machines - $cashMachines4Selector
—
array
Array containing cash machines IDs => IDs + Names. E.g for selector controls - $dataCahched
—
array
$dataCahched array from UbillingCache - $defaultCashMachineID
—
bool
Placeholder for DREAMKAS_DEFAULT_CASH_MACHINE_ID alter.ini option - $defaultTaxType
—
bool
Placeholder for DREAMKAS_DEFAULT_TAX_TYPE alter.ini option - $lastErrorMEssage
—
string
Contains last error message string - $localFiscalOperations
—
array
Array containing fiscal operations initiated and stored locally - $messages
—
null
System message helper object placeholder - $notysCachingTimeout
—
int
Caching timeout based on polling interval in seconds. - $notysEnabled
—
bool
Placeholder for DREAMKAS_NOTIFICATIONS_ENABLED alter.ini option - $paymentTypes
—
array
Placeholder for payment types supported by Dreamkas API - $sellPos2SrvTypeMapping
—
array
Placeholder for selling positions to services relations to be able to distinguish UKV/Inet services when preforming check fiscalization - $sellingPositions
—
array
Placeholder for all selling positions - $sellingPositionsIDsNames
—
array
Array containing selling positions IDs => Names. E.g for selector controls - $taxTypes
—
array
Placeholder for taxation systems supported by Dreamkas API - $taxTypesVAT
—
array
Placeholder for VAT(НДС) types supported by Dreamkas API - $ubCache
—
null
UbillingCache instance placeholder - $ubConfig
—
null
UbillingConfig object placeholder - $webhooks
—
array
Placeholder for all registered webhooks
Methods
protected
- checkSellPosIsMapped2SrvType() — Checks if sell position is mapped to some or certain service already
- errorToString() — Converts Dreamkas server error message to string for logging and debugging
- getBS2RelationsProcessed() — Fills $this->bs2RelationsProcessed placeholder with data
- getBS2RelationsUnProcessed() — Fills $this->bs2RelationsUnProcessed placeholder with data
- getCashMachines4Selector() — Fills up $this->cashMachines4Selector array for further use
- getCashiers() — Returns cashiers array via Dreamkas API
- getFiscalOperations() — Returns fiscal operations array via Dreamkas API
- getFiscalOperationsLocal() — Fills $this->localFiscalOperations with fiscal operations initiated and stored locally
- getReceipts() — Returns receipts array via Dreamkas API
- getSelectorWebControl() — Returns an HTML-code string containing selector control
- getSellPos2SrvTypeMapping() — Fills up $this->sellPos2SrvTypeMapping array with services to selling positions mapping
- getSellPosIDsNames() — Fills up $this->sellingPositionsIDsNames array for further use
- getUBSerial() — gets ubilling system key into private key prop
- getWebHooks()
- initMessages() — Inits message helper object for further usage
- loadOptions() — Getting an alter.ini options
- processWebhookChange()
- setBS2Relations() — Just inserts a new relational record if a fiscal operation from Banksta2 was made
- updateFiscalOperationsLocalStorage()
public
- __construct()
- createeditdeleteWebhook()
- delSellingPositionSrvType() — Deletes certain selling position to service mapping
- fiscalizeCheck() — Check fiscalizing routine
- getBS2RecIDbyFiscOpID() — Returns Banksta2 record ID from `dreamkas_banksta2_relations` table, if exists
- getCashMachines() — Returns cash machines array via Dreamkas API
- getDataForCache() — Returns essential data suitable for caching
- getFiscalOperationLocalBody() — Returns the actual query body of fiscal operation
- getFiscalOperationLocalData() — Returns the all actual data of fiscal operation
- getInetUserEmail() — To full fill avidity and greed
- getInetUserMobile() — To full fill avidity and greed
- getLastErrorMessage() — Returns last error message
- getReceiptDetails() — Returns receipt detail info array via Dreamkas API
- getSellingPositions() — Returns selling positions array via Dreamkas API
- getTaxTypesVATSelector() — Returns an HTML-code string containing selector control
- getUKVUserData() — To full fill avidity and greed
- getUbMsgHelperInstance() — Returns reference to UbillingMessageHelper object
- get_BS2FiscalizePaymentCtrlsJS() — Returns a special JS function for controls processing on banksta2 payments processing table
- incrFiscalOperationRepeatsCount() — Simply increments fiscal operation repeats counter
- prepareCheckFiscalData() — Check fiscalize preparation routine
- processWebhookRequest()
- putNotificationData2Cache() — Pushes notifications data to cash for further usage
- refreshCacheForced() — Forcibly updates cached data
- renderCashMachinesJQDT() — JQDT for cash machines list form
- renderCashMachinesListJSON() — JSON for cash machines JQDT
- renderCashiersJQDT() — JQDT for cashiers list form
- renderCashiersListJSON() — JSON for cashiers JQDT
- renderFiscalOperationsJQDT() — JQDT for fiscal operations list form
- renderFiscalOperationsListJSON() — JSON for fiscal operations JQDT
- renderReceiptsJQDT() — JQDT for receipts list form
- renderReceiptsListJSON() — JSON for receipts JQDT
- renderSellPositionsJQDT() — JQDT for selling positions list form
- renderSellPositionsListJSON() — JSON for selling positions JQDT
- renderWebhookAddForm()
- renderWebhookEditForm()
- renderWebhooksJQDT()
- renderWebhooksListJSON()
- setSellingPositionSrvType() — Maps certain selling position to certain service(Inet or UKV)
- web_FiscalOperationDetailsTableRow()
- web_FiscalOperationsFilter() — Returns a companion to fiscal operation form HTML form for fiscal operation data filtering
- web_FiscalizePaymentCtrls() — Returns an HTML form for payment fiscalizing for integration as addition to payment forms
- web_MainButtonsControls() — Returns main buttons controls for Dreamkas
- web_ReceiptDetailsTableRow() — Returns table row with payment fiscal data
- web_ReceiptsFilter() — Returns a companion to receipts form HTML form for receipts data filtering
- web_WebhooksForm()