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

IpnController::endpointAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
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