-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReceiptSubType.php
53 lines (44 loc) · 1.38 KB
/
ReceiptSubType.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace Innokassa\MDK\Entities\Atoms;
use Innokassa\MDK\Entities\AtomAbstract;
use Innokassa\MDK\Exceptions\Base\InvalidArgumentException;
/**
* Подтип чека
*/
class ReceiptSubType extends AtomAbstract
{
/** Предоплата - покупатель оплатил товар (чек создан автоматически) */
public const PRE = 1;
/** Полный расчет - заказ передан покупателю (чек создан автоматически) */
public const FULL = 2;
//######################################################################
/**
* @throws InvalidArgumentException
* @param integer $code из констант
*/
public function __construct(int $code)
{
switch ($code) {
case self::PRE:
$this->name = 'Предоплата';
$this->code = $code;
break;
case self::FULL:
$this->name = 'Расчет';
$this->code = $code;
break;
default:
throw new InvalidArgumentException("invalid receipt sub type '$code'");
}
}
/**
* @inheritDoc
*/
public static function all(): array
{
$a = [];
$a[] = new self(self::PRE);
$a[] = new self(self::FULL);
return $a;
}
}