Completed
Pull Request — dev (#9)
by Andrey
07:42 queued 03:37
created

IpnController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
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\Shared\Log\LoggerTrait;
11
use Spryker\Zed\Kernel\Communication\Controller\AbstractController;
12
use Symfony\Component\HttpFoundation\Response;
13
14
/**
15
 * @method \SprykerEco\Zed\AmazonPay\Business\AmazonPayFacadeInterface getFacade()
16
 */
17
class IpnController extends AbstractController
18
{
19
    use LoggerTrait;
20
21
    /**
22
     * @return \Symfony\Component\HttpFoundation\Response
23
     */
24
    public function endpointAction()
25
    {
26
        /** @var string[] $headers */
27
        $headers = getallheaders();
28
        $body = file_get_contents('php://input');
29
30
        $ipnRequestTransfer = $this->getFacade()->convertAmazonPayIpnRequest($headers, $body);
31
        $this->getFacade()->handleAmazonPayIpnRequest($ipnRequestTransfer);
32
33
        return new Response('Request has been processed');
34
    }
35
}
36