Commit 173f8f39 authored by Jose Hugo Torres's avatar Jose Hugo Torres
Browse files

Unificacion modificaciones proyecto alterno

parent 7133ae94
...@@ -40,8 +40,8 @@ namespace SCOGateway.POSGkPruebas ...@@ -40,8 +40,8 @@ namespace SCOGateway.POSGkPruebas
Log.Debug($"GkPruebas: Autenticate - POST - response {autenticacionResp}"); Log.Debug($"GkPruebas: Autenticate - POST - response {autenticacionResp}");
// Salvar el token de autenticación y demás datos. // Salvar el token de autenticación y demás datos.
Entorno<EntornoGK>.Instancia.getDatos().RealmId = autenticacionResp.RealmId; //Entorno<EntornoGK>.Instancia.getDatos().RealmId = autenticacionResp.RealmId;
Entorno<EntornoGK>.Instancia.getDatos().ExpirationCountDays = autenticacionResp.ExpirationCountDays; //Entorno<EntornoGK>.Instancia.getDatos().ExpirationCountDays = autenticacionResp.ExpirationCountDays;
// Respuestas a SCO. // Respuestas a SCO.
var posbcStatus1 = new POSBCStatusEvent(1, TipoMensaje.Event, "INFO", "CONNECTING_TO_POS", "Connecting to POS system"); var posbcStatus1 = new POSBCStatusEvent(1, TipoMensaje.Event, "INFO", "CONNECTING_TO_POS", "Connecting to POS system");
......
using EvaPOS_API_FRAME.DTO.Intercambio;
using EvaPOS_API_FRAME.DTO;
using EvaPOS_API_FRAME.RespuestasXML;
using EvaPosSrvDTO;
using EvaPosSrvResp;
using Serilog;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SCOGateway.POSGk;
using RestSharp;
using gatewayGK.POSGk;
using System.Text.Json;
using Newtonsoft.Json.Linq;
using System.Transactions;
using GatewaySCO;
namespace gatewayGK.ComandosGk
{
///<summary>
/// Procesa solicitudes del primer item agregado.
/// </summary>
// TODO - unificar uso de libreria json: using System.Text.Json OR using Newtonsoft.Json.Linq;
//
public class AddItemRequestCmdGk : IComando
{
public string Referencia { get; set; } = "scsns:AddItem";
/// <summary>
/// DTO con solicitud.
/// </summary>
public AddItemRequest Request { get; private set; }
/// <summary>
/// Procesa y responde ReportStatusEventsRequest.
/// </summary>
///
public const string UrlRegisterItem = ConstantesGK.UrlBaseMaquetaProd + "/com.gk_software.pos.api.service.transaction.LineItemService/registerLineItem";
/// <summary>
/// Procesa y responde el login.
/// </summary>
public Respuestas Ejecutar()
{
Log.Debug("Cmd AddItemRequestDTO ejecutado. AddItemRequest : {AddItemRequest}", Request.RequestID);
//int requestIdGuardado = RequestIdGuardado();
POSBCStatusEvent posbcStatus = null;
TransactionStatusEvent transactionStatusEvent = null;
POSReceiptEventHeaderResponse posReceiptEventHeader = null;
POSReceiptEvent pOSReceiptEvent = null;
TotalsEventResponse totalEvent = null;
AddItemResponse itemResponse = null;
//Variables para manejar las respuestas de error - (item con peso, no se encuentra el item,item requiere cantidad)
AddItemResponseError addItemResponseError = null;
Respuestas respuesta = null;
Venta venta = null;
//Variables del adaptador de entrada - addItem
int requestId = Request.RequestID;
long barCode = 0;
int quantity = Request.ItemIdentifier.Quantity == 0 ? 1 : Request.ItemIdentifier.Quantity;
bool cancelItem = Request.ItemIdentifier.VoidFlag;
double peso = Request.ItemIdentifier.ScaleWeight;
//Logica para validar el valor del codigo de barras
//Si es un item de busqueda o imagen, trae el valor KeyedItemID, si es escaneado trae barcode
if (Request.ItemIdentifier.BarCode != null)
barCode = Request.ItemIdentifier.BarCode.ScanDataLabel;
else
barCode = Request.ItemIdentifier.KeyedItemID;
// Contactar Smart POS Gk.
var options = new RestClientOptions(UrlRegisterItem)
{
MaxTimeout = -1,
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
};
var client = new RestClient(options);
var request = new RestRequest(UrlRegisterItem, Method.Post);
request.AddHeader("Accept", "application/json;Format=GK-PLAIN-JSON");
request.AddHeader("Content-Type", "application/json;Format=GK-PLAIN-JSON");
request.AddHeader("_pos_session_", "189b387ad72170063af530dfe4a29c9ae.1004");
request.AddHeader("Cookie", "sessionid=189b387ad72170063af530dfe4a29c9ae.1004; JSESSIONID=AAA543995E1D10B532197B96F0F107D7");
var datosItem = new AddItemRequ
{
operationConfiguration = new OperationConfiguration
{
forceQuantityInput = false,
pricePositionLimit = 10000,
pricePositionZeroAllowed = true,
priceTransactionLimit = -1,
priceDifferencePercentPositionLimit = 100,
priceDifferenceAbsolutePositionLimit = 999999,
priceDifferenceLimitExceedAction = "Warn",
priceNegDifferenceLimitExceedAction = "Warn",
closeCurrent = "Required",
closePrevious = "Required",
filterResult = true,
allowedWithWeight = true,
allowedWithLength = true,
allowedWithArea = true,
allowedWithVolume = true,
allowedWithMeasure = true,
maximumQuantity = 999999,
minimumQuantity = 1,
quantityInputOrder = "BeforeOrAfter",
priceInputOrder = "BeforeOrAfter",
quantityLimitExceedAction = "Warn",
amountLimitExceedAction = "Warn",
weightUnitFactor = 0,
measureUnitFactor = 0,
priceDeviationType = "All",
priceNegDeviationType = "All",
xXCustom08 = "string",
xXCustom10 = "string",
xXCustom09 = "string",
xXCustom07 = "string",
xXCustom05 = "string",
xXCustom06 = "string",
xXCustom11 = "string",
xXCustom12 = "string",
xXCustom13 = "string",
xXCustom14 = "string",
xXCustom15 = "string",
xXCustom03 = "string",
xXCustom02 = "string",
xXCustom04 = "string",
xXCustom01 = "string"
},
barcode = barCode.ToString(),
salesRestrictionsCheckNeeded = false,
priceVariant = "Actual",
itemEntryConfig = new ItemEntryConfig
{
forceQuantityInput = true,
pricePositionLimit = 0,
pricePositionZeroAllowed = true,
priceTransactionLimit = 0,
priceDifferencePercentPositionLimit = 0,
priceDifferenceAbsolutePositionLimit = 0,
priceDifferenceLimitExceedAction = "Warn",
priceNegDifferenceLimitExceedAction = "Warn",
closeCurrent = "Required",
closePrevious = "Required",
filterResult = true,
allowedWithWeight = true,
allowedWithLength = true,
allowedWithArea = true,
allowedWithVolume = true,
allowedWithMeasure = true,
maximumQuantity = 0,
minimumQuantity = 0,
quantityInputOrder = "BeforeOrAfter",
priceInputOrder = "BeforeOrAfter",
quantityLimitExceedAction = "Warn",
weightUnitFactor = 0,
measureUnitFactor = 0,
priceDeviationType = "All",
priceNegDeviationType = "All",
xXCustom01 = "string",
xXCustom02 = "string",
xXCustom03 = "string",
xXCustom04 = "string",
xXCustom05 = "string",
xXCustom06 = "string",
xXCustom07 = "string",
xXCustom08 = "string",
xXCustom09 = "string",
xXCustom10 = "string",
xXCustom11 = "string",
xXCustom12 = "string",
xXCustom13 = "string",
xXCustom14 = "string",
xXCustom15 = "string"
},
entryMethodCode = "Keyed",
keyedOnline = true
};
string json = JsonSerializer.Serialize(datosItem, new JsonSerializerOptions { WriteIndented = true });
request.AddParameter("application/json", json, ParameterType.RequestBody);
RestResponse response = client.Execute(request);
try
{
if (response.IsSuccessful)
{
var options2 = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
var jObject = JObject.Parse(response.Content);
var jsonString = jObject["primaryEntry"].ToString();
var jsonObject = JsonSerializer.Deserialize<primaryEntry>(jsonString, options2);
var transactionId = jsonObject.transaction.key.transactionID;
var addedOrModifiedLineItems = jsonObject.addedOrModifiedLineItems;
var itemId = addedOrModifiedLineItems[0].saleReturnLineItemList[0].itemID;
var regularUnitPrice = addedOrModifiedLineItems[0].saleReturnLineItemList[0].regularUnitPrice;
var quantityService = addedOrModifiedLineItems[0].saleReturnLineItemList[0].quantity;
var units = addedOrModifiedLineItems[0].saleReturnLineItemList[0].units;
var textName = addedOrModifiedLineItems[0].saleReturnLineItemList[0].receiptText;
//Pasarlo a string
var regularUnitPriceTrans = regularUnitPrice.ToString();
Log.Debug($"Transaction ID: {transactionId} ");
Entorno<EntornoGK>.Instancia.getDatos().TransactionID = transactionId;
string tomarNombreCorto = "";
//Valores que se mandan en chec
var date = DateTime.Now.ToString("dd/MM/yyyy");
CultureInfo culture = new CultureInfo("en-US");
culture.DateTimeFormat.AMDesignator = "AM";
culture.DateTimeFormat.PMDesignator = "PM";
var time = DateTime.Now.ToString("hh:mm tt", culture);
transactionStatusEvent = new TransactionStatusEvent(1, TipoMensaje.Event, requestId, "TRANSACTION_START", 1, "regularSale", "sales", date, time);
pOSReceiptEvent = new POSReceiptEvent(1, TipoMensaje.Event, requestId, "Customer", 0, "Body", requestId, 1, "center", "LineItem", "ItemSale", itemId + " " + textName + " " + quantityService + " " + regularUnitPrice, "Add");
posReceiptEventHeader = new POSReceiptEventHeaderResponse(1, TipoMensaje.Event, requestId);
totalEvent = new TotalsEventResponse(1, TipoMensaje.Event, requestId, regularUnitPriceTrans, regularUnitPriceTrans, regularUnitPriceTrans, regularUnitPriceTrans, "0.00", "0.00", "0.00", "0.00", "0.00", 1, 0, "0.00", "0.00");
itemResponse = new AddItemResponse(1, TipoMensaje.Resp, requestId, tomarNombreCorto, "false", "false", "true", "1234", "ScannedItemCode", "3200", 1, "3200", 0, "0.00", 0, 1, 0, "unit", "false", 0, "false", "false", "true", "true");
respuesta = new Respuestas { transactionStatusEvent, posReceiptEventHeader, pOSReceiptEvent, totalEvent, itemResponse };
}
else
{
addItemResponseError = new AddItemResponseError(1, TipoMensaje.Resp, requestId, "Articulo no encontrado", "ITEM_NOT_FOUND");
respuesta = new Respuestas { addItemResponseError };
}
}
catch(Exception err)
{
Log.Error("Error al conectarse al servidor", err);
}
return respuesta;
}
public IComando CreaCopia()
{
return (AddItemRequestCmdGk)this.MemberwiseClone();
}
public void CargaDTO(DTOBase addItemRequestDTO)
{
Request = (AddItemRequest)addItemRequestDTO;
}
}
}
using EvaPOS_API_FRAME.RespuestasXML;
using EvaPosSrvDTO;
using EvaPosSrvResp;
using GatewaySCO;
using RestSharp;
using SCOGateway.POSGk;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
namespace gatewayGK.ComandosGk
{
public class InitializeRequestCmdGk : IComando
{
public string Referencia { get; set; } = "scsns:Initialize";
/// <summary>
/// DTO con solicitud.
/// </summary>
public InitializeRequestDTO Request { get; private set; }
/// <summary>
/// Url servicio autenticación Gk.
/// </summary>
public const string UrlLogin = ConstantesGK.UrlBaseMaquetaProd + "/com.gk_software.pos.api.service.session.PosSessionService/login";
/// <summary>
/// Procesa y responde el login.
/// </summary>
///
public Respuestas Ejecutar()
{
// Crea una instancia de IConfiguration para acceder a la configuración
IConfiguration configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.Build();
//Llamar valores del archivo de configuración
string retailStoreId = configuration["DataGK:RetailStoreId"];
string workstationId = configuration["DataGK:WorkstationId"];
string workstationAddress = configuration["DataGK:WorkstationAddress"];
string workstationTypeCode = configuration["DataGK:WorkstationTypeCode"];
string loginName = configuration["DataGK:LoginName"];
string businessUnitGroupID = configuration["DataGK:BusinessUnitGroupID"];
string tillID = configuration["DataGK:TillID"];
string password = configuration["DataGK:Password"];
string jSessionId = configuration["DataGK:SessionID"]; ;
string cookieValue = $"JSESSIONID={jSessionId}";
Respuestas respuestaChec = null;
int terminalNumber = Request.TerminalNumber;
Log.Debug("Cmd InitializeRequestCmd ejecutado - Gk pruebas. Request id: {id}, terminal: {terminal}, recovery: {recovery}", Request.OperatorID, Request.TerminalNumber, Request.Recovery);
// Contactar Smart POS Gk.
var options = new RestClientOptions(UrlLogin)
{
MaxTimeout = -1,
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
};
var client = new RestClient(options);
var request = new RestRequest(UrlLogin, Method.Post);
request.AddHeader("Accept", "application/json;Format=GK-PLAIN-JSON");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Cookie", cookieValue);
var datosAutenticacion = new AutenticationReq
{
RetailStoreId = retailStoreId,
WorkstationId = workstationId,
WorkstationAddress = workstationAddress,
WorkstationTypeCode = workstationTypeCode,
LoginName = loginName,
Password = password,
TrainingMode = false,
FinalizeControlTransactionFlag = false,
UseLoginTypeTechnicalForLoginManager = false,
TillId = new Till
{
TillDoKey = new TillDoKey
{
BusinessUnitGroupID = businessUnitGroupID,
TillID = tillID
}
}
};
var loginRequestWrapper = new LoginRequestWrapper
{
LoginRequest = datosAutenticacion
};
string json = JsonSerializer.Serialize(loginRequestWrapper, new JsonSerializerOptions { WriteIndented = true });
request.AddJsonBody(json);
var response = client.Execute(request);
if (response.IsSuccessful)
{
Log.Debug($"Gk: Autenticate - POST - response {response}");
var autenticacionResp = JsonSerializer.Deserialize<AuthenticateResp>(response.Content);
var transactionId = autenticacionResp.primaryEntry.transaction.key.transactionID;
var operatorID = autenticacionResp.primaryEntry.transaction.operatorID;
var posSessionId = autenticacionResp.posSessionId.id;
//var sessionId = autenticacionResp.primaryEntry.transaction.posSessionId.id;
Log.Debug($"Transaction ID: {transactionId}, operatorID: {operatorID} ");
// Salvar Transaccion y id de la session.
//Entorno<EntornoGK>.Instancia.getDatos().TransactionID = transactionId;
Entorno<EntornoGK>.Instancia.getDatos().posSessionId = posSessionId;
Entorno<EntornoGK>.Instancia.getDatos().SeccionId = jSessionId;
// Respuestas a SCO.
var posbcStatus1 = new POSBCStatusEvent(1, TipoMensaje.Event, "INFO", "CONNECTING_TO_POS", "Connecting to POS system");
var posbcStatus2 = new POSBCStatusEvent(1, TipoMensaje.Event, "INFO", "CONNECTED_TO_POS", "Connected to POS system");
var posbcStatus3 = new POSBCStatusEvent(1, TipoMensaje.Event, "INFO", "POS_RESOURCES_INITIALIZED", "POS Resources Initialized");
var inicializacionOk = new InitializeResponse(1, TipoMensaje.Resp, terminalNumber);
respuestaChec = new Respuestas { posbcStatus1, posbcStatus2, posbcStatus3, inicializacionOk };
}
else
{
Log.Error($"Failed to connect to GK web service: {response.StatusCode}");
Log.Error(response.Content);
throw new ApplicationException("Servicio POST 'Login' en error.");
}
return respuestaChec;
}
public IComando CreaCopia()
{
return (InitializeRequestCmdGk)this.MemberwiseClone();
}
public void CargaDTO(DTOBase initializeRequestDTO)
{
Request = (InitializeRequestDTO)initializeRequestDTO;
}
}
}
using EvaPOS_API_FRAME.Comandos;
using EvaPOS_API_FRAME.DTO;
using EvaPOS_API_FRAME.RespuestasXML;
using EvaPosSrvDTO;
using EvaPosSrvResp;
using Serilog;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace gatewayGK.ComandosGk
{
/// <summary>
/// Procesa solicitudes de QueryStatusRequest.
/// </summary>
public class QueryStatusRequestCmdGk : IComando
{
public string Referencia { get; set; } = "scsns:QueryStatus";
/// <summary>
/// DTO con solicitud.
/// </summary>
public QueryStatusRequestDTO Request { get; private set; }
/// <summary>
/// Procesa y responde QueryStatusRequest.
/// </summary>
public Respuestas Ejecutar()
{
//Mirar las tildes que hay problema con el chec
var date = DateTime.Now.ToString("dd MM yyyy");
CultureInfo culture = new CultureInfo("en-US");
culture.DateTimeFormat.AMDesignator = "AM";
culture.DateTimeFormat.PMDesignator = "PM";
var time = DateTime.Now.ToString("hh:mm tt", culture);
Log.Debug("Cmd QueryStatusRequesttDTO ejecutado. QueryStatusRequest : {QueryStatusRequest}", Request.QueryStatusRequest);
var queryStatusResponse = new QueryStatusResponse(1, TipoMensaje.Resp, 2, "NOT_IN_TRANSACTION", 4, 2, 2067, "Toshiba Store Integrator Application Extension Facility version: 4.2.2067 Built: Jun 08, 2021 06:49 PM (SI.base.wyvern )", "28 de abril de 2023 05:31:35 PM COT", 2, false);
return (new Respuestas { queryStatusResponse });
}
public IComando CreaCopia()
{
return (QueryStatusRequestCmdGk)this.MemberwiseClone();
}
public void CargaDTO(DTOBase queryStatusRequestDTO)
{
Request = (QueryStatusRequestDTO)queryStatusRequestDTO;
}
}
}
using EvaPOS_API_FRAME.Comandos;
using EvaPOS_API_FRAME.DTO;
using EvaPOS_API_FRAME.RespuestasXML;
using EvaPOS_API_FRAME.RespuestasXML.Printer;
using EvaPosSrvDTO;
using EvaPosSrvResp;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace gatewayGK.ComandosGk
{
///<summary>
/// Procesa solicitudes de ReportStatusEventsRequest.
/// </summary>
public class ReportStatusEventsRequestCmdGk : IComando
{
public string Referencia { get; set; } = "scsns:ReportStatusEvents";
/// <summary>
/// DTO con solicitud.
/// </summary>
public ReportStatusEventsRequestDTO Request { get; private set; }
/// <summary>
/// Procesa y responde ReportStatusEventsRequest.
/// </summary>
public Respuestas Ejecutar()
{
Log.Debug("Cmd ReportStatusEventsRequestDTO ejecutado. ReportStatusEventsRequest : {ReportStatusEventsRequest}", Request.RequestID);
POSBCStatusEventPrinterSingle posbcStatusPrinter = null;
int requestId = Request.RequestID;
var reportStatusEventsResponse = new ReportStatusEventsResponse(1, TipoMensaje.Resp, requestId);
return (new Respuestas { reportStatusEventsResponse });
}
public IComando CreaCopia()
{
return (ReportStatusEventsRequestCmdGk)this.MemberwiseClone();
}
public void CargaDTO(DTOBase reportStatusEventsRequestDTO)
{
Request = (ReportStatusEventsRequestDTO)reportStatusEventsRequestDTO;
}
}
}
using gatewayGK.ComandosGk;
using GatewaySCO;
using Serilog; using Serilog;
/// <summary> /// <summary>
...@@ -15,6 +17,10 @@ public class DispensaDirectorioCmdsGK : IDispensaDirectorioCmds ...@@ -15,6 +17,10 @@ public class DispensaDirectorioCmdsGK : IDispensaDirectorioCmds
Log.Information("Instancia comandos de GK Smart POS."); Log.Information("Instancia comandos de GK Smart POS.");
return new IniciaDirectorioCmds() return new IniciaDirectorioCmds()
//.AgregaCmd(new Gk.InitializeRequestCmd()) //.AgregaCmd(new Gk.InitializeRequestCmd())
.AgregaCmd(new InitializeRequestCmdGk())
.AgregaCmd(new QueryStatusRequestCmdGk())
.AgregaCmd(new ReportStatusEventsRequestCmdGk())
.AgregaCmd(new AddItemRequestCmdGk())
.DirectorioCmds; .DirectorioCmds;
} }
} }
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace gatewayGK.POSGk
{
using System.Text.Json.Serialization;
public class OperationConfiguration
{
[JsonPropertyName("forceQuantityInput")]
public bool forceQuantityInput { get; set; }
[JsonPropertyName("pricePositionLimit")]
public int pricePositionLimit { get; set; }
[JsonPropertyName("pricePositionZeroAllowed")]
public bool pricePositionZeroAllowed { get; set; }
[JsonPropertyName("priceTransactionLimit")]
public int priceTransactionLimit { get; set; }
[JsonPropertyName("priceDifferencePercentPositionLimit")]
public int priceDifferencePercentPositionLimit { get; set; }
[JsonPropertyName("priceDifferenceAbsolutePositionLimit")]
public int priceDifferenceAbsolutePositionLimit { get; set; }
[JsonPropertyName("priceDifferenceLimitExceedAction")]
public string priceDifferenceLimitExceedAction { get; set; }
[JsonPropertyName("priceNegDifferenceLimitExceedAction")]
public string priceNegDifferenceLimitExceedAction { get; set; }
[JsonPropertyName("closeCurrent")]
public string closeCurrent { get; set; }
[JsonPropertyName("closePrevious")]
public string closePrevious { get; set; }
[JsonPropertyName("filterResult")]
public bool filterResult { get; set; }
[JsonPropertyName("allowedWithWeight")]
public bool allowedWithWeight { get; set; }
[JsonPropertyName("allowedWithLength")]
public bool allowedWithLength { get; set; }
[JsonPropertyName("allowedWithArea")]
public bool allowedWithArea { get; set; }
[JsonPropertyName("allowedWithVolume")]
public bool allowedWithVolume { get; set; }
[JsonPropertyName("allowedWithMeasure")]
public bool allowedWithMeasure { get; set; }
[JsonPropertyName("maximumQuantity")]
public int maximumQuantity { get; set; }
[JsonPropertyName("minimumQuantity")]
public int minimumQuantity { get; set; }
[JsonPropertyName("quantityInputOrder")]
public string quantityInputOrder { get; set; }
[JsonPropertyName("priceInputOrder")]
public string priceInputOrder { get; set; }
[JsonPropertyName("quantityLimitExceedAction")]
public string quantityLimitExceedAction { get; set; }
[JsonPropertyName("amountLimitExceedAction")]
public string amountLimitExceedAction { get; set; }
[JsonPropertyName("weightUnitFactor")]
public int weightUnitFactor { get; set; }
[JsonPropertyName("measureUnitFactor")]
public int measureUnitFactor { get; set; }
[JsonPropertyName("priceDeviationType")]
public string priceDeviationType { get; set; }
[JsonPropertyName("priceNegDeviationType")]
public string priceNegDeviationType { get; set; }
[JsonPropertyName("xXCustom08")]
public string xXCustom08 { get; set; }
[JsonPropertyName("xXCustom10")]
public string xXCustom10 { get; set; }
[JsonPropertyName("xXCustom09")]
public string xXCustom09 { get; set; }
[JsonPropertyName("xXCustom07")]
public string xXCustom07 { get; set; }
[JsonPropertyName("xXCustom05")]
public string xXCustom05 { get; set; }
[JsonPropertyName("xXCustom06")]
public string xXCustom06 { get; set; }
[JsonPropertyName("xXCustom11")]
public string xXCustom11 { get; set; }
[JsonPropertyName("xXCustom12")]
public string xXCustom12 { get; set; }
[JsonPropertyName("xXCustom13")]
public string xXCustom13 { get; set; }
[JsonPropertyName("xXCustom14")]
public string xXCustom14 { get; set; }
[JsonPropertyName("xXCustom15")]
public string xXCustom15 { get; set; }
[JsonPropertyName("xXCustom03")]
public string xXCustom03 { get; set; }
[JsonPropertyName("xXCustom02")]
public string xXCustom02 { get; set; }
[JsonPropertyName("xXCustom04")]
public string xXCustom04 { get; set; }
[JsonPropertyName("xXCustom01")]
public string xXCustom01 { get; set; }
}
public class ItemEntryConfig
{
[JsonPropertyName("forceQuantityInput")]
public bool forceQuantityInput { get; set; }
[JsonPropertyName("pricePositionLimit")]
public int pricePositionLimit { get; set; }
[JsonPropertyName("pricePositionZeroAllowed")]
public bool pricePositionZeroAllowed { get; set; }
[JsonPropertyName("priceTransactionLimit")]
public int priceTransactionLimit { get; set; }
[JsonPropertyName("priceDifferencePercentPositionLimit")]
public int priceDifferencePercentPositionLimit { get; set; }
[JsonPropertyName("priceDifferenceAbsolutePositionLimit")]
public int priceDifferenceAbsolutePositionLimit { get; set; }
[JsonPropertyName("priceDifferenceLimitExceedAction")]
public string priceDifferenceLimitExceedAction { get; set; }
[JsonPropertyName("priceNegDifferenceLimitExceedAction")]
public string priceNegDifferenceLimitExceedAction { get; set; }
[JsonPropertyName("closeCurrent")]
public string closeCurrent { get; set; }
[JsonPropertyName("closePrevious")]
public string closePrevious { get; set; }
[JsonPropertyName("filterResult")]
public bool filterResult { get; set; }
[JsonPropertyName("allowedWithWeight")]
public bool allowedWithWeight { get; set; }
[JsonPropertyName("allowedWithLength")]
public bool allowedWithLength { get; set; }
[JsonPropertyName("allowedWithArea")]
public bool allowedWithArea { get; set; }
[JsonPropertyName("allowedWithVolume")]
public bool allowedWithVolume { get; set; }
[JsonPropertyName("allowedWithMeasure")]
public bool allowedWithMeasure { get; set; }
[JsonPropertyName("maximumQuantity")]
public int maximumQuantity { get; set; }
[JsonPropertyName("minimumQuantity")]
public int minimumQuantity { get; set; }
[JsonPropertyName("quantityInputOrder")]
public string quantityInputOrder { get; set; }
[JsonPropertyName("priceInputOrder")]
public string priceInputOrder { get; set; }
[JsonPropertyName("quantityLimitExceedAction")]
public string quantityLimitExceedAction { get; set; }
[JsonPropertyName("weightUnitFactor")]
public int weightUnitFactor { get; set; }
[JsonPropertyName("measureUnitFactor")]
public int measureUnitFactor { get; set; }
[JsonPropertyName("priceDeviationType")]
public string priceDeviationType { get; set; }
[JsonPropertyName("priceNegDeviationType")]
public string priceNegDeviationType { get; set; }
[JsonPropertyName("xXCustom01")]
public string xXCustom01 { get; set; }
[JsonPropertyName("xXCustom02")]
public string xXCustom02 { get; set; }
[JsonPropertyName("xXCustom03")]
public string xXCustom03 { get; set; }
[JsonPropertyName("xXCustom04")]
public string xXCustom04 { get; set; }
[JsonPropertyName("xXCustom05")]
public string xXCustom05 { get; set; }
[JsonPropertyName("xXCustom06")]
public string xXCustom06 { get; set; }
[JsonPropertyName("xXCustom07")]
public string xXCustom07 { get; set; }
[JsonPropertyName("xXCustom08")]
public string xXCustom08 { get; set; }
[JsonPropertyName("xXCustom09")]
public string xXCustom09 { get; set; }
[JsonPropertyName("xXCustom10")]
public string xXCustom10 { get; set; }
[JsonPropertyName("xXCustom11")]
public string xXCustom11 { get; set; }
[JsonPropertyName("xXCustom12")]
public string xXCustom12 { get; set; }
[JsonPropertyName("xXCustom13")]
public string xXCustom13 { get; set; }
[JsonPropertyName("xXCustom14")]
public string xXCustom14 { get; set; }
[JsonPropertyName("xXCustom15")]
public string xXCustom15 { get; set; }
}
public class AddItemRequ
{
[JsonPropertyName("operationConfiguration")]
public OperationConfiguration operationConfiguration { get; set; }
[JsonPropertyName("barcode")]
public string barcode { get; set; }
[JsonPropertyName("salesRestrictionsCheckNeeded")]
public bool salesRestrictionsCheckNeeded { get; set; }
[JsonPropertyName("priceVariant")]
public string priceVariant { get; set; }
[JsonPropertyName("itemEntryConfig")]
public ItemEntryConfig itemEntryConfig { get; set; }
[JsonPropertyName("entryMethodCode")]
public string entryMethodCode { get; set; }
[JsonPropertyName("keyedOnline")]
public bool keyedOnline { get; set; }
}
}
using SCOGateway.POSGk;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace gatewayGK.POSGk
{
public class AddItemResp
{
[JsonPropertyName("primaryEntry")]
public primaryEntry PrimaryEntry { get; set; }
}
public class primaryEntry
{
[JsonPropertyName("transaction")]
public TransactionItem transaction { get; set; }
[JsonPropertyName("addedOrModifiedLineItems")]
public List<addedOrModifiedLineItems> addedOrModifiedLineItems { get; set; }
}
public class TransactionItem
{
[JsonPropertyName("key")]
public KeyItem key { get; set; }
}
public class KeyItem
{
[JsonPropertyName("transactionID")]
public string transactionID { get; set; }
}
public class addedOrModifiedLineItems
{
[JsonPropertyName("saleReturnLineItemList")]
public List<saleReturnLineItemList> saleReturnLineItemList { get; set; }
}
public class saleReturnLineItemList
{
[JsonPropertyName("itemID")]
public string itemID { get; set; }
[JsonPropertyName("regularUnitPrice")]
public decimal regularUnitPrice { get; set; }
[JsonPropertyName("quantity")]
public int quantity { get; set; }
[JsonPropertyName("units")]
public double units { get; set; }
[JsonPropertyName("receiptText")]
public string receiptText { get; set; }
}
}
...@@ -5,11 +5,56 @@ namespace SCOGateway.POSGk ...@@ -5,11 +5,56 @@ namespace SCOGateway.POSGk
/// <summary> /// <summary>
/// Registro para solicitar autenticación a cliente Smart POS GK. /// Registro para solicitar autenticación a cliente Smart POS GK.
/// </summary> /// </summary>
record AutenticationReq public class LoginRequestWrapper
{ {
[JsonPropertyName("loginName")] public string LoginName { get; set; } = ""; [JsonPropertyName("com.gk_software.pos.api.service.session.LoginRequest")]
[JsonPropertyName("password")] public string Password { get; set; } = ""; public AutenticationReq LoginRequest { get; set; }
[JsonPropertyName("businessUnitId")] public string BusinessUnitId { get; set; } = ""; }
[JsonPropertyName("passwordRequired")] public bool PasswordRequired { get; set; } = true; public record AutenticationReq
{
[JsonPropertyName("retailStoreId")]
public string RetailStoreId { get; set; } = "";
[JsonPropertyName("workstationId")]
public string WorkstationId { get; set; } = "";
[JsonPropertyName("workstationAddress")]
public string WorkstationAddress { get; set; } = "";
[JsonPropertyName("workstationTypeCode")]
public string WorkstationTypeCode { get; set; } = "";
[JsonPropertyName("loginName")]
public string LoginName { get; set; } = "";
[JsonPropertyName("tillId")]
public Till TillId { get; set; } = new Till();
[JsonPropertyName("password")]
public string Password { get; set; } = "";
[JsonPropertyName("trainingMode")]
public bool TrainingMode { get; set; } = false;
[JsonPropertyName("finalizeControlTransactionFlag")]
public bool FinalizeControlTransactionFlag { get; set; } = false;
[JsonPropertyName("useLoginTypeTechnicalForLoginManager")]
public bool UseLoginTypeTechnicalForLoginManager { get; set; } = false;
}
public record Till
{
[JsonPropertyName("com.gk_software.pos.api.model.dom.app.services.transaction.TillDoKey")]
public TillDoKey TillDoKey { get; set; } = new TillDoKey();
}
public record TillDoKey
{
[JsonPropertyName("businessUnitGroupID")]
public string BusinessUnitGroupID { get; set; } = "";
[JsonPropertyName("tillID")]
public string TillID { get; set; } = "";
} }
} }
\ No newline at end of file
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Transactions;
namespace SCOGateway.POSGk namespace SCOGateway.POSGk
{ {
record AuthenticateResp public class AuthenticateResp
{ {
[JsonPropertyName("operatorID")] public string OperatorID { get; set; } = ""; [JsonPropertyName("primaryEntry")]
[JsonPropertyName("workerID")] public string WorkerID { get; set; } = ""; public PrimaryEntry primaryEntry { get; set; }
[JsonPropertyName("firstName")] public string FirstName { get; set; } = ""; [JsonPropertyName("posSessionId")]
[JsonPropertyName("lastName")] public string LastName { get; set; } = ""; public PosSessionId posSessionId { get; set; }
[JsonPropertyName("languageID")] public string LanguageID { get; set; } = ""; }
[JsonPropertyName("realmId")] public string RealmId { get; set; } = "";
[JsonPropertyName("expirationCountDays")] public int ExpirationCountDays { get; set; } = 0; public class PosSessionId
[JsonPropertyName("passwordBeforeExpiration")] public bool PasswordBeforeExpiration { get; set; } = true; {
[JsonPropertyName("id")]
public string id { get; set; }
}
public class PrimaryEntry
{
[JsonPropertyName("transaction")]
public Transaction transaction { get; set; }
}
public class Transaction
{
[JsonPropertyName("key")]
public Key key { get; set; }
[JsonPropertyName("operatorID")]
public string operatorID { get; set; }
[JsonPropertyName("posSessionId")]
public Id posSessionId { get; set; }
}
public class Id
{
[JsonPropertyName("id")]
public string id { get; set; }
}
public class Key
{
[JsonPropertyName("transactionID")]
public string transactionID { get; set; }
[JsonPropertyName("businessUnitGroupID")]
public string businessUnitGroupID { get; set; }
} }
} }
\ No newline at end of file
...@@ -8,6 +8,12 @@ namespace SCOGateway.POSGk ...@@ -8,6 +8,12 @@ namespace SCOGateway.POSGk
/// <summary> /// <summary>
/// Url base ambiente de pruebas Gk maqueta. /// Url base ambiente de pruebas Gk maqueta.
/// </summary> /// </summary>
// TODO - mover a archivo de configuración
public const string UrlBaseMaqueta = "https://julia.redsis.com/castlemock/mock/rest/project/KdLiqe/application/l4KAuU"; public const string UrlBaseMaqueta = "https://julia.redsis.com/castlemock/mock/rest/project/KdLiqe/application/l4KAuU";
/// <summary>
/// Url base produccion de GK.
/// </summary>
// TODO - mover a archivo de configuración y mejorar el nombre de la constante.
public const string UrlBaseMaquetaProd = "https://10.10.117.10:8443/smartpos-service/tenants/001/services";
} }
} }
\ No newline at end of file
...@@ -15,6 +15,11 @@ public class EntornoGK ...@@ -15,6 +15,11 @@ public class EntornoGK
/// </summary> /// </summary>
public int ExpirationCountDays { get; set; } = 0; public int ExpirationCountDays { get; set; } = 0;
public string TransactionID { get; set; } = "";
public string SeccionId { get; set; } = "";
public string posSessionId { get; set; } = "";
/// <summary> /// <summary>
/// GK Language. /// GK Language.
/// </summary> /// </summary>
......
{ {
"GatewayConfig": { "GatewayConfig": {
"POS": "gk_test", "POS": "gk",
"POS_comment": "Indicates the set of commands to instantiate, according to the type of POS: evapos, tests, gk, etc.", "POS_comment": "Indicates the set of commands to instantiate, according to the type of POS: evapos, tests, gk, etc.",
"IpSCO": "127.0.0.1", "IpSCO": "192.168.168.232",
"IpSCO_comment": "SCO IP, local or remote", "IpSCO_comment": "SCO IP, local or remote",
"PortSCO": 6697, "PortSCO": 6697,
"PortSCO_comment": "SCO IP Port", "PortSCO_comment": "SCO IP Port",
...@@ -26,6 +26,17 @@ ...@@ -26,6 +26,17 @@
} }
] ]
}, },
"DataGK": {
"RetailStoreId": "1000",
"workstationId": "103",
"WorkstationAddress": "001_1000_103",
"WorkstationTypeCode": "MOB",
"LoginName": "1004",
"Password": "1",
"BusinessUnitGroupID": "1000",
"TillID": "103",
"SessionID": "7B5670A3029726D69AC5454FADA35DAD"
},
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Debug", "Default": "Debug",
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" /> <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp" Version="110.2.0" /> <PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="Serilog" Version="3.0.1" /> <PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment