Passed
Branch feature/ECO-965-refactoring (c9cdee)
by Andrey
06:34 queued 01:51
created

IpnController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A endpointAction() 0 10 1
1
<?php
2
3
/**
4
 * Apache OSL-2
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AmazonPay\Communication\Controller;
9
10
use Spryker\Zed\Kernel\Communication\Controller\AbstractController;
11
use Symfony\Component\HttpFoundation\Response;
12
13
/**
14
 * @method \SprykerEco\Zed\AmazonPay\Business\AmazonPayFacadeInterface getFacade()
15
 */
16
class IpnController extends AbstractController
17
{
18
    /**
19
     * @return \Symfony\Component\HttpFoundation\Response
20
     */
21
    public function endpointAction()
22
    {
23
        /** @var string[] $headers */
24
        $headers = getallheaders();
25
        $body = file_get_contents('php://input');
26
27
        $ipnRequestTransfer = $this->getFacade()->convertAmazonPayIpnRequest($headers, $body);
28
        $this->getFacade()->handleAmazonPayIpnRequest($ipnRequestTransfer);
29
30
        return new Response('Request has been processed');
31
    }
32
}
33