Passed
Push — master ( da7868...61e5a6 )
by Kiet
53s queued 11s
created

getHttpRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Omnipay\IcepayPayments\Message;
4
5
use Omnipay\Common\Message\ResponseInterface;
6
use Symfony\Component\HttpFoundation\Request;
7
8
/**
9
 * The request for retrieving the payment transaction status when the CompleteAuthorise and Capture happens.
10
 * The payment transaction status can be different from what we get back as data from Icepay.
11
 */
12
class CompleteAuthoriseAndCaptureRequest extends AbstractRequest
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 1
    public function getData(): array
18
    {
19 1
        $data = parent::getData();
20
21 1
        $data['ContractProfileId'] = $this->getContractProfileId();
22
23 1
        return $data;
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 1
    public function sendData($data): ResponseInterface
30
    {
31 1
        $this->sendRequest(
32 1
            Request::METHOD_POST,
33 1
            sprintf(
34 1
                '/transaction/%s',
35 1
                $this->getTransactionReference()
36
            ),
37 1
            $data
38
        );
39
40 1
        return new CompleteAuthoriseAndCaptureResponse(
41 1
            $this,
42 1
            $this->getResponseBody()
43
        );
44
    }
45
46
    /**
47
     * Get the HttpRequest.
48
     * Note: this is not an API request.
49
     *
50
     * @see Omnipay\Common\Message\AbstractRequest::$httpRequest
51
     *
52
     * @return Request
53
     */
54 2
    public function getHttpRequest(): Request
55
    {
56 2
        return $this->httpRequest;
57
    }
58
}
59