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
TestPinpad
Commits
ac2007cc
Commit
ac2007cc
authored
Dec 02, 2025
by
Brayan Sarmiento
Browse files
Creacion del metodo inicializar Pinpad - Usar servicio web
parent
f35288d8
Changes
10
Hide whitespace changes
Inline
Side-by-side
app_datafono_difare/Controllers/PinpadController.cs
View file @
ac2007cc
...
...
@@ -9,8 +9,27 @@ using System.Web.Http;
namespace
app_datafono_difare.Controllers
{
public
class
PinpadController
:
ApiController
// <- heredar ApiController
public
class
PinpadController
:
ApiController
{
[
HttpPost
]
public
IHttpActionResult
Inicializar
([
FromBody
]
string
UrlServicio
,
string
Estacion
)
{
try
{
var
service
=
new
TransactionService
(
RgService
.
Instance
,
System
.
Configuration
.
ConfigurationManager
.
AppSettings
[
"ArchivoBines"
]
);
var
resp
=
service
.
Inicializar
(
UrlServicio
,
Estacion
);
return
Ok
(
resp
);
}
catch
(
Exception
ex
)
{
return
InternalServerError
(
ex
);
}
}
[
HttpPost
]
public
async
Task
<
IHttpActionResult
>
Autorizar
([
FromBody
]
decimal
amount
)
{
...
...
app_datafono_difare/Services/PinpadService.cs
View file @
ac2007cc
...
...
@@ -18,7 +18,7 @@ namespace app_datafono_difare.Services
string
baseUrl
=
System
.
Configuration
.
ConfigurationManager
.
AppSettings
[
"BaseUrl"
];
InicializarPinpad
();
//
InicializarPinpad();
_webApp
=
WebApp
.
Start
<
Startup
>(
url
:
baseUrl
);
...
...
app_datafono_difare/Services/TransactionService.cs
View file @
ac2007cc
...
...
@@ -27,20 +27,27 @@ namespace app_datafono_difare.Services
_rutaBines
=
rutaBines
;
}
public
async
Task
<
TransaccionResponse
>
ProcesarVenta
(
string
url
,
string
estacion
,
decimal
monto
,
int
cuotas
)
public
bool
Inicializar
(
string
url
,
string
estacion
)
{
try
{
Log
.
Information
(
"Configurando servicio..."
);
_rg
.
Rg
.
EstablecerServicio
(
url
);
_rg
.
Rg
.
EstablecerEstacion
(
estacion
);
_rg
.
Rg
.
ConfigurarTerminal
(
estacion
);
_rg
.
Rg
.
ConfigurarPinpad
();
Log
.
Information
(
"Datos configurados. Ejecutando venta..."
);
return
await
EnviarVenta
(
monto
,
cuotas
);
Log
.
Information
(
"Configuración del servicio exitosa."
);
return
true
;
}
catch
(
Exception
ex
)
{
Log
.
Error
(
ex
,
"Fallo al configurar el servicio."
);
return
false
;
throw
;
}
}
public
async
Task
<
TransaccionResponse
>
EnviarVenta
(
decimal
monto
,
int
cuotas
)
public
async
Task
<
TransaccionResponse
>
EnviarVenta
(
decimal
monto
,
int
cuotas
)
{
string
codigo
=
string
.
Empty
;
...
...
@@ -200,6 +207,7 @@ namespace app_datafono_difare.Services
ref
iMid2
);
var
response
=
new
TransaccionResponse
{
ReferenceNumber
=
iAutorizacion
?.
Trim
(),
...
...
@@ -217,7 +225,8 @@ namespace app_datafono_difare.Services
Promotion
=
iPromocion
?.
Trim
(),
CodAdquiriente
=
iCodAdq
?.
Trim
(),
idAdquiriente
=
iAdq
?.
Trim
(),
LineItemType
=
ObtenerTipoTarjetaHelper
.
ObtenerTipoTarjetaPorBin
(
iTarjeta
?.
Trim
(),
_rutaBines
)
LineItemType
=
ObtenerTipoTarjetaHelper
.
ObtenerTipoTarjetaPorBin
(
iTarjeta
?.
Trim
(),
_rutaBines
),
IsDeclined
=
iCodRespuesta
?.
Trim
()
!=
"00"
};
var
json
=
JsonConvert
.
SerializeObject
(
response
);
...
...
app_datafono_difare/bin/Debug/net48/app_datafono_difare.exe
View file @
ac2007cc
No preview for this file type
app_datafono_difare/bin/Debug/net48/app_datafono_difare.pdb
View file @
ac2007cc
No preview for this file type
app_datafono_difare/bin/Debug/net48/logs/rest-pinpad20251202.log
View file @
ac2007cc
2025-12-02 11:26:36.416 -05:00 [INF] Iniciando servicio OWIN...
2025-12-02 11:26:36.454 -05:00 [INF] Inicializando RgFunciones...
2025-12-02 11:26:42.856 -05:00 [INF] Pinpad inicializado correctamente
2025-12-02 11:26:42.978 -05:00 [INF] Servicio REST running en http://localhost:9000
2025-12-02 11:29:38.168 -05:00 [INF] Esperando inicialización de la pinpad...
2025-12-02 11:29:39.177 -05:00 [INF] Preparando venta...
2025-12-02 11:29:40.183 -05:00 [INF] Enviando comando AUTORIZAR...
2025-12-02 11:30:00.901 -05:00 [INF] Respuesta cruda: PP00010000 AUTORIZACION OK. 00054800005511294120251202213656201204301791310101 000000000000 AMEX 03GUZMAN V./CESAR AMERICAN EXPRESS A000000025010402 40 D81F02C16732D1380480008000F800376650XXXXX7256 2605B971E505F0F8B6FFCF25CCAFE9524F3E94B73665FB50C52692F0AD020A4B79D3 D23509F2CC2F6193E0D99CD8A2D2ED5B
2025-12-02 11:30:01.050 -05:00 [INF] Resultado de la transacción: {"ReturnFlag":false,"DepositFlag":false,"VoidFlag":false,"Amount":123.45,"LineItemType":"TC","BalanceDueSatisfied":false,"ReferenceNumber":"213656","MaskedAccountNumber":"376650XXXXX7256","ResponseCode":"00","ApprovalCode":"","SequenceNumber":"000548","CashBackAmount":0.00,"IsDeclined":false,"ResponseCodeDescriptor":"00 AUTORIZACION OK.","Timestamp":"2025-12-02T11:29:41","CommerceCode":"000000817740","TerminalId":"20120430","RedCode":"01","Lote":"000055","Promotion":"","CodAdquiriente":"997","idAdquiriente":"CREDIMATIC01","CardBrand":"AMEX"}
2025-12-02 11:30:01.050 -05:00 [INF] Transacción procesada: 00 AUTORIZACION OK.
2025-12-02 11:30:26.344 -05:00 [INF] Deteniendo servicio REST...
2025-12-02 11:37:12.423 -05:00 [INF] Iniciando servicio OWIN...
2025-12-02 11:37:12.470 -05:00 [INF] Inicializando RgFunciones...
2025-12-02 11:37:25.497 -05:00 [INF] Pinpad inicializado correctamente
2025-12-02 11:37:25.706 -05:00 [INF] Servicio REST running en http://localhost:9000
2025-12-02 11:37:50.658 -05:00 [INF] Esperando inicialización de la pinpad...
2025-12-02 11:37:51.664 -05:00 [INF] Preparando venta...
2025-12-02 11:37:52.670 -05:00 [INF] Enviando comando AUTORIZAR...
2025-12-02 11:38:19.398 -05:00 [INF] Respuesta cruda: PP00010000 AUTORIZACION OK. 00054900005511375420251202213657201204301791310101 000000000000 AMEX 03GUZMAN V./CESAR AMERICAN EXPRESS A000000025010402 40 289A336DB942E9590480008000F800376650XXXXX7256 2605B971E505F0F8B6FFCF25CCAFE9524F3E94B73665FB50C52692F0AD020A4B79D3 B8076830EA3C0FE38A2ABF0EDD0D7151
2025-12-02 11:38:19.503 -05:00 [INF] Resultado de la transacción: {"ReturnFlag":false,"DepositFlag":false,"VoidFlag":false,"Amount":3.67,"LineItemType":"TC","BalanceDueSatisfied":false,"ReferenceNumber":"213657","MaskedAccountNumber":"376650XXXXX7256","ResponseCode":"00","ApprovalCode":"","SequenceNumber":"000549","CashBackAmount":0.00,"IsDeclined":false,"ResponseCodeDescriptor":"00 AUTORIZACION OK.","Timestamp":"2025-12-02T11:37:54","CommerceCode":"000000817740","TerminalId":"20120430","RedCode":"01","Lote":"000055","Promotion":"","CodAdquiriente":"997","idAdquiriente":"CREDIMATIC01","CardBrand":"AMEX"}
2025-12-02 11:38:19.503 -05:00 [INF] Transacción procesada: 00 AUTORIZACION OK.
2025-12-02 11:41:10.470 -05:00 [INF] Deteniendo servicio REST...
2025-12-02 15:38:00.225 -05:00 [INF] Iniciando servicio OWIN...
2025-12-02 15:38:00.642 -05:00 [INF] Servicio REST running en http://localhost:9000
2025-12-02 15:38:11.646 -05:00 [INF] Inicializando RgFunciones...
2025-12-02 15:38:19.029 -05:00 [INF] Configuración del servicio exitosa.
2025-12-02 15:38:49.386 -05:00 [INF] Esperando inicialización de la pinpad...
2025-12-02 15:38:50.394 -05:00 [INF] Preparando venta...
2025-12-02 15:38:51.403 -05:00 [INF] Enviando comando AUTORIZAR...
2025-12-02 15:39:09.215 -05:00 [INF] Respuesta cruda: PP00010000 AUTORIZACION OK. 00055400005515385220251202213672201204301791310101 000000000000 AMEX 03GUZMAN V./CESAR AMERICAN EXPRESS A000000025010402 40 ECCA4D18A4FF9A090480008000F800376650XXXXX7256 2605B971E505F0F8B6FFCF25CCAFE9524F3E94B73665FB50C52692F0AD020A4B79D3 D004C2E40ACC70E60CFBCFA0515F34F5
2025-12-02 15:39:09.295 -05:00 [INF] Resultado de la transacción: {"ReturnFlag":false,"DepositFlag":false,"VoidFlag":false,"Amount":3.69,"LineItemType":"TC","BalanceDueSatisfied":false,"ReferenceNumber":"213672","MaskedAccountNumber":"376650XXXXX7256","ResponseCode":"00","ApprovalCode":"","SequenceNumber":"000554","CashBackAmount":0.00,"IsDeclined":false,"ResponseCodeDescriptor":"00 AUTORIZACION OK.","Timestamp":"2025-12-02T15:38:52","CommerceCode":"000000817740","TerminalId":"20120430","RedCode":"01","Lote":"000055","Promotion":"","CodAdquiriente":"997","idAdquiriente":"CREDIMATIC01","CardBrand":"AMEX"}
2025-12-02 15:39:09.295 -05:00 [INF] Transacción procesada: 00 AUTORIZACION OK.
2025-12-02 15:42:43.721 -05:00 [INF] Esperando inicialización de la pinpad...
2025-12-02 15:42:44.736 -05:00 [INF] Preparando venta...
2025-12-02 15:42:45.741 -05:00 [INF] Enviando comando AUTORIZAR...
2025-12-02 15:43:48.083 -05:00 [INF] Esperando inicialización de la pinpad...
2025-12-02 15:43:49.095 -05:00 [INF] Preparando venta...
2025-12-02 15:43:50.108 -05:00 [INF] Enviando comando AUTORIZAR...
2025-12-02 15:44:05.216 -05:00 [INF] Respuesta cruda: PP00010000 AUTORIZACION OK. 00055500005515435120251202213673201204301791310101 000000000000 AMEX 03GUZMAN V./CESAR AMERICAN EXPRESS A000000025010402 40 70565F5B0FF022B30480008000F800376650XXXXX7256 2605B971E505F0F8B6FFCF25CCAFE9524F3E94B73665FB50C52692F0AD020A4B79D3 93D7617D6BD82C285AB98BEB507ADC6F
2025-12-02 15:44:05.217 -05:00 [INF] Resultado de la transacción: {"ReturnFlag":false,"DepositFlag":false,"VoidFlag":false,"Amount":3.69,"LineItemType":"TC","BalanceDueSatisfied":false,"ReferenceNumber":"213673","MaskedAccountNumber":"376650XXXXX7256","ResponseCode":"00","ApprovalCode":"","SequenceNumber":"000555","CashBackAmount":0.00,"IsDeclined":false,"ResponseCodeDescriptor":"00 AUTORIZACION OK.","Timestamp":"2025-12-02T15:43:51","CommerceCode":"000000817740","TerminalId":"20120430","RedCode":"01","Lote":"000055","Promotion":"","CodAdquiriente":"997","idAdquiriente":"CREDIMATIC01","CardBrand":"AMEX"}
2025-12-02 15:44:05.217 -05:00 [INF] Transacción procesada: 00 AUTORIZACION OK.
app_datafono_difare/obj/Debug/net48/app_datafono_difare.AssemblyInfo.cs
View file @
ac2007cc
...
...
@@ -14,7 +14,7 @@ using System.Reflection;
[
assembly
:
System
.
Reflection
.
AssemblyCompanyAttribute
(
"app_datafono_difare"
)]
[
assembly
:
System
.
Reflection
.
AssemblyConfigurationAttribute
(
"Debug"
)]
[
assembly
:
System
.
Reflection
.
AssemblyFileVersionAttribute
(
"1.0.0.0"
)]
[
assembly
:
System
.
Reflection
.
AssemblyInformationalVersionAttribute
(
"1.0.0+
04fe20e8976c747d72d4fac4c7098bd788327320
"
)]
[
assembly
:
System
.
Reflection
.
AssemblyInformationalVersionAttribute
(
"1.0.0+
f35288d8bff8fb4449d3161112f9827950f196fc
"
)]
[
assembly
:
System
.
Reflection
.
AssemblyProductAttribute
(
"app_datafono_difare"
)]
[
assembly
:
System
.
Reflection
.
AssemblyTitleAttribute
(
"app_datafono_difare"
)]
[
assembly
:
System
.
Reflection
.
AssemblyVersionAttribute
(
"1.0.0.0"
)]
...
...
app_datafono_difare/obj/Debug/net48/app_datafono_difare.AssemblyInfoInputs.cache
View file @
ac2007cc
89fe94b3a1790334b01ca9b7184a95ded0c9892a27140c14dba1b0ccb69061d2
c6404234db132dcf8f3425501600075aa91ec78250fd81563719d185b4a9da91
app_datafono_difare/obj/Debug/net48/app_datafono_difare.exe
View file @
ac2007cc
No preview for this file type
app_datafono_difare/obj/Debug/net48/app_datafono_difare.pdb
View file @
ac2007cc
No preview for this file type
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