Commit 2fcc12d1 by Yvon Kerdoncuff

Merge branch '5669-produce-bank-transfer-files' into 'ssa-gironde'

5669 produce bank transfer files

See merge request cooperatic/kohinos-tav!78
parents 03e66087 c6a08fa0
......@@ -66,3 +66,6 @@ templates/themes/custom/
#INTELLIJ
.idea/
#dir containg exported reconversions xml
/reconversions/
......@@ -15,6 +15,7 @@ Extensions PHP :
iconv
mariadb (ou mysql > 8.0)
gd
bcmath (en environnement tav/ssa)
Installer composer si besoin
......
......@@ -19,6 +19,7 @@
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"andrew-svirin/ebics-client-php": "^2.1",
"api-platform/core": "^2.6",
"beberlei/doctrineextensions": "^1.3",
"composer/package-versions-deprecated": "1.*",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a59b75dfa4cd00a3ccefd4cda875dd52",
"content-hash": "b4f4376c4660e8a7ab3c2a419263798f",
"packages": [
{
"name": "alcohol/iso4217",
......@@ -60,6 +60,78 @@
"time": "2019-10-30T10:03:42+00:00"
},
{
"name": "andrew-svirin/ebics-client-php",
"version": "v2.1.2",
"source": {
"type": "git",
"url": "https://github.com/andrew-svirin/ebics-client-php.git",
"reference": "1692d4d5f2daab29c62bef6c54a0258d6fc927d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/andrew-svirin/ebics-client-php/zipball/1692d4d5f2daab29c62bef6c54a0258d6fc927d6",
"reference": "1692d4d5f2daab29c62bef6c54a0258d6fc927d6",
"shasum": ""
},
"require": {
"ext-bcmath": "*",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-openssl": "*",
"ext-zip": "*",
"ext-zlib": "*",
"php": "^7.4 || ^8"
},
"require-dev": {
"andrew-svirin/cfonb-php": "dev-master",
"andrew-svirin/mt942-php": "dev-master",
"mpdf/mpdf": "~8.0.17",
"phpseclib/phpseclib": "~2.0.35",
"phpstan/phpstan": "~1.9.17",
"phpunit/phpunit": "~9.6.3",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"squizlabs/php_codesniffer": "~3.7.1"
},
"suggest": {
"andrew-svirin/cfonb-php": "If you need to parse format CFONB from FDL requests.",
"andrew-svirin/mt942-php": "If you need to parse format MT942 from VMK, STA requests.",
"mpdf/mpdf": "If you need to generate PDF file letter for Bank.",
"psr/http-client": "If you want use the PsrHttpClient",
"psr/http-factory": "If you want use the PsrHttpClient"
},
"type": "library",
"autoload": {
"psr-4": {
"AndrewSvirin\\Ebics\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andrew Svirin"
}
],
"description": "PHP library to communicate with bank through EBICS protocol.",
"keywords": [
"cfonb.120",
"cfonb.240",
"client",
"ebics",
"mt940",
"mt942",
"openssl",
"php",
"rsa",
"x509"
],
"time": "2023-08-16T18:19:58+00:00"
},
{
"name": "api-platform/core",
"version": "v2.6.8",
"source": {
......@@ -272,6 +344,9 @@
"doctrine",
"orm"
],
"support": {
"source": "https://github.com/beberlei/DoctrineExtensions/tree/v1.3.0"
},
"time": "2020-11-29T07:37:23+00:00"
},
{
......@@ -1398,6 +1473,10 @@
"orm",
"persistence"
],
"support": {
"issues": "https://github.com/doctrine/DoctrineBundle/issues",
"source": "https://github.com/doctrine/DoctrineBundle/tree/1.12.13"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
......@@ -1503,6 +1582,10 @@
"cache",
"caching"
],
"support": {
"issues": "https://github.com/doctrine/DoctrineCacheBundle/issues",
"source": "https://github.com/doctrine/DoctrineCacheBundle/tree/1.4.0"
},
"abandoned": true,
"time": "2019-11-29T11:22:01+00:00"
},
......@@ -2193,6 +2276,10 @@
"database",
"orm"
],
"support": {
"issues": "https://github.com/doctrine/orm/issues",
"source": "https://github.com/doctrine/orm/tree/2.7.5"
},
"time": "2020-12-03T08:52:14+00:00"
},
{
......@@ -2449,46 +2536,6 @@
"time": "2021-10-11T09:18:27+00:00"
},
{
"name": "ekyna/payum-payzen",
"version": "dev-master",
"dist": {
"type": "path",
"url": "./lib/ekyna/payum-payzen",
"reference": "781b74869b2acc65e7635c5bd5d40c66cf1c2177"
},
"require": {
"payum/core": "^1.5",
"php": "^7.0",
"php-http/guzzle6-adapter": "^2.0",
"psr/log": "~1.0",
"symfony/process": "4.4.*"
},
"type": "component",
"autoload": {
"psr-4": {
"Ekyna\\Component\\Payum\\Payzen\\": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Etienne Dauvergne",
"homepage": "http://ekyna.com"
}
],
"description": "PayZen Payum gateway",
"homepage": "https://github.com/ekyna/PayumPayzen",
"keywords": [
"payum",
"payzen"
],
"transport-options": {
"relative": true
}
},
{
"name": "exsyst/swagger",
"version": "v0.4.2",
"source": {
......@@ -2525,6 +2572,10 @@
}
],
"description": "A php library to manipulate Swagger specifications",
"support": {
"issues": "https://github.com/GuilhemN/swagger/issues",
"source": "https://github.com/GuilhemN/swagger/tree/v0.4.2"
},
"time": "2020-11-19T17:14:18+00:00"
},
{
......@@ -2977,6 +3028,10 @@
"symfony",
"uuid"
],
"support": {
"issues": "https://github.com/jeromegamez/ramsey-uuid-normalizer/issues",
"source": "https://github.com/jeromegamez/ramsey-uuid-normalizer/tree/2.1.0"
},
"funding": [
{
"url": "https://github.com/sponsors/jeromegamez",
......@@ -3471,6 +3526,10 @@
"symfony",
"visual"
],
"support": {
"issues": "https://github.com/Gregwar/CaptchaBundle/issues",
"source": "https://github.com/Gregwar/CaptchaBundle/tree/v2.1.5"
},
"time": "2021-04-20T07:20:37+00:00"
},
{
......@@ -3848,6 +3907,10 @@
"highlight",
"sql"
],
"support": {
"issues": "https://github.com/jdorn/sql-formatter/issues",
"source": "https://github.com/jdorn/sql-formatter/tree/master"
},
"time": "2014-01-12T16:20:24+00:00"
},
{
......@@ -4166,6 +4229,10 @@
"filesystem",
"media"
],
"support": {
"issues": "https://github.com/KnpLabs/Gaufrette/issues",
"source": "https://github.com/KnpLabs/Gaufrette/tree/master"
},
"time": "2019-12-26T15:15:38+00:00"
},
{
......@@ -4232,6 +4299,10 @@
"pager",
"paginator"
],
"support": {
"issues": "https://github.com/KnpLabs/knp-components/issues",
"source": "https://github.com/KnpLabs/knp-components/tree/master"
},
"time": "2018-09-11T07:54:48+00:00"
},
{
......@@ -4295,6 +4366,7 @@
"knplabs",
"markdown"
],
"abandoned": "twig/markdown-extra",
"time": "2019-11-26T13:18:52+00:00"
},
{
......@@ -4485,6 +4557,10 @@
"paginator",
"symfony"
],
"support": {
"issues": "https://github.com/KnpLabs/KnpPaginatorBundle/issues",
"source": "https://github.com/KnpLabs/KnpPaginatorBundle/tree/master"
},
"time": "2018-05-16T12:15:58+00:00"
},
{
......@@ -4595,6 +4671,10 @@
"curl",
"http client"
],
"support": {
"issues": "https://github.com/kriswallsmith/Buzz/issues",
"source": "https://github.com/kriswallsmith/Buzz/tree/master"
},
"time": "2018-03-19T10:34:40+00:00"
},
{
......@@ -5031,6 +5111,10 @@
"symfony",
"translation"
],
"support": {
"issues": "https://github.com/lexik/LexikTranslationBundle/issues",
"source": "https://github.com/lexik/LexikTranslationBundle/tree/v4.4.0"
},
"time": "2021-01-26T07:40:30+00:00"
},
{
......@@ -5412,6 +5496,10 @@
"halite",
"symfony"
],
"support": {
"issues": "https://github.com/absolute-quantum/DoctrineEncryptBundle/issues",
"source": "https://github.com/absolute-quantum/DoctrineEncryptBundle/tree/3.0.3"
},
"time": "2017-05-15T09:17:44+00:00"
},
{
......@@ -6416,6 +6504,7 @@
"Guzzle",
"http"
],
"abandoned": "guzzlehttp/guzzle or php-http/guzzle7-adapter",
"time": "2018-12-16T14:44:03+00:00"
},
{
......@@ -6594,6 +6683,7 @@
"stream",
"uri"
],
"abandoned": "psr/http-factory",
"time": "2015-12-19T14:08:53+00:00"
},
{
......@@ -6696,6 +6786,10 @@
"reflection",
"static analysis"
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
},
"time": "2020-06-27T09:03:43+00:00"
},
{
......@@ -6993,6 +7087,10 @@
"sonata",
"sortable"
],
"support": {
"issues": "https://github.com/pix-digital/pixSortableBehaviorBundle/issues",
"source": "https://github.com/pix-digital/pixSortableBehaviorBundle/tree/master"
},
"time": "2018-03-26T15:56:52+00:00"
},
{
......@@ -7450,6 +7548,9 @@
"psr-16",
"simple-cache"
],
"support": {
"source": "https://github.com/php-fig/simple-cache/tree/master"
},
"time": "2017-10-23T01:57:42+00:00"
},
{
......@@ -7490,6 +7591,10 @@
}
],
"description": "A polyfill for getallheaders.",
"support": {
"issues": "https://github.com/ralouphie/getallheaders/issues",
"source": "https://github.com/ralouphie/getallheaders/tree/develop"
},
"time": "2019-03-08T08:55:37+00:00"
},
{
......@@ -8140,6 +8245,11 @@
"annotations",
"controllers"
],
"support": {
"issues": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues",
"source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v5.6.1"
},
"abandoned": "Symfony",
"time": "2020-08-25T19:10:18+00:00"
},
{
......@@ -8401,12 +8511,12 @@
}
},
"autoload": {
"psr-4": {
"Sonata\\BlockBundle\\": "src/"
},
"files": [
"src/Resources/stubs/symfony2.php"
]
],
"psr-4": {
"Sonata\\BlockBundle\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
......@@ -8429,6 +8539,10 @@
"block",
"sonata"
],
"support": {
"issues": "https://github.com/sonata-project/SonataBlockBundle/issues",
"source": "https://github.com/sonata-project/SonataBlockBundle/tree/3.x"
},
"time": "2020-08-27T14:25:46+00:00"
},
{
......@@ -8498,6 +8612,11 @@
"mongodb",
"redis"
],
"support": {
"issues": "https://github.com/sonata-project/cache/issues",
"source": "https://github.com/sonata-project/cache/tree/2.x"
},
"abandoned": true,
"time": "2017-12-08T09:22:44+00:00"
},
{
......@@ -8590,6 +8709,10 @@
"tag",
"taxonomy"
],
"support": {
"issues": "https://github.com/sonata-project/SonataClassificationBundle/issues",
"source": "https://github.com/sonata-project/SonataClassificationBundle/tree/3.13.2"
},
"time": "2020-09-05T08:40:59+00:00"
},
{
......@@ -8740,6 +8863,10 @@
"doctrine2",
"json"
],
"support": {
"issues": "https://github.com/sonata-project/sonata-doctrine-extensions/issues",
"source": "https://github.com/sonata-project/sonata-doctrine-extensions/tree/1.9.1"
},
"time": "2020-08-09T21:39:55+00:00"
},
{
......@@ -8917,6 +9044,10 @@
"Easy Extends",
"sonata"
],
"support": {
"issues": "https://github.com/sonata-project/SonataEasyExtendsBundle/issues",
"source": "https://github.com/sonata-project/SonataEasyExtendsBundle/tree/2.x"
},
"abandoned": true,
"time": "2018-02-11T12:21:41+00:00"
},
......@@ -9092,6 +9223,10 @@
"form",
"symfony"
],
"support": {
"issues": "https://github.com/sonata-project/form-extensions/issues",
"source": "https://github.com/sonata-project/form-extensions/tree/1.6.0"
},
"time": "2020-08-05T19:56:22+00:00"
},
{
......@@ -9420,6 +9555,10 @@
"vimeo",
"youtube"
],
"support": {
"issues": "https://github.com/sonata-project/SonataMediaBundle/issues",
"source": "https://github.com/sonata-project/SonataMediaBundle/tree/3.28.0"
},
"funding": [
{
"url": "https://github.com/OskarStark",
......@@ -9744,6 +9883,10 @@
"sonata",
"user"
],
"support": {
"issues": "https://github.com/sonata-project/SonataUserBundle/issues",
"source": "https://github.com/sonata-project/SonataUserBundle/tree/4.9.0"
},
"funding": [
{
"url": "https://github.com/OskarStark",
......@@ -9810,6 +9953,10 @@
"keywords": [
"encoder bundle"
],
"support": {
"issues": "https://github.com/mogilvie/EncryptBundle/issues",
"source": "https://github.com/mogilvie/EncryptBundle/tree/v1.1.1"
},
"time": "2019-06-22T18:50:28+00:00"
},
{
......@@ -9861,6 +10008,10 @@
"keywords": [
"symfony gdpr dpia encryption encrypt bundle"
],
"support": {
"issues": "https://github.com/mogilvie/GdprBundle/issues",
"source": "https://github.com/mogilvie/GdprBundle/tree/v2.1.3"
},
"time": "2019-08-07T19:44:33+00:00"
},
{
......@@ -15406,6 +15557,10 @@
"orm",
"tests"
],
"support": {
"issues": "https://github.com/theofidry/AliceDataFixtures/issues",
"source": "https://github.com/theofidry/AliceDataFixtures/tree/1.4.0"
},
"funding": [
{
"url": "https://github.com/theofidry",
......@@ -15467,6 +15622,10 @@
"i18n",
"text"
],
"support": {
"issues": "https://github.com/twigphp/Twig-extensions/issues",
"source": "https://github.com/twigphp/Twig-extensions/tree/master"
},
"abandoned": true,
"time": "2018-12-05T18:34:18+00:00"
},
......@@ -16371,12 +16530,12 @@
},
"type": "library",
"autoload": {
"psr-4": {
"Amp\\ParallelFunctions\\": "src"
},
"files": [
"src/functions.php"
]
],
"psr-4": {
"Amp\\ParallelFunctions\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
......@@ -16389,6 +16548,10 @@
}
],
"description": "Parallel processing made simple.",
"support": {
"issues": "https://github.com/amphp/parallel-functions/issues",
"source": "https://github.com/amphp/parallel-functions/tree/master"
},
"time": "2018-10-28T15:29:02+00:00"
},
{
......@@ -16520,12 +16683,12 @@
},
"type": "library",
"autoload": {
"psr-4": {
"Amp\\Serialization\\": "src"
},
"files": [
"src/functions.php"
]
],
"psr-4": {
"Amp\\Serialization\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
......@@ -16549,6 +16712,10 @@
"serialization",
"serialize"
],
"support": {
"issues": "https://github.com/amphp/serialization/issues",
"source": "https://github.com/amphp/serialization/tree/master"
},
"time": "2020-03-25T21:39:07+00:00"
},
{
......@@ -16760,9 +16927,6 @@
"require": {
"php": "~7.0"
},
"replace": {
"deployer/recipes": "self.version"
},
"require-dev": {
"deployer/deployer": "^6.3"
},
......@@ -16798,6 +16962,10 @@
"slack",
"yarn"
],
"support": {
"issues": "https://github.com/deployphp/recipes/issues",
"source": "https://github.com/deployphp/recipes"
},
"abandoned": true,
"time": "2019-06-27T06:47:18+00:00"
},
......@@ -17411,6 +17579,7 @@
"issues": "https://github.com/PHP-CS-Fixer/diff/issues",
"source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1"
},
"abandoned": true,
"time": "2020-10-14T08:39:05+00:00"
},
{
......@@ -17604,6 +17773,10 @@
}
],
"description": "A composer plugin that enables source code quality checks.",
"support": {
"issues": "https://github.com/phpro/grumphp/issues",
"source": "https://github.com/phpro/grumphp/tree/master"
},
"time": "2020-09-03T12:11:57+00:00"
},
{
......@@ -18651,7 +18824,6 @@
"type": "github"
}
],
"abandoned": true,
"time": "2020-09-28T06:45:17+00:00"
},
{
......@@ -18827,12 +18999,12 @@
"version": "3.7.1",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
"shasum": ""
},
......@@ -19565,9 +19737,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"ekyna/payum-payzen": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
......@@ -19580,5 +19750,5 @@
"ext-mbstring": "*"
},
"platform-dev": [],
"plugin-api-version": "2.3.0"
"plugin-api-version": "1.1.0"
}
......@@ -14,4 +14,5 @@ twig:
tav_env: '%env(TAV_ENV)%'
presta_self_init_and_eval: '%env(PRESTA_SELF_INIT_AND_EVAL)%'
presta_extra_data: '%env(PRESTA_EXTRA_DATA)%'
household_based_allowance: '%env(HOUSEHOLD_BASED_ALLOWANCE)%'
\ No newline at end of file
household_based_allowance: '%env(HOUSEHOLD_BASED_ALLOWANCE)%'
automatisation_reconversion: '%env(AUTOMATISATION_RECONVERSION)%'
\ No newline at end of file
......@@ -206,6 +206,11 @@ class PrestataireAdmin extends AbstractAdmin
'label' => 'SIRET :',
'required' => false,
])
//bic is new field in kohinos-ssa (I think it's OK to add it for non-tav env as well)
->add('bic', TextType::class, [
'label' => 'BIC :',
'required' => false,
])
->add('iban', PersonalDataType::class, [
'label' => 'IBAN :',
'required' => false,
......
......@@ -96,4 +96,8 @@ class ReconversionAdmin extends FluxAdmin
'Reconverti ?' => 'reconverti',
];
}
public function isReconversionAdmin() {
return true;
}
}
......@@ -2,11 +2,14 @@
namespace App\Controller;
use AndrewSvirin\Ebics\Builders\CustomerCreditTransfer\CustomerCreditTransferBuilder;
use App\Entity\Adherent;
use App\Entity\Don;
use App\Entity\Flux;
use App\Entity\GlobalParameter;
use App\Entity\Groupe;
use App\Entity\Prestataire;
use App\Entity\Reconversion;
use App\Entity\User;
use App\Enum\CurrencyEnum;
use App\Flux\FluxInterface;
......@@ -16,6 +19,7 @@ use App\Utils\TAVCotisationUtils;
use FOS\UserBundle\Model\UserManagerInterface;
use FOS\UserBundle\Util\TokenGeneratorInterface;
use Gamez\Symfony\Component\Serializer\Normalizer\UuidNormalizer;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sonata\Exporter\Handler;
use Sonata\Exporter\Source\DoctrineORMQuerySourceIterator;
use Sonata\Exporter\Writer\CsvWriter;
......@@ -30,6 +34,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
......@@ -75,6 +80,7 @@ class FluxController extends AbstractController
protected $tokenGenerator;
protected $validator;
protected $userManager;
protected $router;
public function __construct(
Security $security,
......@@ -88,7 +94,8 @@ class FluxController extends AbstractController
TokenGeneratorInterface $tokenGenerator,
ValidatorInterface $validator,
CsrfTokenManagerInterface $tokenManager,
UserManagerInterface $userManager
UserManagerInterface $userManager,
RouterInterface $router
) {
$this->security = $security;
$this->em = $em;
......@@ -102,6 +109,7 @@ class FluxController extends AbstractController
$this->tokenManager = $tokenManager;
$this->tavCotisationsUtils = $tavCotisationsUtils;
$this->userManager = $userManager;
$this->router = $router;
}
protected function manageFluxForm(Request $request, Form $form, $template = '@kohinos/flux/transaction.html.twig', $params = [])
......@@ -171,6 +179,101 @@ class FluxController extends AbstractController
}
/**
* @param Request $request
* @Route("/credit-transfer-file", name="credit_transfer_file")
* @IsGranted({"ROLE_TRESORIER", "ROLE_SUPER_ADMIN"})
* @return Response
*/
public function creditTransferFileAction(Request $request)
{
//raison, bic and iban from debitor are fetched in global parameters
$globalParametersRepository = $this->em->getRepository(GlobalParameter::class);
$raison = $globalParametersRepository->val(GlobalParameter::VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE);
$bic = $globalParametersRepository->val(GlobalParameter::VIREMENT_RECONVERSION_BIC_GESTIONNAIRE);
$iban = $globalParametersRepository->val(GlobalParameter::VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE);
//make sure raison, bic and iban are not empty
if(!$raison || !$bic || !$iban) {
$this->addFlash(
'sonata_flash_error',
"Opération annulée car la raison, l'IBAN ou le BIC du gestionnaire pour les virements de reconversions est vide."
);
return $this->redirect($this->router->generate('index') . 'admin/app/reconversion/list');
}
//SEPA
$builder = new CustomerCreditTransferBuilder();
$customerCreditTransfer = $builder
->createInstance(
$bic,
$iban,
$raison
);
$reconversions = $this->em->getRepository(Reconversion::class)->findBy(["reconverti" => false]);
if(!$reconversions) {
$this->addFlash(
'sonata_flash_error',
"Aucune reconversion à traiter."
);
return $this->redirect($this->router->generate('index') . 'admin/app/reconversion/list');
}
foreach($reconversions as $r) {
/* @var Reconversion $r */
/* @var Prestataire $presta */
$presta = $r->getExpediteur();
if(!$presta || !$presta->isEnabled()) {
//fail ; do not flush : we don't want to toggle reconverti when file can't be generated
$this->addFlash(
'sonata_flash_error',
"Opération annulée car le prestataire " . $presta->getRaison() . " est désactivé ou introuvable."
);
return $this->redirect($this->router->generate('index') . 'admin/app/reconversion/list');
}
if(!$presta->getIban() || !$presta->getBic()) {
//fail ; do not flush : we don't want to toggle reconverti when file can't be generated
$this->addFlash(
'sonata_flash_error',
"Opération annulée car l'IBAN ou le BIC du prestataire " . $presta->getRaison() . " est vide."
);
return $this->redirect($this->router->generate('index') . 'admin/app/reconversion/list');
}
$customerCreditTransfer
->addTransaction(
$presta->getBic(),
$presta->getIban(),
$presta->getRaison(),
$r->getMontant(),
'EUR',
'Reconversion MonA vers EUR'
);
$r->setReconverti(true);
}
$filename = sprintf(
'credit_transfer_file_%s.%s',
date('Y_m_d_H_i_s', strtotime('now')),
'xml'
);
//projectDir is composer.json
$dir = $this->getParameter('kernel.project_dir') . "/reconversions";
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
$path = $dir . "/" . $filename;
$customerCreditTransfer->popInstance()->save($path);
$this->em->flush();
return $this->file($path);
}
/**
* Export all operations for a user role.
*
* @param Request $request Request
......
......@@ -51,6 +51,9 @@ class GlobalParameter
const HELLOASSO_URL_COTISATION_ADHERENT = 'HELLOASSO_URL_COTISATION_ADHERENT';
const HELLOASSO_URL_COTISATION_PRESTATAIRE = 'HELLOASSO_URL_COTISATION_PRESTATAIRE';
const CONTACT_FORM_PHONE_NUMBER = 'CONTACT_FORM_PHONE_NUMBER';
const VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE = 'VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE';
const VIREMENT_RECONVERSION_BIC_GESTIONNAIRE = 'VIREMENT_RECONVERSION_BIC_GESTIONNAIRE';
const VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE = 'VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE';
/**
* @var \Ramsey\Uuid\UuidInterface
......
......@@ -146,6 +146,19 @@ class Prestataire extends AccountableObject implements AccountableInterface
private $iban;
/**
* Bank Identifier Code.
*
* @var string
*
* @ORM\Column(name="bic", type="string", nullable=true)
*
* @Assert\Bic(
* ibanPropertyPath="iban"
* )
*/
private $bic;
/**
* @var string
*
* @ORM\Column(name="siret", type="string", length=50, nullable=true)
......@@ -537,6 +550,26 @@ class Prestataire extends AccountableObject implements AccountableInterface
return $this;
}
/**
* @return string
*/
public function getBic(): ?string
{
return $this->bic;
}
/**
* @param string $bic
*
* @return Prestataire
*/
public function setBic(?string $bic): self
{
$this->bic = $bic;
return $this;
}
/**
* @return string
......
......@@ -331,6 +331,27 @@ class GlobalConfigurationFormType extends AbstractType
'required' => false,
'_placeholder' => '',
])
->add('raisongestionnairevirementreconversion', GlobalParameterType::class, [
'label' => 'Raison du gestionnaire pour les virements de reconversion automatisés',
'_description' => 'Raison du gestionnaire pour les virements de reconversion automatisés',
'name_param' => GlobalParameter::VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE,
'required' => false,
'_placeholder' => '',
])
->add('bicgestionnairevirementreconversion', GlobalParameterType::class, [
'label' => 'BIC du gestionnaire pour les virements de reconversion automatisés',
'_description' => 'BIC du gestionnaire pour les virements de reconversion automatisés',
'name_param' => GlobalParameter::VIREMENT_RECONVERSION_BIC_GESTIONNAIRE,
'required' => false,
'_placeholder' => '',
])
->add('ibangestionnairevirementreconversion', GlobalParameterType::class, [
'label' => 'IBAN du gestionnaire pour les virements de reconversion automatisés',
'_description' => 'IBAN du gestionnaire pour les virements de reconversion automatisés',
'name_param' => GlobalParameter::VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE,
'required' => false,
'_placeholder' => '',
])
;
}
......
......@@ -66,6 +66,11 @@ class PrestataireInfosFormType extends AbstractType
'label' => 'SIRET :',
'required' => false,
])
//bic is new field in kohinos-ssa (I think it's OK to add it for non-tav env as well)
->add('bic', TextType::class, [
'label' => 'BIC :',
'required' => false,
])
->add('iban', TextType::class, [
'label' => 'IBAN :',
'required' => false,
......
<?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 Version20240320144059 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 prestataire ADD bic VARCHAR(8) DEFAULT NULL, CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire DROP bic, CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
<?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 Version20240320153828 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 prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\', CHANGE bic bic VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\', CHANGE bic bic VARCHAR(8) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci`');
}
}
<?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 Version20240321101500 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("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE', 'Raison du gestionnaire pour les virements de reconversion automatisés', null, '1')");
$this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'VIREMENT_RECONVERSION_BIC_GESTIONNAIRE', 'Bic du gestionnaire pour les virements de reconversion automatisés', null, '1')");
$this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE', 'Iban du gestionnaire pour les virements de reconversion automatisés', null, '1')");
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
}
}
......@@ -161,9 +161,6 @@
"egulias/email-validator": {
"version": "2.1.6"
},
"ekyna/payum-payzen": {
"version": "1.5.x-dev"
},
"exsyst/swagger": {
"version": "v0.4.1"
},
......
......@@ -33,6 +33,12 @@
</li>
{% endfor %}
</ul>
{% if tav_env and automatisation_reconversion and admin.isReconversionAdmin is defined and admin.isReconversionAdmin %}
<a href="{{ path('credit_transfer_file') }}" type="button" class="btn btn-default">
<i class="fa fa-share-square-o" aria-hidden="true"></i>
Générer SEPA
</a>
{% endif %}
</div>
</div>
{% if admin.total is defined and admin.total > 0 %}
......
......@@ -46,6 +46,7 @@
</div>
{% endif %}
{{ form_row(form.siret) }}
{{ form_row(form.bic) }}
{{ form_row(form.iban) }}
{{ form_row(form.responsable) }}
{{ form_row(form.metier) }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment