fix: auth e integración cloud correcta desde código real de sigmac_app

auth_service.dart:
- URL corregida: https://api.siax-system.net (no la IP interna)
- Campo contraseña corregido: paswd (no password)
- Eliminado paso empresas innecesario — login directo igual que sigmac_app
- Sesión guardada en SharedPreferences con mismas claves que sigmac_app
- AuthSession.fromMap idéntico al de CentralCloudApi.AuthSession

cloud_sync_service.dart (nuevo):
- Base URL: https://api-gateway-cloud.telcotronics.net
- Solo x-api-key en headers (NO Bearer JWT) — igual que GatewayCloudApi
- Items: GET /api/items/sync con paginación por offset
- Clientes: GET /api/clientes/verClientesJsonApp
- Campos reales: codigo_prdcto, detalle_prdcto, client_rucCed, etc.

app_provider.dart:
- login() llama AuthService.login() con la firma correcta
- Después de auth exitosa sincroniza items y clientes del cloud
- Preserva precios locales en upsert de productos (API no devuelve precios)
- Fallback offline mantiene credenciales SQLite locales
- logout() borra SharedPreferences

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Pablinux
2026-06-14 09:37:50 -05:00
co-authored by Claude Sonnet 4.6
parent 40c6f71caa
commit 0c09e10e4d
7 changed files with 493 additions and 133 deletions
+119 -2
View File
@@ -92,6 +92,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
@@ -116,6 +123,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: "direct main"
description:
@@ -150,7 +162,7 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.5"
version: "0.6.4"
lints:
dependency: transitive
description:
@@ -200,6 +212,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.7"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
petitparser:
dependency: transitive
description:
@@ -207,6 +240,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
pointycastle:
dependency: transitive
description:
@@ -214,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.7.3"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
provider:
dependency: "direct main"
description:
@@ -221,6 +275,55 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.5+1"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.17"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.15"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
@@ -317,6 +420,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.2"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+3"
xml:
dependency: transitive
description:
@@ -333,4 +450,4 @@ packages:
version: "3.1.1"
sdks:
dart: ">=2.17.0-69.2.beta <3.0.0"
flutter: ">=1.16.0"
flutter: ">=2.10.0"