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
1
Merge Requests
1
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
d4cd8df1
Commit
d4cd8df1
authored
Mar 26, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to catch recurring payment occurence
parent
4cee20f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
PaymentController.php
src/Controller/PaymentController.php
+15
-13
No files found.
src/Controller/PaymentController.php
View file @
d4cd8df1
...
...
@@ -150,22 +150,24 @@ class PaymentController extends AbstractController
*/
public
function
notifyRecurringPaymentAction
(
Request
$request
)
{
try
{
$token
=
$this
->
payum
->
getHttpRequestVerifier
()
->
verify
(
$request
);
}
catch
(
\Exception
$e
)
{
// Token expired
return
new
Response
(
"Token expired"
);
$vads_cust_email
=
$request
->
request
->
get
(
"vads_cust_email"
);
$recurringPayments
=
$this
->
em
->
getRepository
(
Payment
::
class
)
->
findBy
([
'isRecurrent'
=>
true
,
'clientEmail'
=>
$vads_cust_email
,
]);
if
(
!
$recurringPayments
)
{
return
new
Response
(
"No recurring payments with email "
.
$vads_cust_email
);
}
// Get payment
$gateway
=
$this
->
payum
->
getGateway
(
$token
->
getGatewayName
());
$gateway
->
execute
(
$status
=
new
GetHumanStatus
(
$token
));
$payment
=
$status
->
getFirstModel
();
if
(
$payment
->
getIsRecurrent
())
{
$gateway
->
execute
(
new
Notify
(
$token
));
return
new
Response
(
"Execute notify recurring payment"
);
$vads_identifier
=
$request
->
request
->
get
(
"vads_identifier"
);
foreach
(
$recurringPayments
as
$rp
)
{
$details
=
json_decode
(
$rp
->
getDetails
(),
true
);
if
(
$details
[
'vads_identifier'
]
==
$vads_identifier
)
{
return
new
Response
(
"Found matching recurring payment !"
);
}
}
return
new
Response
(
"
Payment is not marked recurring."
);
return
new
Response
(
"
No recurring payments with vads_identifier "
.
$vads_identifier
);
}
/**
...
...
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