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
c3f3fb0b
Commit
c3f3fb0b
authored
May 23, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
authorized vs authorised : fix code, add debug code and comment
parent
38241d8e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
PaymentController.php
src/Controller/PaymentController.php
+19
-6
PaymentStatusExtension.php
src/EventListener/PaymentStatusExtension.php
+11
-0
No files found.
src/Controller/PaymentController.php
View file @
c3f3fb0b
...
...
@@ -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
)
{
// Do not use GetHumanStatus Payum constants as they do not match Payzen vads_trans_status
// e.g. GetHumanStatus::STATUS_AUTHORIZED does not match 'authorised' value sent by Payzen
if
(
'captured'
==
$new_status
||
'authorised'
==
$new_status
)
{
$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,6 +283,17 @@ class PaymentController extends AbstractController
}
// Set flash message according to payment 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'
* However this code seems to work and I don't want to break it as this is Payum dependent
* and uses mechanisms I don't understand.
*
* @see comment above notifyRecurringPaymentAction for more Payum weird stuff
*/
if
(
GetHumanStatus
::
STATUS_CAPTURED
==
$payment
->
getStatus
()
||
GetHumanStatus
::
STATUS_AUTHORIZED
==
$payment
->
getStatus
())
{
$type
=
$payment
->
getDescription
();
...
...
src/EventListener/PaymentStatusExtension.php
View file @
c3f3fb0b
...
...
@@ -84,6 +84,17 @@ class PaymentStatusExtension implements ExtensionInterface
$current_payment_status
=
$payment
->
getStatus
();
$new_status
=
$status
->
getValue
();
/* 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'
* However this code seems to work and I don't want to break it as this is Payum dependent
* and uses mechanisms I don't understand.
*
* @see comment above notifyRecurringPaymentAction for more Payum weird stuff
*/
if
(
GetHumanStatus
::
STATUS_CAPTURED
!==
$current_payment_status
&&
GetHumanStatus
::
STATUS_AUTHORIZED
!=
$current_payment_status
...
...
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