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-CHEC
Commits
17d006dc
Commit
17d006dc
authored
Jul 21, 2023
by
Jose Hugo Torres
Browse files
gateway sco gk
Modificaciones para gateway con sco y gk
parent
2e963f0b
Changes
73
Show whitespace changes
Inline
Side-by-side
gatewayGK/Adaptadores/AdaptadorAddCustomerBirthdateRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorAddCustomerRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorAddItemRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
...
...
gatewayGK/Adaptadores/AdaptadorAddReceiptLinesRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorAddTenderDebitRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorCancelAction.cs
View file @
17d006dc
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorGetTotalsRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorInitializeRequest.cs
View file @
17d006dc
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorPrintCurrentReceipts.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorRemoveReceiptLines.cs
View file @
17d006dc
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorReportStatusEventsRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorReprintReceiptsRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorSignOffRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorSuspendTransactionRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadorTerminateRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/Adaptadores/AdaptadoresVoidTransactionRequest.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
EvaPosUtil
;
using
GatewaySCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
gatewayGK/ComandosGkPruebas/AddItemRequestCmdGK.cs
0 → 100644
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPOS_API_FRAME.RespuestasXML
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
Serilog
;
using
EvaPOS_API_FRAME.DTO.Intercambio
;
using
System.Globalization
;
namespace
EvaPOS_API_FRAME.Comandos
{
///<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
Respuestas
Ejecutar
()
{
Log
.
Debug
(
"Cmd AddItemRequestCmdGk ejecutado. AddItemRequest : {AddItemRequest}"
,
Request
.
RequestID
);
//int requestIdGuardado = RequestIdGuardado();
POSBCStatusEvent
posbcStatus
=
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
;
/*
Aqui se arma la solicitud para Smart POS, recuperando datos del Entorno.
*/
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
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"
,
"1234"
+
" "
+
"Producto"
+
" "
+
"1"
+
" "
+
3200
,
"Add"
);
POSReceiptEventHeaderResponse
posReceiptEventHeader
=
new
POSReceiptEventHeaderResponse
(
1
,
TipoMensaje
.
Event
,
requestId
);
TotalsEventResponse
totalEvent
=
new
TotalsEventResponse
(
1
,
TipoMensaje
.
Event
,
requestId
,
"3200"
,
"3200"
,
"3200"
,
"3200"
,
"0.00"
,
"0.00"
,
"0.00"
,
"0.00"
,
"0.00"
,
1
,
0
,
"0.00"
,
"0.00"
);
AddItemResponse
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
};
return
(
respuesta
);
}
public
IComando
CreaCopia
()
{
return
(
AddItemRequestCmd
)
this
.
MemberwiseClone
();
}
public
void
CargaDTO
(
DTOBase
addItemRequestDTO
)
{
Request
=
(
AddItemRequest
)
addItemRequestDTO
;
}
}
}
gatewayGK/ComandosGkPruebas/InitializeRequestCmdGK.cs
0 → 100644
View file @
17d006dc
using
EvaPOS_API_FRAME.RespuestasXML
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
Serilog
;
using
RestSharp
;
using
RestSharp.Authenticators
;
using
SCOGateway.POSGk
;
using
GatewaySCO
;
namespace
SCOGateway.POSGkPruebas
{
public
class
InitializeRequestCmd
:
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
UrlAuthenticate
=
ConstantesGK
.
UrlBaseMaqueta
+
"/com.gk_software.pos.api.service.security.AuthenticationService/authenticate"
;
/// <summary>
/// Procesa y responde InitializeRequest.
/// </summary>
public
Respuestas
Ejecutar
()
{
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
client
=
new
RestClient
(
UrlAuthenticate
);
var
request
=
new
RestRequest
(
UrlAuthenticate
,
Method
.
Post
);
var
datosAutenticacion
=
new
AutenticationReq
{
LoginName
=
"usuario"
,
Password
=
"12345"
};
request
.
AddJsonBody
(
datosAutenticacion
);
// Ejecuta invocación sincrónica, deserializando respuesta según el tipo indicado en la invocación del Post<T>.
var
autenticacionResp
=
client
.
Post
<
AuthenticateResp
>(
request
)
??
throw
new
ApplicationException
(
"Servicio POST 'Authenticate' retorna nulos."
);
Log
.
Debug
(
$"GkPruebas: Autenticate - POST - response
{
autenticacionResp
}
"
);
// Salvar el token de autenticación y demás datos.
Entorno
<
EntornoGK
>.
Instancia
.
getDatos
().
RealmId
=
autenticacionResp
.
RealmId
;
Entorno
<
EntornoGK
>.
Instancia
.
getDatos
().
ExpirationCountDays
=
autenticacionResp
.
ExpirationCountDays
;
// 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
);
return
(
new
Respuestas
{
posbcStatus1
,
posbcStatus2
,
posbcStatus3
,
inicializacionOk
});
}
public
IComando
CreaCopia
()
{
return
(
InitializeRequestCmd
)
this
.
MemberwiseClone
();
}
public
void
CargaDTO
(
DTOBase
initializeRequestDTO
)
{
Request
=
(
InitializeRequestDTO
)
initializeRequestDTO
;
}
}
}
\ No newline at end of file
gatewayGK/Comandos/AddCustomerBirthdateCmd.cs
→
gatewayGK/Comandos
Pruebas
/AddCustomerBirthdateCmd.cs
View file @
17d006dc
using
EvaPOS_API_FRAME.DTO
;
using
EvaPOS_API_FRAME.RespuestasXML
;
using
EvaPOS_API_FRAME.RespuestasXML.RestriccionEdad
;
using
EvaPosSrvCmd
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
Serilog
;
...
...
gatewayGK/Comandos/AddCustomerCmd.cs
→
gatewayGK/Comandos
Pruebas
/AddCustomerCmd.cs
View file @
17d006dc
...
...
@@ -2,7 +2,6 @@
using
EvaPOS_API_FRAME.DTO.Intercambio
;
using
EvaPOS_API_FRAME.RespuestasXML
;
using
EvaPOS_API_FRAME.RespuestasXML.AddCustomer
;
using
EvaPosSrvCmd
;
using
EvaPosSrvDTO
;
using
EvaPosSrvResp
;
using
Serilog
;
...
...
Prev
1
2
3
4
Next
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