public function __construct(string $amt, string $vs)
24
{
25
1
$this->setAmount($amt);
26
1
$this->setVariableSymbol($vs);
27
1
$this->timestamp = gmdate('dmYHis');
28
1
}
29
30
public function setAmount($amt) : IPayment
31
{
32
1
if (!Validator::isAmount($amt))
33
1
throw new \PaySys\PaySys\InvalidArgumentException(sprintf("Amount must have maximal 9 digits before dot and maximal 2 digits after. '%s' is invalid.", $amt));
34
35
1
$this->amt = $amt;
36
1
return $this;
37
}
38
39
public function getAmount() : string
40
{
41
1
return $this->amt;
42
}
43
44
public function setVariableSymbol(string $vs) : Payment
45
{
46
1
if (!Validator::isVariableSymbol($vs))
47
1
throw new \PaySys\PaySys\InvalidArgumentException(sprintf("Variable symbol must have minimal 1 and maximal 10 digits. '%s' is invalid.", $vs));
48
49
1
$this->vs = $vs;
50
1
return $this;
51
}
52
53
public function getVariableSymbol() : string
54
{
55
1
return $this->vs;
56
}
57
58
public function getCurrency() : string
59
{
60
1
return $this->curr;
61
}
62
63
/**
64
* @internal
65
*/
66
public function setTimestamp(string $timestamp) : Payment
67
{
68
1
if (!Validator::isTimestamp($timestamp))
69
throw new \PaySys\PaySys\InvalidArgumentException(sprintf("Timestamp '%s' is invalid.", $timestamp));
70
71
1
$this->timestamp = $timestamp;
72
1
return $this;
73
}
74
75
public function getTimestamp() : string
76
{
77
1
return $this->timestamp;
78
}
79
80
81
private static function normalizeCurrency(string $curr) : string