Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
87c7feeb
Commit
87c7feeb
authored
May 30, 2024
by
Damien Moulard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '6366-authorized-vs-authorised-and-another-detail' into ssa-gironde
parents
c5192036
8414ff8a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
17 deletions
+31
-17
PaymentController.php
src/Controller/PaymentController.php
+18
-7
PaymentStatusExtension.php
src/EventListener/PaymentStatusExtension.php
+11
-8
PaymentUtils.php
src/Utils/PaymentUtils.php
+2
-2
No files found.
src/Controller/PaymentController.php
View file @
87c7feeb
...
...
@@ -200,6 +200,9 @@ class PaymentController extends AbstractController
* Voie 3 : le traitement de la requête se fait finalement simplement dans notifyRecurringPaymentAction sans utiliser
* les mécanismes complexes de Payum.
*
* Pour d'autres problèmes avec Payum, voir aussi les commentaires liés à
* l'utilisation de GetHumanStatus::STATUS_AUTHORIZED.
*
* Yvon KERDONCUFF
* 26/03/2024
*/
...
...
@@ -240,15 +243,14 @@ class PaymentController extends AbstractController
&&
array_key_exists
(
'vads_identifier'
,
$payment
->
getDetails
())
&&
$payment
->
getDetails
()[
'vads_identifier'
]
==
$vads_identifier
)
{
if
(
GetHumanStatus
::
STATUS_CAPTURED
==
$new_status
||
GetHumanStatus
::
STATUS_AUTHORIZED
==
$new_status
)
{
// Payum GetHumanStatus constants don't match Payzen vads_trans_status here
// e.g. GetHumanStatus::STATUS_AUTHORIZED does not match 'authorised' value sent by Payzen
if
(
in_array
(
$new_status
,
[
'captured'
,
'authorised'
,
GetHumanStatus
::
STATUS_CAPTURED
,
GetHumanStatus
::
STATUS_AUTHORIZED
]))
{
$this
->
paymentUtils
->
handlePayzenNotificationCore
(
$payment
);
$this
->
em
->
flush
();
}
return
new
Response
(
'Recurring payment occurence taken into account.
'
,
200
);
//for debug purpose, display vads_trans_status in payzen backoffice
return
new
Response
(
'Recurring payment occurence taken into account.
vads_trans_status = '
.
$new_status
,
200
);
}
}
//return error
...
...
@@ -281,7 +283,16 @@ class PaymentController extends AbstractController
}
// Set flash message according to payment status
if
(
GetHumanStatus
::
STATUS_CAPTURED
==
$payment
->
getStatus
()
||
GetHumanStatus
::
STATUS_AUTHORIZED
==
$payment
->
getStatus
())
{
/* WARNING : THIS PIECE OF CODE IS USING INAPPROPRIATE GetHumanStatus::STATUS_AUTHORIZED :
*
* This is (another) issue here with Payum.
* current_payment_status will never match STATUS_AUTHORIZED
* on the opposite, we have no chance to detect 'authorised' value here
* because Payzen vads_trans_status is written 'authorised' and not 'authorized'
*
* @see comment above notifyRecurringPaymentAction for more Payum weird stuff
*/
if
(
in_array
(
$payment
->
getStatus
(),
[
'captured'
,
'authorised'
,
GetHumanStatus
::
STATUS_CAPTURED
,
GetHumanStatus
::
STATUS_AUTHORIZED
]))
{
$type
=
$payment
->
getDescription
();
if
(
Payment
::
TYPE_ACHAT_MONNAIE_ADHERENT
==
$type
||
Payment
::
TYPE_ACHAT_MONNAIE_PRESTA
==
$type
)
{
...
...
src/EventListener/PaymentStatusExtension.php
View file @
87c7feeb
...
...
@@ -84,14 +84,17 @@ class PaymentStatusExtension implements ExtensionInterface
$current_payment_status
=
$payment
->
getStatus
();
$new_status
=
$status
->
getValue
();
if
(
GetHumanStatus
::
STATUS_CAPTURED
!==
$current_payment_status
&&
GetHumanStatus
::
STATUS_AUTHORIZED
!=
$current_payment_status
)
{
if
(
GetHumanStatus
::
STATUS_CAPTURED
==
$new_status
||
GetHumanStatus
::
STATUS_AUTHORIZED
==
$new_status
)
{
/* WARNING : THIS PIECE OF CODE IS USING INAPPROPRIATE GetHumanStatus::STATUS_AUTHORIZED :
*
* This is (another) issue here with Payum.
* current_payment_status will never match STATUS_AUTHORIZED
* on the opposite, we have no chance to detect 'authorised' value here
* because Payzen vads_trans_status is written 'authorised' and not 'authorized'
*
* @see comment above notifyRecurringPaymentAction for more Payum weird stuff
*/
if
(
!
in_array
(
$current_payment_status
,
[
'captured'
,
'authorised'
,
GetHumanStatus
::
STATUS_CAPTURED
,
GetHumanStatus
::
STATUS_AUTHORIZED
]))
{
if
(
in_array
(
$new_status
,
[
'captured'
,
'authorised'
,
GetHumanStatus
::
STATUS_CAPTURED
,
GetHumanStatus
::
STATUS_AUTHORIZED
])
)
{
$this
->
paymentUtils
->
handlePayzenNotificationCore
(
$payment
);
// Invalidate (delete) notify token after payment is captured
$this
->
em
->
remove
(
$token
);
...
...
src/Utils/PaymentUtils.php
View file @
87c7feeb
...
...
@@ -212,7 +212,7 @@ class PaymentUtils
$payment
->
setClientId
(
$user
->
getId
());
$payment
->
setExtraData
(
''
);
$this
->
em
->
persist
(
$payment
);
}
else
if
(
Payment
::
TYPE_PAIEMENT_COTISATION_TAV
==
$type
||
Payment
::
TYPE_PAIEMENT_RECURRENT_COTISATION_TAV
)
{
}
else
if
(
Payment
::
TYPE_PAIEMENT_COTISATION_TAV
==
$type
||
Payment
::
TYPE_PAIEMENT_RECURRENT_COTISATION_TAV
==
$type
)
{
$flux
=
$this
->
serializer
->
deserialize
(
$payment
->
getFluxData
(),
AchatMonnaieAdherent
::
class
,
...
...
@@ -247,7 +247,7 @@ class PaymentUtils
$this
->
em
->
persist
(
$flux
);
$this
->
operationUtils
->
executeOperations
(
$flux
);
if
(
Payment
::
TYPE_PAIEMENT_COTISATION_TAV
==
$type
||
Payment
::
TYPE_PAIEMENT_RECURRENT_COTISATION_TAV
)
{
if
(
Payment
::
TYPE_PAIEMENT_COTISATION_TAV
==
$type
||
Payment
::
TYPE_PAIEMENT_RECURRENT_COTISATION_TAV
==
$type
)
{
// Create new flux for cotisation, depending on process
if
(
$this
->
container
->
getParameter
(
'household_based_allowance'
))
{
$this
->
tavCotisationsUtils
->
applyHouseholdAllowance
(
$flux
);
...
...
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