Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
musica_listas_umusic
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
musica_listas_umusic
Commits
91ec908c
Commit
91ec908c
authored
Sep 30, 2019
by
Cristian Mauricio Diaz Canales
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actualizacion composer
parent
83b18dbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
105 deletions
+106
-105
src/FrontendBundle/Controller/PagosController.php
src/FrontendBundle/Controller/PagosController.php
+106
-105
No files found.
src/FrontendBundle/Controller/PagosController.php
View file @
91ec908c
<?php
namespace
App\FrontendBundle\Controller
;
use
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
;
use
Symfony\Component\HttpFoundation\RedirectResponse
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Symfony\Component\HttpFoundation\Request
;
use
Doctrine\ORM\EntityManagerInterface
;
use
App\Entity\PluRelacionesListas
;
use
App\Entity\PluLista
;
use
App\Entity\PluSuscripcion
;
use
App\Entity\PluMetodoPago
;
use
App\Utilities\Utiles
;
use
App\Utilities\Kushki
;
class
PagosController
extends
AbstractController
{
public
function
confirmacion
(
Request
$request
)
:
Response
{
$log
=
Utiles
::
setLog
(
'App\FrontendBundle\Controller::PagosController::confirmacion'
,
'app/frontend/kushki/confirmacion'
);
$em
=
$this
->
getDoctrine
()
->
getManager
(
'default'
);
$ua
=
$request
->
headers
->
get
(
'User-Agent'
);
$headers
=
$request
->
headers
->
all
();
$content
=
$request
->
getContent
();
$json
=
new
JsonResponse
();
$fechaActual
=
new
\DateTime
();
$fechaInicioKushki
=
new
\DateTime
();
$fechaInicioKushki
->
modify
(
'+1 days'
);
$fecha
=
new
\DateTime
();
$fechaUnaSemana
=
$fecha
->
modify
(
'+7 days'
);
$log
->
debug
(
"leyendo parametros de la transaccion kushki...."
);
$kushkiToken
=
$request
->
get
(
'kushkiToken'
);
$kushkiPaymentMethod
=
$request
->
get
(
'kushkiPaymentMethod'
);
$userIdentifier
=
$request
->
get
(
'userIdentifier'
);
$productId
=
$request
->
get
(
'productId'
);
$productName
=
$request
->
get
(
'productName'
);
$productPrice
=
$request
->
get
(
'productPrice'
);
$listas
=
$em
->
getRepository
(
PluLista
::
class
)
->
getListasVigentes
(
$userIdentifier
);
$lista
=
$em
->
getRepository
(
PluLista
::
class
)
->
find
(
$productId
);
$log
->
debug
(
"generando objeto de suscripcion relacionado a pago con kushki...."
);
$suscripcion
=
new
PluSuscripcion
();
$suscripcion
->
setLisId
(
$lista
);
$suscripcion
->
setSusTipoSuscripcion
(
PluSuscripcion
::
TIPO_SUSCRIPCION_KUSHKI
);
$suscripcion
->
setSusMsisdn
(
$userIdentifier
);
$suscripcion
->
setSusInicio
(
$fechaActual
);
$suscripcion
->
setSusFin
(
$fechaUnaSemana
);
$suscripcion
->
setSusVigente
(
PluSuscripcion
::
NO_VIGENTE
);
$suscripcion
->
setSusEliminado
(
PluSuscripcion
::
ELIMINADO_FALSE
);
$suscripcion
->
setSusUltimoTipoKushki
(
PluSuscripcion
::
TIPO_KUSHKI_SUSCRIPCION
);
$suscripcion
->
setSusTokenKushki
(
$kushkiToken
);
$suscripcion
->
setSusPayTypeKushki
(
$kushkiPaymentMethod
);
$suscripcion
->
setSusStartDateKushki
(
$fechaInicioKushki
->
format
(
'Y-m-d'
));
$suscripcion
->
setCreatedAt
(
new
\DateTime
());
$suscripcion
->
setUpdatedAt
(
new
\DateTime
());
$em
->
persist
(
$suscripcion
);
$em
->
flush
();
$log
->
debug
(
"generando registro de metodo de pago..."
);
$metodoPago
=
new
PluMetodoPago
();
$metodoPago
->
setMpaSusId
(
$suscripcion
->
getSusId
());
$metodoPago
->
setMpaUserIdentifier
(
$userIdentifier
);
$metodoPago
->
setMpaTipo
(
PluMetodoPago
::
TIPO_NO_VIGENTE
);
$metodoPago
->
setMpaPrecio
(
$lista
->
getLisPrecio
());
$metodoPago
->
setMpaEstadoPago
(
PluMetodoPago
::
ESTADO_PAGO_NOK
);
$metodoPago
->
setMpaEstado
(
PluMetodoPago
::
ESTADO_NO_VALIDO
);
$metodoPago
->
setMpaEliminado
(
PluMetodoPago
::
ELIMINADO_FALSE
);
$metodoPago
->
setCreatedAt
(
new
\DateTime
());
$metodoPago
->
setUpdatedAt
(
new
\DateTime
());
$em
->
persist
(
$metodoPago
);
$em
->
flush
();
$log
->
debug
(
"realizando peticion a gateway de kushki - SUSCRIPCION...."
);
//llamada a curl de gateway-suscripcion
$kushkiSuscripcion
=
new
Kushki
();
$kushkiSuscripcion
->
setToken
(
$kushkiToken
);
$kushkiSuscripcion
->
setUserIdentifier
(
$userIdentifier
);
$kushkiSuscripcion
->
setInternalId
(
$suscripcion
->
getSusId
());
$kushkiSuscripcion
->
setPeriodicity
(
Utiles
::
getParametroConfiguracion
(
"periodoSuscripcion"
,
$em
));
$kushkiSuscripcion
->
setProductDescription
(
"Lista"
);
$kushkiSuscripcion
->
setProductName
(
$productName
);
$kushkiSuscripcion
->
setProductPrice
(
$productPrice
);
$kushkiSuscripcion
->
setName
(
null
);
$kushkiSuscripcion
->
setLastName
(
null
);
$kushkiSuscripcion
->
setEmail
(
null
);
$result
=
$kushkiSuscripcion
->
callSuscripcionKushki
(
$em
);
$log
->
debug
(
$result
);
$log
->
debug
(
"datos recolectados status : "
.
print_r
(
$content
,
true
));
return
$this
->
render
(
'frontend/paginas/confirm.html.twig'
,
[
"listas"
=>
$listas
,
"msisdn"
=>
$userIdentifier
]);
}
}
<?php
namespace
App\FrontendBundle\Controller
;
use
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
;
use
Symfony\Component\HttpFoundation\RedirectResponse
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Symfony\Component\HttpFoundation\Request
;
use
Doctrine\ORM\EntityManagerInterface
;
use
App\Entity\PluRelacionesListas
;
use
App\Entity\PluLista
;
use
App\Entity\PluSuscripcion
;
use
App\Entity\PluMetodoPago
;
use
App\Utilities\Utiles
;
use
App\Utilities\Kushki
;
class
PagosController
extends
AbstractController
{
public
function
confirmacion
(
Request
$request
)
:
Response
{
$log
=
Utiles
::
setLog
(
'App\FrontendBundle\Controller::PagosController::confirmacion'
,
'app/frontend/kushki/confirmacion'
);
$em
=
$this
->
getDoctrine
()
->
getManager
(
'default'
);
$ua
=
$request
->
headers
->
get
(
'User-Agent'
);
$headers
=
$request
->
headers
->
all
();
$content
=
$request
->
getContent
();
$json
=
new
JsonResponse
();
$fechaActual
=
new
\DateTime
();
$fechaInicioKushki
=
new
\DateTime
();
$fechaInicioKushki
->
modify
(
'+1 days'
);
$fecha
=
new
\DateTime
();
$fechaUnaSemana
=
$fecha
->
modify
(
'+7 days'
);
$log
->
debug
(
"leyendo parametros de la transaccion kushki...."
);
$kushkiToken
=
$request
->
get
(
'kushkiToken'
);
$kushkiPaymentMethod
=
$request
->
get
(
'kushkiPaymentMethod'
);
$userIdentifier
=
$request
->
get
(
'userIdentifier'
);
$productId
=
$request
->
get
(
'productId'
);
$productName
=
$request
->
get
(
'productName'
);
$productPrice
=
$request
->
get
(
'productPrice'
);
$listas
=
$em
->
getRepository
(
PluLista
::
class
)
->
getListasVigentes
(
$userIdentifier
);
$lista
=
$em
->
getRepository
(
PluLista
::
class
)
->
find
(
$productId
);
$log
->
debug
(
"generando objeto de suscripcion relacionado a pago con kushki...."
);
$suscripcion
=
new
PluSuscripcion
();
$suscripcion
->
setLisId
(
$lista
);
$suscripcion
->
setSusTipoSuscripcion
(
PluSuscripcion
::
TIPO_SUSCRIPCION_KUSHKI
);
$suscripcion
->
setSusMsisdn
(
$userIdentifier
);
$suscripcion
->
setSusInicio
(
$fechaActual
);
$suscripcion
->
setSusFin
(
$fechaUnaSemana
);
$suscripcion
->
setSusVigente
(
PluSuscripcion
::
NO_VIGENTE
);
$suscripcion
->
setSusEliminado
(
PluSuscripcion
::
ELIMINADO_FALSE
);
$suscripcion
->
setSusUltimoTipoKushki
(
PluSuscripcion
::
TIPO_KUSHKI_SUSCRIPCION
);
$suscripcion
->
setSusTokenKushki
(
$kushkiToken
);
$suscripcion
->
setSusPayTypeKushki
(
$kushkiPaymentMethod
);
$suscripcion
->
setSusStartDateKushki
(
$fechaInicioKushki
->
format
(
'Y-m-d'
));
$suscripcion
->
setCreatedAt
(
new
\DateTime
());
$suscripcion
->
setUpdatedAt
(
new
\DateTime
());
$em
->
persist
(
$suscripcion
);
$em
->
flush
();
$log
->
debug
(
"generando registro de metodo de pago..."
);
$metodoPago
=
new
PluMetodoPago
();
$metodoPago
->
setMpaSusId
(
$suscripcion
->
getSusId
());
$metodoPago
->
setMpaUserIdentifier
(
$userIdentifier
);
$metodoPago
->
setMpaTipo
(
PluMetodoPago
::
TIPO_NO_VIGENTE
);
$metodoPago
->
setMpaPrecio
(
$lista
->
getLisPrecio
());
$metodoPago
->
setMpaEstadoPago
(
PluMetodoPago
::
ESTADO_PAGO_NOK
);
$metodoPago
->
setMpaEstado
(
PluMetodoPago
::
ESTADO_NO_VALIDO
);
$metodoPago
->
setMpaEliminado
(
PluMetodoPago
::
ELIMINADO_FALSE
);
$metodoPago
->
setCreatedAt
(
new
\DateTime
());
$metodoPago
->
setUpdatedAt
(
new
\DateTime
());
$em
->
persist
(
$metodoPago
);
$em
->
flush
();
$log
->
debug
(
"realizando peticion a gateway de kushki - SUSCRIPCION...."
);
//llamada a curl de gateway-suscripcion
$kushkiSuscripcion
=
new
Kushki
();
$kushkiSuscripcion
->
setToken
(
$kushkiToken
);
$kushkiSuscripcion
->
setUserIdentifier
(
$userIdentifier
);
$kushkiSuscripcion
->
setInternalId
(
$suscripcion
->
getSusId
());
$kushkiSuscripcion
->
setPeriodicity
(
Utiles
::
getParametroConfiguracion
(
"periodoSuscripcion"
,
$em
));
$kushkiSuscripcion
->
setProductDescription
(
"Lista"
);
$kushkiSuscripcion
->
setProductName
(
$productName
);
$kushkiSuscripcion
->
setProductPrice
(
$productPrice
);
$kushkiSuscripcion
->
setName
(
null
);
$kushkiSuscripcion
->
setLastName
(
null
);
$kushkiSuscripcion
->
setEmail
(
null
);
$kushkiSuscripcion
->
setSubscriptionStartDate
(
$suscripcion
->
getSusStartDateKushki
());
$result
=
$kushkiSuscripcion
->
callSuscripcionKushki
(
$em
);
$log
->
debug
(
$result
);
$log
->
debug
(
"datos recolectados status : "
.
print_r
(
$content
,
true
));
return
$this
->
render
(
'frontend/paginas/confirm.html.twig'
,
[
"listas"
=>
$listas
,
"msisdn"
=>
$userIdentifier
]);
}
}
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