Completed
Push — master ( 741735...2a7c62 )
by Cesar
15s queued 12s
created

VaultController::getCustomer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Controller\Braintree\Vault;
4
5
use App\Controller\Braintree\AbstractController;
6
use Braintree\Exception\NotFound;
7
use Symfony\Component\Routing\Annotation\Route;
8
use Symfony\Component\HttpFoundation\Response;
9
10
/**
11
 * Class VaultController
12
 *
13
 * @package App\Controller\Braintree\Vault
14
 *
15
 * @Route("/braintree/vault", name="braintree-vault-")
16
 */
17
class VaultController extends AbstractController
18
{
19
    /**
20
     * @Route("/", name="customer-list", methods={"GET"})
21
     *
22
     * @return Response
23
     */
24
    public function listCustomer(): Response
25
    {
26
        $customers = $this->braintreeService->getCustomerService()->listCustomers();
27
        return $this->render('braintree/api/vault/list.html.twig', [
28
            'customers' => $customers
29
        ]);
30
    }
31
32
    /**
33
     * @Route("/vault/{customerId}", name="customer-get", methods={"GET"})
34
     *
35
     * @param $customerId
36
     * @return Response
37
     * @throws NotFound
38
     */
39
    public function getCustomer($customerId): Response
40
    {
41
        $customer = $this->braintreeService->getCustomerService()->getCustomer($customerId);
42
        return $this->render('default/dump.html.twig', [
43
            'raw_result' => false,
44
            'result' => $customer
45
        ]);
46
    }
47
}
48