Passed
Push — master ( b0e1d7...34bc8c )
by
unknown
02:32
created

ApiController::webhookAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
/**
3
 * Created by Graham Owens ([email protected])
4
 * Company: PartFire Ltd (www.partfire.co.uk)
5
 * Console: Discovery
6
 *
7
 * User:    gra
8
 * Date:    20/01/17
9
 * Time:    09:12
10
 * Project: fruitful-property-investments
11
 * File:    ApiController.php
12
 *
13
 **/
14
15
namespace PartFire\MangoPayBundle\Controller;
16
17
use PartFire\CommonBundle\Controller\ApiBaseController;
18
use PartFire\MangoPayBundle\Services\HookHandleService;
19
use Symfony\Component\HttpFoundation\Request;
20
use Symfony\Component\HttpFoundation\Response;
21
22
class ApiController extends ApiBaseController
23
{
24
    public function webhookAction(Request $request)
25
    {
26
        $body = $request->getContent();
27
        $bodyJson = json_decode($body);
28
29
        $onfidoWebHookService = $this->getPartFireMangoPayService();
30
        $onfidoWebHookService->processRequest($bodyJson);
31
32
        return new Response('', 201);
33
    }
34
35
    private function getPartFireMangoPayService() : HookHandleService
36
    {
37
        return $this->container->get('part_fire_mango_pay.services.webhook');
38
    }
39
}