Phase 2 implementation: VFP Integration with Oracle synchronization
Major architectural changes: - Convert Oracle IMPORT_PARTENERI.cauta_sau_creeaza_partener from FUNCTION to PROCEDURE with OUT parameter for VFP compatibility - Add IS_PERSOANA_JURIDICA parameter to support individual vs company detection - Implement sync-comenzi-web.prg orchestrator for generic web order processing with 5-minute timer automation - Create ApplicationSetup class for proper object-oriented configuration management - Add comprehensive Oracle connection and sync settings via settings.ini configuration system - Implement generic web order processing functions (ProcessWebOrder, ValidateWebOrder, CleanWebText, ConvertWebDate) - Add proper VFP-Oracle integration with correct procedure call syntax using OUT parameters - Rename gomag-vending.prg to gomag-adapter.prg for clarity and platform-specific functionality - Move CheckIniFile function to utils.prg for better code organization - Add settings.ini.example template and update .gitignore to exclude actual settings files - Implement comprehensive logging system with rotation and error handling - Add connection validation and retry logic for robust Oracle integration Technical improvements: - Proper JSON processing integration with existing nfjson library - Comprehensive error handling with categorized logging (INFO, ERROR, WARN) - Timer-based automation with configurable intervals - Settings validation and default value creation - Generic function naming for multi-platform support - Class-based setup system replacing procedural approach 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
*-- utils.prg - Utilitare pentru GoMag API
|
||||
*-- Functii pentru citirea/scrierea fisierelor INI si alte utilitare
|
||||
*-- utils.prg - Functii utilitare generale
|
||||
*-- Contine doar functii utilitare reutilizabile (INI, HTTP, logging, encoding)
|
||||
*-- Autor: Claude AI
|
||||
*-- Data: 27.08.2025
|
||||
*-- Data: 10 septembrie 2025
|
||||
|
||||
*-- Functie pentru citirea fisierelor INI private
|
||||
*-- Returneaza valoarea din sectiunea si intrarea specificata sau blank daca nu e gasita
|
||||
@@ -51,34 +51,6 @@ nRetVal = WritePrivateProfileString(cSection, ;
|
||||
RETURN nRetVal = 1
|
||||
ENDFUNC
|
||||
|
||||
*-- Functie pentru incarcarea tuturor setarilor din fisierul INI
|
||||
FUNCTION LoadSettings
|
||||
PARAMETERS cINIFile
|
||||
LOCAL loSettings
|
||||
|
||||
*-- Cream un obiect pentru toate setarile
|
||||
loSettings = CREATEOBJECT("Empty")
|
||||
|
||||
*-- Sectiunea API
|
||||
ADDPROPERTY(loSettings, "ApiBaseUrl", ReadPini("API", "ApiBaseUrl", cINIFile))
|
||||
ADDPROPERTY(loSettings, "OrderApiUrl", ReadPini("API", "OrderApiUrl", cINIFile))
|
||||
ADDPROPERTY(loSettings, "ApiKey", ReadPini("API", "ApiKey", cINIFile))
|
||||
ADDPROPERTY(loSettings, "ApiShop", ReadPini("API", "ApiShop", cINIFile))
|
||||
ADDPROPERTY(loSettings, "UserAgent", ReadPini("API", "UserAgent", cINIFile))
|
||||
ADDPROPERTY(loSettings, "ContentType", ReadPini("API", "ContentType", cINIFile))
|
||||
|
||||
*-- Sectiunea PAGINATION
|
||||
ADDPROPERTY(loSettings, "Limit", VAL(ReadPini("PAGINATION", "Limit", cINIFile)))
|
||||
|
||||
*-- Sectiunea OPTIONS
|
||||
ADDPROPERTY(loSettings, "GetProducts", ReadPini("OPTIONS", "GetProducts", cINIFile) = "1")
|
||||
ADDPROPERTY(loSettings, "GetOrders", ReadPini("OPTIONS", "GetOrders", cINIFile) = "1")
|
||||
|
||||
*-- Sectiunea FILTERS
|
||||
ADDPROPERTY(loSettings, "OrderDaysBack", VAL(ReadPini("FILTERS", "OrderDaysBack", cINIFile)))
|
||||
|
||||
RETURN loSettings
|
||||
ENDFUNC
|
||||
|
||||
*-- Test conectivitate internet
|
||||
FUNCTION TestConnectivity
|
||||
@@ -140,39 +112,6 @@ ENDTRY
|
||||
RETURN llExists
|
||||
ENDFUNC
|
||||
|
||||
*-- Functie pentru crearea unui fisier INI implicit cu setari de baza
|
||||
FUNCTION CreateDefaultIni
|
||||
PARAMETERS cINIFile
|
||||
LOCAL llSuccess
|
||||
|
||||
llSuccess = .T.
|
||||
|
||||
TRY
|
||||
*-- Sectiunea API
|
||||
WritePini("API", "ApiBaseUrl", "https://api.gomag.ro/api/v1/product/read/json?enabled=1", cINIFile)
|
||||
WritePini("API", "OrderApiUrl", "https://api.gomag.ro/api/v1/order/read/json", cINIFile)
|
||||
WritePini("API", "ApiKey", "YOUR_API_KEY_HERE", cINIFile)
|
||||
WritePini("API", "ApiShop", "https://yourstore.gomag.ro", cINIFile)
|
||||
WritePini("API", "UserAgent", "Mozilla/5.0", cINIFile)
|
||||
WritePini("API", "ContentType", "application/json", cINIFile)
|
||||
|
||||
*-- Sectiunea PAGINATION
|
||||
WritePini("PAGINATION", "Limit", "100", cINIFile)
|
||||
|
||||
*-- Sectiunea OPTIONS
|
||||
WritePini("OPTIONS", "GetProducts", "1", cINIFile)
|
||||
WritePini("OPTIONS", "GetOrders", "1", cINIFile)
|
||||
|
||||
*-- Sectiunea FILTERS
|
||||
WritePini("FILTERS", "OrderDaysBack", "7", cINIFile)
|
||||
|
||||
CATCH
|
||||
llSuccess = .F.
|
||||
ENDTRY
|
||||
|
||||
RETURN llSuccess
|
||||
ENDFUNC
|
||||
|
||||
*-- Functie pentru initializarea logging-ului
|
||||
FUNCTION InitLog
|
||||
PARAMETERS cBaseName
|
||||
|
||||
Reference in New Issue
Block a user