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
3
Merge Requests
3
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
502980aa
Commit
502980aa
authored
Mar 21, 2024
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: reccurent payment
parent
58636b48
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
5 deletions
+114
-5
CaptureAction.php
lib/ekyna/payum-payzen/Action/CaptureAction.php
+8
-4
Api.php
lib/ekyna/payum-payzen/Api/Api.php
+0
-1
PaymentController.php
src/Controller/PaymentController.php
+7
-0
Payment.php
src/Entity/Payment.php
+68
-0
Version20240321105448.php
src/Migrations/Version20240321105448.php
+31
-0
No files found.
lib/ekyna/payum-payzen/Action/CaptureAction.php
View file @
502980aa
...
...
@@ -63,14 +63,18 @@ class CaptureAction implements ActionInterface, GatewayAwareInterface, GenericTo
}
// TODO : here ?
// Set recurrent payment data if needed
$payment
=
$request
->
getFirstModel
();
if
(
'paiement_recurrent_cotisation_tav'
==
$payment
->
getDescription
())
{
// TODO right way to check type
if
(
true
==
$payment
->
getIsRecurrent
())
{
$model
[
'vads_page_action'
]
=
'REGISTER_PAY_SUBSCRIBE'
;
$model
[
'vads_sub_amount'
]
=
"1000"
;
// TODO get params
$model
[
'vads_sub_amount'
]
=
strval
(
$payment
->
getRecurrenceAmount
());
// 1000 for 10.00 EUR
$model
[
'vads_sub_currency'
]
=
$model
[
'vads_currency'
];
$model
[
'vads_sub_effect_date'
]
=
(
new
\DateTime
(
'
now'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'Ymd'
);
$model
[
'vads_sub_effect_date'
]
=
(
new
\DateTime
(
'
tomorrow'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'Ymd'
);
// tomorrow, to avoid duplicate payment this day
$model
[
'vads_sub_desc'
]
=
'RRULE:FREQ=DAILY;INTERVAL=1;COUNT=2'
;
// $model['vads_sub_desc'] = 'RRULE:FREQ=MONTHLY;COUNT=12;BYMONTHDAY=10';
// $monthsCount = $payment->getRecurrenceMonthsCount();
// $monthDay = $payment->getRecurrenceMonthDay();
// $model['vads_sub_desc'] = "RRULE:FREQ=MONTHLY;COUNT={$monthsCount};BYMONTHDAY={$monthDay}";
}
}
...
...
lib/ekyna/payum-payzen/Api/Api.php
View file @
502980aa
...
...
@@ -126,7 +126,6 @@ class Api
$data
=
$this
->
getRequestOptionsResolver
()
->
resolve
(
array_replace
(
$data
,
[
'vads_page_action'
=>
'PAYMENT'
,
'vads_version'
=>
'V2'
,
]));
...
...
src/Controller/PaymentController.php
View file @
502980aa
...
...
@@ -114,6 +114,13 @@ class PaymentController extends AbstractController
$payment
->
setClientEmail
(
$this
->
getUser
()
->
getEmail
());
}
if
(
$type
==
Payment
::
TYPE_PAIEMENT_RECURRENT_COTISATION_TAV
)
{
$payment
->
setRecurrenceAmount
(
$form
->
get
(
'montant'
)
->
getData
()
*
100
);
$payment
->
setIsRecurrent
(
true
);
$payment
->
setRecurrenceMonthsCount
(
$form
->
get
(
'nombreMois'
)
->
getData
());
$payment
->
setRecurrenceMonthDay
(
$form
->
get
(
'jourPrelevement'
)
->
getData
());
}
$storage
->
update
(
$payment
);
$captureToken
=
$this
->
payum
->
getTokenFactory
()
->
createCaptureToken
(
...
...
src/Entity/Payment.php
View file @
502980aa
...
...
@@ -56,6 +56,26 @@ class Payment extends BasePayment
protected
$extra_data
;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
private
$isRecurrent
;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private
$recurrenceMonthsCount
;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private
$recurrenceMonthDay
;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private
$recurrenceAmount
;
/**
* @return string
*/
public
function
getStatus
()
:
?
string
...
...
@@ -114,4 +134,52 @@ class Payment extends BasePayment
return
$this
;
}
public
function
getIsRecurrent
()
:
?
bool
{
return
$this
->
isRecurrent
;
}
public
function
setIsRecurrent
(
bool
$isRecurrent
)
:
self
{
$this
->
isRecurrent
=
$isRecurrent
;
return
$this
;
}
public
function
getRecurrenceMonthsCount
()
:
?
int
{
return
$this
->
recurrenceMonthsCount
;
}
public
function
setRecurrenceMonthsCount
(
?
int
$recurrenceMonthsCount
)
:
self
{
$this
->
recurrenceMonthsCount
=
$recurrenceMonthsCount
;
return
$this
;
}
public
function
getRecurrenceMonthDay
()
:
?
int
{
return
$this
->
recurrenceMonthDay
;
}
public
function
setRecurrenceMonthDay
(
?
int
$recurrenceMonthDay
)
:
self
{
$this
->
recurrenceMonthDay
=
$recurrenceMonthDay
;
return
$this
;
}
public
function
getRecurrenceAmount
()
:
?
int
{
return
$this
->
recurrenceAmount
;
}
public
function
setRecurrenceAmount
(
?
int
$recurrenceAmount
)
:
self
{
$this
->
recurrenceAmount
=
$recurrenceAmount
;
return
$this
;
}
}
src/Migrations/Version20240321105448.php
0 → 100644
View file @
502980aa
<?php
declare
(
strict_types
=
1
);
namespace
DoctrineMigrations
;
use
Doctrine\DBAL\Schema\Schema
;
use
Doctrine\Migrations\AbstractMigration
;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final
class
Version20240321105448
extends
AbstractMigration
{
public
function
getDescription
()
:
string
{
return
''
;
}
public
function
up
(
Schema
$schema
)
:
void
{
// this up() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
'ALTER TABLE payment ADD is_recurrent TINYINT(1) DEFAULT \'0\' NOT NULL, ADD recurrence_months_count INT DEFAULT NULL, ADD recurrence_month_day INT DEFAULT NULL, ADD recurrence_amount INT DEFAULT NULL'
);
}
public
function
down
(
Schema
$schema
)
:
void
{
// this down() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
'ALTER TABLE payment DROP is_recurrent, DROP recurrence_months_count, DROP recurrence_month_day, DROP recurrence_amount'
);
}
}
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