-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
307 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
DOCUSIGN_INTEGRATION_KEY=c3b2d475-2cbd-47f5-a903-9b3aa0fefe5b | ||
DOCUSIGN_USER_GUID=4003ab5e-c21f-4738-9469-e7d736e10b90 | ||
DOCUSIGN_ACCOUNT_ID=1234567 | ||
APP_ENV=embedded | ||
APP_ENV=test | ||
APP_DEBUG=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the DocusignBundle. | ||
* | ||
* (c) Grégoire Hébert <gregoire@les-tilleuls.coop> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DocusignBundle\E2e\TestBundle\Controller; | ||
|
||
use Symfony\Component\Finder\Finder; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpFoundation\Session\Session; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
use Symfony\Component\Routing\RouterInterface; | ||
use Twig\Environment; | ||
|
||
/** | ||
* @author Vincent Chalamon <vincentchalamon@gmail.com> | ||
*/ | ||
final class DocumentsController | ||
{ | ||
private $kernelProjectDir; | ||
|
||
public function __construct(string $kernelProjectDir) | ||
{ | ||
$this->kernelProjectDir = $kernelProjectDir; | ||
} | ||
|
||
/** | ||
* @Route("/embedded", name="embedded", methods={"GET"}, defaults={"mode"="embedded", "route_name"="docusign_sign_default"}) | ||
* @Route("/remote", name="remote", methods={"GET"}, defaults={"mode"="remote", "route_name"="docusign_sign_remote"}) | ||
*/ | ||
public function __invoke(Request $request, Environment $twig): Response | ||
{ | ||
return new Response($twig->render('list.html.twig', [ | ||
'documents' => $this->getDocuments("$this->kernelProjectDir/var/storage"), | ||
'route_name' => $request->attributes->get('route_name'), | ||
'mode' => $request->attributes->get('mode'), | ||
])); | ||
} | ||
|
||
/** | ||
* @Route("/embedded/callback", name="embedded_callback", methods={"GET"}) | ||
*/ | ||
public function embeddedCallbackAction(RouterInterface $router, Session $session): RedirectResponse | ||
{ | ||
$session->getFlashBag()->add('success', 'The document has been successfully signed!'); | ||
|
||
return new RedirectResponse($router->generate('embedded')); | ||
} | ||
|
||
/** | ||
* @Route("/remote/callback", name="remote_callback", methods={"GET"}) | ||
*/ | ||
public function remoteCallbackAction(RouterInterface $router, Session $session): RedirectResponse | ||
{ | ||
$session->getFlashBag()->add('success', 'The document has been successfully sent to the signer!'); | ||
|
||
return new RedirectResponse($router->generate('remote')); | ||
} | ||
|
||
private function getDocuments($path): array | ||
{ | ||
$documents = []; | ||
/** @var \SplFileInfo[] $files */ | ||
$files = Finder::create()->files()->in($path); | ||
foreach ($files as $file) { | ||
$documents[$file->getFilename()] = substr($file->getRealPath(), \strlen($path)); | ||
} | ||
|
||
return $documents; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...Bundle/Resources/views/embedded.html.twig → ...TestBundle/Resources/views/list.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.