AnnulRequest::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
namespace Empatix\OmnipaySwedbank\Messages;
4
5
use Empatix\OmnipaySwedbank\Gateway;
6
use Empatix\OmnipaySwedbank\Messages\Response;
7
use Empatix\OmnipaySwedbank\Messages\PurchaseRequest;
8
9
class AnnulRequest extends PurchaseRequest
10
{
11
    public function getData()
12
    {
13
        return [
14
            'transcation' => [
15
                'description' => $this->getDescription(),
16
                'payeeReference' => $this->getPayeeReference(),
17
            ],
18
        ];
19
    }
20
21
    public function sendData($data)
22
    {
23
        $result = $this->httpClient->request(
24
            'POST',
25
            $this->getEndpoint() . $this->resource,
26
            [
27
                'Authorization' => 'Bearer ' . $this->getPassword(),
28
                'Content-Type' => 'application/json; charset=utf-8',
29
                'Accept' => 'application/problem+json; q=1.0, application/json; q=0.9',
30
            ],
31
            json_encode($data)
32
        );
33
34
        return $this->response = new Response(
35
            $this,
36
            $result->getBody()->getContents()
37
        );
38
     }
39
}
40