CompleteAuthoriseAndCaptureRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 44
ccs 15
cts 15
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 7 1
A getHttpRequest() 0 3 1
A sendData() 0 13 1
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_GET,
33 1
            sprintf(
34 1
                '/transaction/%s',
35 1
                $this->getTransactionReference()
36
            )
37
        );
38
39 1
        return new CompleteAuthoriseAndCaptureResponse(
40 1
            $this,
41 1
            $this->getResponseBody()
42
        );
43
    }
44
45
    /**
46
     * Get the HttpRequest.
47
     * Note: this is not an API request.
48
     *
49
     * @see Omnipay\Common\Message\AbstractRequest::$httpRequest
50
     *
51
     * @return Request
52
     */
53 2
    public function getHttpRequest(): Request
54
    {
55 2
        return $this->httpRequest;
56
    }
57
}
58