Completed
Pull Request — develop (#13)
by Fabian
01:23
created

AuthorizationRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 39
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubAccountId() 0 3 1
A getReference() 0 3 1
A setReference() 0 4 1
A getClearingType() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cakasim\Payone\Sdk\Api\Message\Payment;
6
7
use Cakasim\Payone\Sdk\Api\Message\Payment\Parameter\Amount;
8
use Cakasim\Payone\Sdk\Api\Message\Payment\Parameter\Currency;
9
use Cakasim\Payone\Sdk\Api\Message\Request;
10
11
/**
12
 * Represents a payment (pre)authorization request.
13
 *
14
 * @author Fabian Böttcher <[email protected]>
15
 * @since 0.1.0
16
 */
17
class AuthorizationRequest extends Request implements AuthorizationRequestInterface
18
{
19
    use Amount,
20
        Currency;
21
22
    /**
23
     * @inheritDoc
24
     */
25
    public function getSubAccountId(): ?string
26
    {
27
        return $this->parameters['aid'] ?? null;
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function getClearingType(): ?string
34
    {
35
        return $this->parameters['clearingtype'] ?? null;
36
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41
    public function getReference(): ?string
42
    {
43
        return $this->parameters['reference'] ?? null;
44
    }
45
46
    /**
47
     * Sets the custom reference of this transaction.
48
     *
49
     * @param string $reference The reference for this transaction.
50
     * @return $this
51
     */
52
    public function setReference(string $reference): self
53
    {
54
        $this->parameters['reference'] = $reference;
55
        return $this;
56
    }
57
}
58