1 | <?php declare(strict_types = 1); |
||
5 | final class NotificationFilter |
||
6 | { |
||
7 | const DELIVERYMETHOD_PUSH = 'PUSH'; |
||
8 | const DELIVERYMETHOD_CALLBACK = 'URL'; |
||
9 | |||
10 | const CATEGORY_BANK_SWITCH_SERVICE = 'BANK_SWITCH_SERVICE'; |
||
11 | const CATEGORY_BANK_SWITCH_SERVICE_PAYMENT = 'BANK_SWITCH_SERVICE_PAYMENT'; |
||
12 | const CATEGORY_BILLING = 'BILLING'; |
||
13 | const CATEGORY_CARD_TRANSACTION_FAILED = 'CARD_TRANSACTION_FAILED'; |
||
14 | const CATEGORY_CARD_TRANSACTION_SUCCESSFUL = 'CARD_TRANSACTION_SUCCESSFUL'; |
||
15 | const CATEGORY_CHAT = 'CHAT'; |
||
16 | const CATEGORY_DRAFT_PAYMENT = 'DRAFT_PAYMENT'; |
||
17 | const CATEGORY_IDEAL = 'IDEAL'; |
||
18 | const CATEGORY_SOFORT = 'SOFORT'; |
||
19 | const CATEGORY_FRIEND_SIGN_UP = 'FRIEND_SIGN_UP'; |
||
20 | const CATEGORY_MONETARY_ACCOUNT_PROFILE = 'MONETARY_ACCOUNT_PROFILE'; |
||
21 | const CATEGORY_MUTATION = 'MUTATION'; |
||
22 | const CATEGORY_PAYMENT = 'PAYMENT'; |
||
23 | const CATEGORY_PROMOTION = 'PROMOTION'; |
||
24 | const CATEGORY_REQUEST = 'REQUEST'; |
||
25 | const CATEGORY_SCHEDULE_RESULT = 'SCHEDULE_RESULT'; |
||
26 | const CATEGORY_SCHEDULE_STATUS = 'SCHEDULE_STATUS'; |
||
27 | const CATEGORY_SHARE = 'SHARE'; |
||
28 | const CATEGORY_SUPPORT = 'SUPPORT'; |
||
29 | const CATEGORY_TAB_RESULT = 'TAB_RESULT'; |
||
30 | const CATEGORY_USER_APPROVAL = 'USER_APPROVAL'; |
||
31 | const CATEGORY_USE_RESPONSE = 'USE_RESPONSE'; |
||
32 | const CATEGORY_USE_RESPONSE_NATIVE_COMMENT = 'USE_RESPONSE_NATIVE_COMMENT'; |
||
33 | const CATEGORY_USE_RESPONSE_NATIVE_TOPIC = 'USE_RESPONSE_NATIVE_TOPIC'; |
||
34 | |||
35 | const CATEGORY_SLICE_CHAT = 'SLICE_CHAT'; |
||
36 | const CATEGORY_SLICE_REGISTRY_ENTRY = 'SLICE_REGISTRY_ENTRY'; |
||
37 | const CATEGORY_SLICE_REGISTRY_MEMBERSHIP = 'SLICE_REGISTRY_MEMBERSHIP'; |
||
38 | const CATEGORY_SLICE_REGISTRY_SETTLEMENT = 'SLICE_REGISTRY_SETTLEMENT'; |
||
39 | |||
40 | const CATEGORY_WHITELIST = 'WHITELIST'; |
||
41 | const CATEGORY_WHITELIST_RESULT = 'WHITELIST_RESULT'; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $deliveryMethod; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | private $target; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | private $category; |
||
57 | |||
58 | /** |
||
59 | * @param string $deliveryMethod |
||
60 | * @param string $target |
||
61 | * @param string $category |
||
62 | */ |
||
63 | private function __construct(string $deliveryMethod, string $target, string $category) |
||
72 | |||
73 | /** |
||
74 | * @param array $notificationFilterStruct |
||
75 | * @return NotificationFilter |
||
76 | */ |
||
77 | public static function fromArray(array $notificationFilterStruct): NotificationFilter |
||
91 | |||
92 | /** |
||
93 | * @return array |
||
94 | */ |
||
95 | public function toArray() |
||
103 | |||
104 | /** |
||
105 | * @param string $category |
||
106 | * @return NotificationFilter |
||
107 | */ |
||
108 | public static function createPush(string $category) |
||
112 | |||
113 | /** |
||
114 | * @param string $callbackUrl |
||
115 | * @param string $category |
||
116 | * @return NotificationFilter |
||
117 | */ |
||
118 | public static function createCallback(string $callbackUrl, string $category) |
||
122 | |||
123 | /** |
||
124 | * @return void |
||
125 | * @throws \Exception |
||
126 | */ |
||
127 | private function guardCategory($category) |
||
134 | |||
135 | /** |
||
136 | * @param $deliveryMethod |
||
137 | * @return void |
||
138 | * @throws \Exception |
||
139 | */ |
||
140 | private function guardDeliveryMethod($deliveryMethod) |
||
149 | |||
150 | /** |
||
151 | * @return string |
||
152 | */ |
||
153 | public function deliveryMethod(): string |
||
157 | |||
158 | /** |
||
159 | * @return string |
||
160 | */ |
||
161 | public function target(): string |
||
165 | |||
166 | /** |
||
167 | * @return string |
||
168 | */ |
||
169 | public function category(): string |
||
173 | } |
||
174 |