@@ 248-277 (lines=30) @@ | ||
245 | * @throws ReflectionException |
|
246 | * @throws RuntimeException |
|
247 | */ |
|
248 | private function updateIfCanceled( |
|
249 | array $closed_reg_statuses, |
|
250 | $new_STS_ID, |
|
251 | $old_STS_ID, |
|
252 | ContextInterface $context = null |
|
253 | ) { |
|
254 | // true if registration has been cancelled or declined |
|
255 | if (in_array($new_STS_ID, $closed_reg_statuses, true) |
|
256 | && ! in_array($old_STS_ID, $closed_reg_statuses, true) |
|
257 | ) { |
|
258 | /** @type EE_Registration_Processor $registration_processor */ |
|
259 | $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
260 | /** @type EE_Transaction_Processor $transaction_processor */ |
|
261 | $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
262 | // cancelled or declined registration |
|
263 | $registration_processor->update_registration_after_being_canceled_or_declined( |
|
264 | $this, |
|
265 | $closed_reg_statuses |
|
266 | ); |
|
267 | $transaction_processor->update_transaction_after_canceled_or_declined_registration( |
|
268 | $this, |
|
269 | $closed_reg_statuses, |
|
270 | false |
|
271 | ); |
|
272 | do_action( |
|
273 | 'AHEE__EE_Registration__set_status__canceled_or_declined', |
|
274 | $this, |
|
275 | $old_STS_ID, |
|
276 | $new_STS_ID, |
|
277 | $context |
|
278 | ); |
|
279 | return; |
|
280 | } |
|
@@ 297-325 (lines=29) @@ | ||
294 | * @throws InvalidInterfaceException |
|
295 | * @throws ReflectionException |
|
296 | */ |
|
297 | private function updateIfReinstated( |
|
298 | array $closed_reg_statuses, |
|
299 | $new_STS_ID, |
|
300 | $old_STS_ID, |
|
301 | ContextInterface $context = null |
|
302 | ) { |
|
303 | // true if reinstating cancelled or declined registration |
|
304 | if (in_array($old_STS_ID, $closed_reg_statuses, true) |
|
305 | && ! in_array($new_STS_ID, $closed_reg_statuses, true) |
|
306 | ) { |
|
307 | /** @type EE_Registration_Processor $registration_processor */ |
|
308 | $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
309 | /** @type EE_Transaction_Processor $transaction_processor */ |
|
310 | $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
311 | // reinstating cancelled or declined registration |
|
312 | $registration_processor->update_canceled_or_declined_registration_after_being_reinstated( |
|
313 | $this, |
|
314 | $closed_reg_statuses |
|
315 | ); |
|
316 | $transaction_processor->update_transaction_after_reinstating_canceled_registration( |
|
317 | $this, |
|
318 | $closed_reg_statuses, |
|
319 | false |
|
320 | ); |
|
321 | do_action( |
|
322 | 'AHEE__EE_Registration__set_status__after_reinstated', |
|
323 | $this, |
|
324 | $old_STS_ID, |
|
325 | $new_STS_ID, |
|
326 | $context |
|
327 | ); |
|
328 | } |