Commit 6ba307f3 authored by bsarmiento31's avatar bsarmiento31
Browse files

Creacion de comando - AdditemGK

parent 09a5689c
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>
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;
}
}
}
......@@ -106,15 +106,18 @@ namespace gatewayGK.ComandosGk
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().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");
......
......@@ -72,20 +72,20 @@ namespace EvaPOS_API_FRAME.Comandos
culture.DateTimeFormat.PMDesignator = "PM";
var time = DateTime.Now.ToString("hh:mm tt", culture);
if (itemlResp != null)
{
TransactionStatusEvent transactionStatusEvent = new TransactionStatusEvent(1, TipoMensaje.Event, requestId, "TRANSACTION_START", 1, "regularSale", "sales", date, time);
POSReceiptEvent pOSReceiptEvent = new POSReceiptEvent(1, TipoMensaje.Event, requestId, "Customer", 0, "Body", requestId, 1, "center", "LineItem", "ItemSale", itemlResp.ItemID + " " + itemlResp.Name + " " + "1" + " " + itemlResp.RegularPriceAmount, "Add");
POSReceiptEventHeaderResponse posReceiptEventHeader = new POSReceiptEventHeaderResponse(1, TipoMensaje.Event, requestId);
TotalsEventResponse totalEvent = new TotalsEventResponse(1, TipoMensaje.Event, requestId, itemlResp.RegularPriceAmount.ToString() , itemlResp.RegularPriceAmount.ToString(), "0.18", "3.67", "0.00", "0.00", "0.00", "0.00", "0.00", itemlResp.Quantity, 0, "0.00", "0.00");
AddItemResponse itemResponse = new AddItemResponse(1, TipoMensaje.Resp, requestId, itemlResp.Name, "false", "false", "true", itemlResp.ItemID, "ScannedItemCode", itemlResp.RegularPriceAmount.ToString(), itemlResp.Quantity, itemlResp.RegularPriceAmount.ToString(), 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");
return new Respuestas { addItemResponseError };
}
//if (itemlResp != null)
//{
// TransactionStatusEvent transactionStatusEvent = new TransactionStatusEvent(1, TipoMensaje.Event, requestId, "TRANSACTION_START", 1, "regularSale", "sales", date, time);
// POSReceiptEvent pOSReceiptEvent = new POSReceiptEvent(1, TipoMensaje.Event, requestId, "Customer", 0, "Body", requestId, 1, "center", "LineItem", "ItemSale", itemlResp.ItemID + " " + itemlResp.Name + " " + "1" + " " + itemlResp.RegularPriceAmount, "Add");
// POSReceiptEventHeaderResponse posReceiptEventHeader = new POSReceiptEventHeaderResponse(1, TipoMensaje.Event, requestId);
// TotalsEventResponse totalEvent = new TotalsEventResponse(1, TipoMensaje.Event, requestId, itemlResp.RegularPriceAmount.ToString() , itemlResp.RegularPriceAmount.ToString(), "0.18", "3.67", "0.00", "0.00", "0.00", "0.00", "0.00", itemlResp.Quantity, 0, "0.00", "0.00");
// AddItemResponse itemResponse = new AddItemResponse(1, TipoMensaje.Resp, requestId, itemlResp.Name, "false", "false", "true", itemlResp.ItemID, "ScannedItemCode", itemlResp.RegularPriceAmount.ToString(), itemlResp.Quantity, itemlResp.RegularPriceAmount.ToString(), 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");
// return new Respuestas { addItemResponseError };
//}
......
......@@ -76,3 +76,8 @@ Carpetas de código asociado con GK Smart POS:
## Notas
- Para el comando `SubtotalCmdGK` y `AddCustomerCmdGK`, la respuesta trae muchos campos, hay que anotar cual es el campo que nesecitamos
- Se utilizo Newtonsoft.Json en el AddItem para mapear el json de respuesta
- Solo se tiene que guardar en las variables de entorno el JSESSIONID Y el sessionid
- en EntornoGK se crearon las propiedades TransactionID,SeccionId y possessionid
- Validar el certificado del servicio web, en cada servicio le estoy inyectando la propiedad "RemoteCertificateValidationCallback"
......@@ -5,7 +5,7 @@
public sealed class Config
{
public required string POS { get; set; } = "gk";
public required string IpSCO { get; set; } = "192.168.168.99";
public required string IpSCO { get; set; } = "192.168.168.232";
public required int PortSCO { get; set; } = 6697;
public required string Language { get; set; } = "en";
......
......@@ -23,6 +23,7 @@ public class DispensaDirectorioCmdsGK : IDispensaDirectorioCmds
.AgregaCmd(new InitializeRequestCmdGk())
.AgregaCmd(new QueryStatusRequestCmdGk())
.AgregaCmd(new ReportStatusEventsRequestCmdGk())
.AgregaCmd(new AddItemRequestCmdGk())
.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 System;
using SCOGateway.POSGk;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -7,11 +8,51 @@ using System.Threading.Tasks;
namespace gatewayGK.POSGk
{
record AddItemResp
public class AddItemResp
{
[JsonPropertyName("name")] public string Name { get; set; } = "";
[JsonPropertyName("itemID")] public string ItemID { get; set; } = "";
[JsonPropertyName("regularPriceAmount")] public decimal RegularPriceAmount { get; set; } = 0;
[JsonPropertyName("quantity")] public int Quantity { get; set; } = 0;
[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; }
}
}
......@@ -7,12 +7,20 @@ namespace SCOGateway.POSGk
{
[JsonPropertyName("primaryEntry")]
public PrimaryEntry primaryEntry { get; set; }
}
[JsonPropertyName("posSessionId")]
public PosSessionId posSessionId { get; set; }
}
public class PosSessionId
{
[JsonPropertyName("id")]
public string id { get; set; }
}
public class PrimaryEntry
{
[JsonPropertyName("transaction")]
public Transaction transaction { get; set; }
}
public class Transaction
......@@ -21,6 +29,15 @@ namespace SCOGateway.POSGk
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
{
......
......@@ -18,6 +18,7 @@ public class EntornoGK
public string TransactionID { get; set; } = "";
public string SeccionId { get; set; } = "";
public string posSessionId { get; set; } = "";
/// <summary>
/// GK Language.
......
......@@ -2,7 +2,7 @@
"GatewayConfig": {
"POS": "gk",
"POS_comment": "Indicates the set of commands to instantiate, according to the type of POS: evapos, tests, gk, etc.",
"IpSCO": "192.168.168.99",
"IpSCO": "192.168.168.232",
"IpSCO_comment": "SCO IP, local or remote",
"PortSCO": 6697,
"PortSCO_comment": "SCO IP Port",
......@@ -35,7 +35,7 @@
"Password": "1",
"BusinessUnitGroupID": "1000",
"TillID": "103",
"SessionID": "CF7005486990AE0AA52CA1C89308C286"
"SessionID": "7B5670A3029726D69AC5454FADA35DAD"
},
"Logging": {
"LogLevel": {
......
......@@ -18,6 +18,7 @@
<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.Json" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="Serilog" Version="3.0.1" />
<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