Completed
Push — master ( 589fec...539028 )
by Milan
07:58
created

National::setBankCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace h4kuna\Fio\Request\Pay\Payment;
4
5
use h4kuna\Fio\Exceptions;
6
7
class National extends Property
8
{
9
10
	use Symbols;
11
12
	public const PAYMENT_STANDARD = 431001;
13
	public const PAYMENT_PRIORITY = 431005;
14
	public const PAYMENT_COLLECTION = 431022;
15
16
	private const TYPES_PAYMENT = [self::PAYMENT_STANDARD, self::PAYMENT_PRIORITY, self::PAYMENT_COLLECTION];
17
18
	/** @var string */
19
	protected $bankCode = '';
20
21
	/** @var string */
22
	protected $messageForRecipient = '';
23
24
	/** @var int */
25
	protected $paymentType = 0;
26
27
28
	/** @return static */
29
	public function setPaymentType(int $type)
30
	{
31
		$this->paymentType = Exceptions\InvalidArgument::checkIsInList($type, self::TYPES_PAYMENT);;
32
		return $this;
33
	}
34
35
36
	/** @return static */
37
	public function setMessage(string $message)
38
	{
39
		$this->messageForRecipient = Exceptions\InvalidArgument::check($message, 140);
40
		return $this;
41
	}
42
43
44
	/** @return static */
45
	public function setAccountTo(string $accountTo)
46
	{
47
		$this->accountTo = $accountTo;
48
		return $this;
49
	}
50
51
52
	/** @return static */
53
	public function setBankCode(string $bankCode)
54
	{
55
		$this->bankCode = $bankCode;
56
		return $this;
57
	}
58
59
60
	public function getExpectedProperty(): array
61
	{
62
		return [
63
			// key => mandatory,
64
			'accountFrom' => true,
65
			'currency' => true,
66
			'amount' => true,
67
			'accountTo' => true,
68
			'bankCode' => true,
69
			'ks' => false,
70
			'vs' => false,
71
			'ss' => false,
72
			'date' => true,
73
			'messageForRecipient' => false,
74
			'comment' => false,
75
			'paymentReason' => false,
76
			'paymentType' => false,
77
		];
78
	}
79
80
81
	public function getStartXmlElement(): string
82
	{
83
		return 'DomesticTransaction';
84
	}
85
86
}
87