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

CompleteAuthoriseAndCaptureRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 14
c 1
b 0
f 0
dl 0
loc 45
ccs 16
cts 16
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 7 1
A getHttpRequest() 0 3 1
A sendData() 0 14 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_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