Completed
Push — master ( 518ebf...57c98b )
by Cesar
18s queued 11s
created

ApiDumpController::dumpCustomerVault()   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;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\Routing\Annotation\Route;
7
use Symfony\Component\HttpFoundation\Response;
8
use Exception;
9
10
/**
11
 * Class ApiDumpController
12
 *
13
 * @package App\Controller\Braintree
14
 *
15
 * @Route("/braintree/api-dump", name="braintree-api-dump-")
16
 */
17
class ApiDumpController extends AbstractController
18
{
19
    /**
20
     * @Route("/vault", name="customers-list", methods={"GET"})
21
     *
22
     * @return Response
23
     */
24
    public function dumpVault()
25
    {
26
        $customers = $this->braintreeService->getCustomerService()->listCustomers();
27
        return $this->render('default/dump.html.twig', [
28
            'raw_result' => false,
29
            'result' => $customers
30
        ]);
31
    }
32
33
    /**
34
     * @Route("/vault/{customerId}", name="payment-methods-list", methods={"GET"})
35
     *
36
     * @return Response
37
     * @throws \Braintree\Exception\NotFound
38
     */
39
    public function dumpCustomerVault($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