1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Speicher210\FastbillBundle\EventListener; |
4
|
|
|
|
5
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionCanceledEvent; |
6
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionChangedEvent; |
7
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionClosedEvent; |
8
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionCreatedEvent; |
9
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionReactivatedEvent; |
10
|
|
|
use Speicher210\FastbillBundle\FastbillNotificationEvents; |
11
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Event listener for incoming Fastbill subscription notifications. |
15
|
|
|
*/ |
16
|
|
|
abstract class AbstractSubscriptionListener implements EventSubscriberInterface |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* Handle creating a subscription. |
20
|
|
|
* |
21
|
|
|
* @param SubscriptionCreatedEvent $event The raised event. |
22
|
|
|
*/ |
23
|
|
|
abstract public function onSubscriptionCreated(SubscriptionCreatedEvent $event); |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Handle changing a subscription. |
27
|
|
|
* |
28
|
|
|
* @param SubscriptionChangedEvent $event The raised event. |
29
|
|
|
*/ |
30
|
|
|
abstract public function onSubscriptionChanged(SubscriptionChangedEvent $event); |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Handle canceling a subscription. |
34
|
|
|
* |
35
|
|
|
* @param SubscriptionCanceledEvent $event The raised event. |
36
|
|
|
*/ |
37
|
|
|
abstract public function onSubscriptionCanceled(SubscriptionCanceledEvent $event); |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Handle closing a subscription. |
41
|
|
|
* |
42
|
|
|
* @param SubscriptionClosedEvent $event The raised event. |
43
|
|
|
*/ |
44
|
|
|
abstract public function onSubscriptionClosed(SubscriptionClosedEvent $event); |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Handle reactivating a subscription. |
48
|
|
|
* |
49
|
|
|
* @param SubscriptionReactivatedEvent $event The raised event. |
50
|
|
|
*/ |
51
|
|
|
abstract public function onSubscriptionReactivated(SubscriptionReactivatedEvent $event); |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* {@inheritdoc} |
55
|
|
|
*/ |
56
|
|
|
public static function getSubscribedEvents() |
57
|
|
|
{ |
58
|
|
|
return array( |
59
|
|
|
FastbillNotificationEvents::INCOMING_SUBSCRIPTION_CREATED => 'onSubscriptionCreated', |
60
|
|
|
FastbillNotificationEvents::INCOMING_SUBSCRIPTION_CHANGED => 'onSubscriptionChanged', |
61
|
|
|
FastbillNotificationEvents::INCOMING_SUBSCRIPTION_CANCELED => 'onSubscriptionCanceled', |
62
|
|
|
FastbillNotificationEvents::INCOMING_SUBSCRIPTION_CLOSED => 'onSubscriptionClosed', |
63
|
|
|
FastbillNotificationEvents::INCOMING_SUBSCRIPTION_REACTIVATED => 'onSubscriptionReactivated' |
64
|
|
|
); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|