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
85a9eecd
Commit
85a9eecd
authored
Apr 24, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indent
parent
b87e8ca2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
Payment.php
src/Entity/Payment.php
+14
-12
No files found.
src/Entity/Payment.php
View file @
85a9eecd
...
@@ -192,21 +192,23 @@ class Payment extends BasePayment
...
@@ -192,21 +192,23 @@ class Payment extends BasePayment
*/
*/
public
function
isRecurringPaymentEndedOrExpired
(
&
$reason
)
public
function
isRecurringPaymentEndedOrExpired
(
&
$reason
)
{
{
if
(
!
$this
->
details
if
(
||
!
array_key_exists
(
'vads_effective_creation_date'
,
$this
->
details
)
!
$this
->
details
||
!
array_key_exists
(
'vads_expiry_year'
,
$this
->
details
)
||
!
array_key_exists
(
'vads_effective_creation_date'
,
$this
->
details
)
||
!
array_key_exists
(
'vads_effective_creation_date'
,
$this
->
details
)
||
!
array_key_exists
(
'vads_expiry_year'
,
$this
->
details
)
||
!
array_key_exists
(
'vads_effective_creation_date'
,
$this
->
details
)
)
{
)
{
$reason
=
"Attribut détails vide ou clés absentes."
;
$reason
=
"Attribut détails vide ou clés absentes."
;
return
null
;
return
null
;
}
}
$firstDayOfCreationMonth
=
DateTime
::
createFromFormat
(
$firstDayOfCreationMonth
=
DateTime
::
createFromFormat
(
'Ymd'
,
substr
(
$this
->
details
[
'vads_effective_creation_date'
],
0
,
6
)
.
"01"
'Ymd'
,
substr
(
$this
->
details
[
'vads_effective_creation_date'
],
0
,
6
)
.
"01"
);
);
if
(
!
$firstDayOfCreationMonth
)
{
if
(
!
$firstDayOfCreationMonth
)
{
$reason
=
"Error parsing vads_effective_creation_date : "
.
$this
->
details
[
'vads_effective_creation_date'
];
$reason
=
"Error parsing vads_effective_creation_date : "
.
$this
->
details
[
'vads_effective_creation_date'
];
return
null
;
return
null
;
}
}
$day
=
$this
->
getRecurrenceMonthDay
()
?
$this
->
getRecurrenceMonthDay
()
-
1
:
0
;
//if not set assume first day of month (not a big deal anyway)
$day
=
$this
->
getRecurrenceMonthDay
()
?
$this
->
getRecurrenceMonthDay
()
-
1
:
0
;
//if not set assume first day of month (not a big deal anyway)
$dateOfFirstOccurenceAfterInitialPayment
=
$firstDayOfCreationMonth
->
modify
(
$dateOfFirstOccurenceAfterInitialPayment
=
$firstDayOfCreationMonth
->
modify
(
"+"
.
$day
.
" days next month"
"+"
.
$day
.
" days next month"
...
@@ -219,11 +221,11 @@ class Payment extends BasePayment
...
@@ -219,11 +221,11 @@ class Payment extends BasePayment
:
null
;
//assume no end date if recurrenceMonthsCount not set
:
null
;
//assume no end date if recurrenceMonthsCount not set
//Now check expiry date
//Now check expiry date
$paymentEndDateDueToExpiry
=
new
DateTime
();
$paymentEndDateDueToExpiry
=
new
DateTime
();
$paymentEndDateDueToExpiry
->
setDate
(
$this
->
details
[
'vads_expiry_year'
],
$this
->
details
[
'vads_expiry_month'
],
$day
+
1
);
$paymentEndDateDueToExpiry
->
setDate
(
$this
->
details
[
'vads_expiry_year'
],
$this
->
details
[
'vads_expiry_month'
],
$day
+
1
);
$now
=
new
DateTime
();
$now
=
new
DateTime
();
if
(
$paymentEndDate
&&
$paymentEndDate
<
$paymentEndDateDueToExpiry
)
{
if
(
$paymentEndDate
&&
$paymentEndDate
<
$paymentEndDateDueToExpiry
)
{
//Compare now with payment end date
//Compare now with payment end date
$reason
=
"Paiement récurrent en cours jusqu'à dernière échéance le "
.
$paymentEndDate
->
format
(
'd/m/Y'
)
.
"."
;
$reason
=
"Paiement récurrent en cours jusqu'à dernière échéance le "
.
$paymentEndDate
->
format
(
'd/m/Y'
)
.
"."
;
return
$now
>=
$paymentEndDate
;
return
$now
>=
$paymentEndDate
;
...
...
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