Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smsManager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cristian Mauricio Diaz Canales
smsManager
Commits
2cfa944e
Commit
2cfa944e
authored
May 23, 2019
by
Cristian Mauricio Diaz Canales
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
actualizacion command
parent
cfe93862
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
122 deletions
+139
-122
src/BackendBundle/Command/McafeeMigrarPendientesCommand.php
src/BackendBundle/Command/McafeeMigrarPendientesCommand.php
+139
-122
No files found.
src/BackendBundle/Command/McafeeMigrarPendientesCommand.php
View file @
2cfa944e
...
...
@@ -15,48 +15,67 @@ use AppBundle\Model\McafeeTransaccionPendiente;
use
AppBundle\Model\McafeeTransaccionPendienteQuery
;
use
AppBundle\Lib\Utiles
;
class
McafeeMigrarPendientesCommand
extends
ContainerAwareCommand
{
class
McafeeMigrarPendientesCommand
extends
ContainerAwareCommand
{
const
LENGUAJE
=
"es"
;
const
TIMEOUT
=
20
;
const
SKU_DESTINY
=
"419-92860-1usermds"
;
protected
function
configure
()
{
protected
function
configure
()
{
$this
->
setName
(
'mcafee:migrar-pendientes'
)
->
setDescription
(
'Proceso que migra todos los usuarios que hayan quedado en la tabla de pendientes.'
)
;
}
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
{
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
{
$output
->
writeln
(
"COMANDO INICIADO."
);
$log
=
Utiles
::
setLog
(
'command::migrarUsuariosSuscripcion'
,
'ws/wsMigrarUsuariosPendientesMcAfee'
);
$failedAlready
=
false
;
$contadorIntento
=
0
;
$mcAfeePartnerId
=
Utiles
::
getParametroConfiguracion
(
'mcafee_partner_id'
);
$numero_usuarios_pendientes
=
Utiles
::
getParametroConfiguracion
(
"numero_usuarios_pendientes"
);
$usuariosPendientes
=
McafeeTransaccionPendienteQuery
::
create
()
->
filterByMtpEstado
(
McafeeTransaccionPendiente
::
ESTADO_PENDIENTE
)
->
limit
(
$numero_usuarios_pendientes
)
->
find
();
$log
->
debug
(
"usuarios pendientes a procesar : "
.
count
(
$usuariosPendientes
));
$log
->
debug
(
"usuarios pendientes a procesar : "
.
count
(
$usuariosPendientes
));
foreach
(
$usuariosPendientes
as
$index
=>
$usuarioPendiente
)
:
foreach
(
$usuariosPendientes
as
$index
=>
$usuarioPendiente
)
:
$mcAfeeTx
=
McafeeTransaccionQuery
::
create
()
->
filterByUmcId
(
$usuarioPendiente
->
getUmcId
())
->
filterByMtrEstado
(
McafeeTransaccion
::
ESTADO_FRACASADA
)
->
findOne
();
if
(
!
$mcAfeeTx
)
{
$log
->
debug
(
"No tiene existe una transaccion asociada para el usuario con id "
.
$usuarioPendiente
->
getUmcId
());
}
else
{
$log
->
debug
(
"Transaccion a procesar ."
.
print_r
(
$mcAfeeTx
,
true
));
if
(
!
$mcAfeeTx
)
{
$log
->
debug
(
"No tiene existe una transaccion asociada para el usuario con id "
.
$usuarioPendiente
->
getUmcId
());
}
else
{
$log
->
debug
(
"Transaccion a procesar ."
.
print_r
(
$mcAfeeTx
,
true
));
$usuario
=
$usuarioPendiente
->
getUsuarioMcafee
();
$xmlPartnerContext
=
$mcAfeeTx
->
getMtrXmlEnvio
();
$mcAfeeTx
->
generarNroReferencia
();
$mcAfeeTx
->
save
();
$xmlPartnerContext
=
'<PARTNERCONTEXT>
<HEADER>
<PARTNER PARTNER_ID="'
.
$mcAfeePartnerId
.
'"/>
</HEADER>
<DATA>
<CUSTOMERCONTEXT ID="'
.
$usuario
->
getUmcMcafeeCcid
()
.
'" REQUESTTYPE="UPDATE">
<ACCOUNT/>
<ORDER PARTNERREF="'
.
$mcAfeeTx
->
getMtrReferencia
()
.
'" REF="">
<ITEMS>
<ITEM SKU="'
.
self
::
SKU_DESTINY
.
'" QTY="1" ACTION="TU">
<SOURCESKU>'
.
$usuario
->
getUmcMcafeeSku
()
.
'</SOURCESKU></ITEM>
</ITEMS>
</ORDER>
</CUSTOMERCONTEXT>
</DATA>
</PARTNERCONTEXT> '
;
$log
->
debug
(
"xml generado para el item :"
.
$xmlPartnerContext
);
$peticion
=
array
(
'requestXML'
=>
$xmlPartnerContext
);
$mcAfeeTx
->
setMtrXmlEnvio
(
$xmlPartnerContext
);
$mcAfeeTx
->
save
();
$log
->
debug
(
'Peticion a McAfee->'
.
print_r
(
$peticion
,
true
));
///INICIO PETICION MCAFEE
...
...
@@ -168,8 +187,6 @@ class McafeeMigrarPendientesCommand extends ContainerAwareCommand
$mcAfeeTx
->
save
();
$failedAlready
=
true
;
}
}
$failedAlready
=
false
;
...
...
@@ -210,7 +227,7 @@ class McafeeMigrarPendientesCommand extends ContainerAwareCommand
// </RESPONSECONTEXT>
// </DATA>
//</PARTNERRESPONSECONTEXT>
$log
->
debug
(
"objeto xml "
.
print_r
(
$xObjRespuesta
,
true
));
$log
->
debug
(
"objeto xml "
.
print_r
(
$xObjRespuesta
,
true
));
$arrayRespuesta
[
'mcAfeePartnerId'
]
=
(
string
)
$xObjRespuesta
->
HEADER
->
PARTNER
->
attributes
()
->
PARTNER_ID
;
$arrayRespuesta
[
'mcAfeeCostumerId'
]
=
(
string
)
$xObjRespuesta
->
DATA
->
RESPONSECONTEXT
->
attributes
()
->
ID
;
$arrayRespuesta
[
'mcAfeeReturnCode'
]
=
(
string
)
$xObjRespuesta
->
DATA
->
RESPONSECONTEXT
->
RETURNCODE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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