1 | <?php |
||
22 | class Payment implements PaymentInterface |
||
23 | { |
||
24 | public const FEE_FIXED = 'fixed'; |
||
25 | |||
26 | public const FEE_PERCENTAGE = 'percentage'; |
||
27 | |||
28 | private $id; |
||
29 | |||
30 | private $name; |
||
31 | |||
32 | private $description; |
||
33 | |||
34 | private $fee; |
||
35 | |||
36 | private $feeType; |
||
37 | |||
38 | private $feeTypes = [ |
||
39 | self::FEE_FIXED, |
||
40 | self::FEE_PERCENTAGE, |
||
41 | ]; |
||
42 | |||
43 | private $requiredFields = [ |
||
44 | 'id', |
||
45 | 'name', |
||
46 | 'fee', |
||
47 | ]; |
||
48 | |||
49 | 5 | public function __construct(array $data, string $feeType = self::FEE_FIXED) |
|
68 | |||
69 | 1 | public static function createWithFixedFee(array $data): Payment |
|
73 | |||
74 | 1 | public static function createWithPercentageFee(array $data): Payment |
|
78 | |||
79 | 1 | public function getId(): int |
|
83 | |||
84 | 1 | public function getName(): string |
|
88 | |||
89 | 1 | public function getDescription(): string |
|
93 | |||
94 | 3 | public function getFee(Money $totalPrice, string $currency): Money |
|
104 | |||
105 | public function toArray(): array |
||
113 | } |
||
114 |