Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Brayan Sarmiento
API-Gateway-GK
Commits
6ba307f3
Commit
6ba307f3
authored
Aug 02, 2023
by
bsarmiento31
Browse files
Creacion de comando - AdditemGK
parent
09a5689c
Changes
12
Hide whitespace changes
Inline
Side-by-side
gatewayGK/ComandosGk/AddItemRequestCmdGk.cs
0 → 100644
View file @
6ba307f3
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
;
}
}
}
gatewayGK/ComandosGk/InitializeRequestCmdGk.cs
View file @
6ba307f3
...
@@ -106,15 +106,18 @@ namespace gatewayGK.ComandosGk
...
@@ -106,15 +106,18 @@ namespace gatewayGK.ComandosGk
if
(
response
.
IsSuccessful
)
if
(
response
.
IsSuccessful
)
{
{
Log
.
Debug
(
$"Gk: Autenticate - POST - response
{
response
}
"
);
Log
.
Debug
(
$"Gk: Autenticate - POST - response
{
response
}
"
);
var
autenticacionResp
=
JsonSerializer
.
Deserialize
<
AuthenticateResp
>(
response
.
Content
);
var
autenticacionResp
=
JsonSerializer
.
Deserialize
<
AuthenticateResp
>(
response
.
Content
);
var
transactionId
=
autenticacionResp
.
primaryEntry
.
transaction
.
key
.
transactionID
;
var
transactionId
=
autenticacionResp
.
primaryEntry
.
transaction
.
key
.
transactionID
;
var
operatorID
=
autenticacionResp
.
primaryEntry
.
transaction
.
operatorID
;
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
}
"
);
Log
.
Debug
(
$"Transaction ID:
{
transactionId
}
, operatorID:
{
operatorID
}
"
);
// Salvar Transaccion y id de la session.
// 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
;
Entorno
<
EntornoGK
>.
Instancia
.
getDatos
().
SeccionId
=
jSessionId
;
// 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"
);
var
posbcStatus2
=
new
POSBCStatusEvent
(
1
,
TipoMensaje
.
Event
,
"INFO"
,
"CONNECTED_TO_POS"
,
"Connected to POS system"
);
var
posbcStatus2
=
new
POSBCStatusEvent
(
1
,
TipoMensaje
.
Event
,
"INFO"
,
"CONNECTED_TO_POS"
,
"Connected to POS system"
);
...
...
gatewayGK/ComandosGkPruebas/AddItemRequestCmdGKTest.cs
View file @
6ba307f3
...
@@ -72,20 +72,20 @@ namespace EvaPOS_API_FRAME.Comandos
...
@@ -72,20 +72,20 @@ namespace EvaPOS_API_FRAME.Comandos
culture
.
DateTimeFormat
.
PMDesignator
=
"PM"
;
culture
.
DateTimeFormat
.
PMDesignator
=
"PM"
;
var
time
=
DateTime
.
Now
.
ToString
(
"hh:mm tt"
,
culture
);
var
time
=
DateTime
.
Now
.
ToString
(
"hh:mm tt"
,
culture
);
if
(
itemlResp
!=
null
)
//
if (itemlResp != null)
{
//
{
TransactionStatusEvent
transactionStatusEvent
=
new
TransactionStatusEvent
(
1
,
TipoMensaje
.
Event
,
requestId
,
"TRANSACTION_START"
,
1
,
"regularSale"
,
"sales"
,
date
,
time
);
//
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"
);
//
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
);
//
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"
);
//
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"
);
//
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
};
//
respuesta = new Respuestas { transactionStatusEvent, posReceiptEventHeader, pOSReceiptEvent, totalEvent, itemResponse };
}
//
}
else
//
else
{
//
{
addItemResponseError
=
new
AddItemResponseError
(
1
,
TipoMensaje
.
Resp
,
requestId
,
"Articulo no encontrado"
,
"ITEM_NOT_FOUND"
);
//
addItemResponseError = new AddItemResponseError(1, TipoMensaje.Resp, requestId, "Articulo no encontrado", "ITEM_NOT_FOUND");
return
new
Respuestas
{
addItemResponseError
};
//
return new Respuestas { addItemResponseError };
}
//
}
...
...
gatewayGK/GuiaProgramacion.md
View file @
6ba307f3
...
@@ -76,3 +76,8 @@ Carpetas de código asociado con GK Smart POS:
...
@@ -76,3 +76,8 @@ Carpetas de código asociado con GK Smart POS:
## Notas
## Notas
-
Para el comando
`SubtotalCmdGK`
y
`AddCustomerCmdGK`
, la respuesta trae muchos campos, hay que anotar cual es el campo que nesecitamos
-
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"
gatewayGK/Infraestructura/Config.cs
View file @
6ba307f3
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
public
sealed
class
Config
public
sealed
class
Config
{
{
public
required
string
POS
{
get
;
set
;
}
=
"gk"
;
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
int
PortSCO
{
get
;
set
;
}
=
6697
;
public
required
string
Language
{
get
;
set
;
}
=
"en"
;
public
required
string
Language
{
get
;
set
;
}
=
"en"
;
...
...
gatewayGK/Infraestructura/DispensaDirectorioCmdsGK.cs
View file @
6ba307f3
...
@@ -23,6 +23,7 @@ public class DispensaDirectorioCmdsGK : IDispensaDirectorioCmds
...
@@ -23,6 +23,7 @@ public class DispensaDirectorioCmdsGK : IDispensaDirectorioCmds
.
AgregaCmd
(
new
InitializeRequestCmdGk
())
.
AgregaCmd
(
new
InitializeRequestCmdGk
())
.
AgregaCmd
(
new
QueryStatusRequestCmdGk
())
.
AgregaCmd
(
new
QueryStatusRequestCmdGk
())
.
AgregaCmd
(
new
ReportStatusEventsRequestCmdGk
())
.
AgregaCmd
(
new
ReportStatusEventsRequestCmdGk
())
.
AgregaCmd
(
new
AddItemRequestCmdGk
())
.
DirectorioCmds
;
.
DirectorioCmds
;
}
}
}
}
\ No newline at end of file
gatewayGK/POSGk/AddItemRequ.cs
0 → 100644
View file @
6ba307f3
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
;
}
}
}
gatewayGK/POSGk/AddItemResp.cs
View file @
6ba307f3
using
System
;
using
SCOGateway.POSGk
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
...
@@ -7,11 +8,51 @@ using System.Threading.Tasks;
...
@@ -7,11 +8,51 @@ using System.Threading.Tasks;
namespace
gatewayGK.POSGk
namespace
gatewayGK.POSGk
{
{
record
AddItemResp
public
class
AddItemResp
{
{
[
JsonPropertyName
(
"name"
)]
public
string
Name
{
get
;
set
;
}
=
""
;
[
JsonPropertyName
(
"primaryEntry"
)]
[
JsonPropertyName
(
"itemID"
)]
public
string
ItemID
{
get
;
set
;
}
=
""
;
public
primaryEntry
PrimaryEntry
{
get
;
set
;
}
[
JsonPropertyName
(
"regularPriceAmount"
)]
public
decimal
RegularPriceAmount
{
get
;
set
;
}
=
0
;
}
[
JsonPropertyName
(
"quantity"
)]
public
int
Quantity
{
get
;
set
;
}
=
0
;
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
;
}
}
}
}
}
gatewayGK/POSGk/AuthenticateResp.cs
View file @
6ba307f3
...
@@ -7,12 +7,20 @@ namespace SCOGateway.POSGk
...
@@ -7,12 +7,20 @@ namespace SCOGateway.POSGk
{
{
[
JsonPropertyName
(
"primaryEntry"
)]
[
JsonPropertyName
(
"primaryEntry"
)]
public
PrimaryEntry
primaryEntry
{
get
;
set
;
}
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
public
class
PrimaryEntry
{
{
[
JsonPropertyName
(
"transaction"
)]
[
JsonPropertyName
(
"transaction"
)]
public
Transaction
transaction
{
get
;
set
;
}
public
Transaction
transaction
{
get
;
set
;
}
}
}
public
class
Transaction
public
class
Transaction
...
@@ -21,6 +29,15 @@ namespace SCOGateway.POSGk
...
@@ -21,6 +29,15 @@ namespace SCOGateway.POSGk
public
Key
key
{
get
;
set
;
}
public
Key
key
{
get
;
set
;
}
[
JsonPropertyName
(
"operatorID"
)]
[
JsonPropertyName
(
"operatorID"
)]
public
string
operatorID
{
get
;
set
;
}
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
public
class
Key
{
{
...
...
gatewayGK/POSGk/EntornoGK.cs
View file @
6ba307f3
...
@@ -18,6 +18,7 @@ public class EntornoGK
...
@@ -18,6 +18,7 @@ public class EntornoGK
public
string
TransactionID
{
get
;
set
;
}
=
""
;
public
string
TransactionID
{
get
;
set
;
}
=
""
;
public
string
SeccionId
{
get
;
set
;
}
=
""
;
public
string
SeccionId
{
get
;
set
;
}
=
""
;
public
string
posSessionId
{
get
;
set
;
}
=
""
;
/// <summary>
/// <summary>
/// GK Language.
/// GK Language.
...
...
gatewayGK/appsettings.json
View file @
6ba307f3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"GatewayConfig"
:
{
"GatewayConfig"
:
{
"POS"
:
"gk"
,
"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"
:
"192.168.168.
99
"
,
"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"
,
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
"Password"
:
"1"
,
"Password"
:
"1"
,
"BusinessUnitGroupID"
:
"1000"
,
"BusinessUnitGroupID"
:
"1000"
,
"TillID"
:
"103"
,
"TillID"
:
"103"
,
"SessionID"
:
"
CF7005486990AE0AA52CA1C89308C286
"
"SessionID"
:
"
7B5670A3029726D69AC5454FADA35DAD
"
},
},
"Logging"
:
{
"Logging"
:
{
"LogLevel"
:
{
"LogLevel"
:
{
...
...
gatewayGK/gatewayGK.csproj
View file @
6ba307f3
...
@@ -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" />
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment