|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Speicher210\FastbillBundle\Controller\Notification; |
|
4
|
|
|
|
|
5
|
|
|
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionCanceledNotification; |
|
6
|
|
|
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionChangedNotification; |
|
7
|
|
|
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionClosedNotification; |
|
8
|
|
|
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionCreatedNotification; |
|
9
|
|
|
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionReactivatedNotification; |
|
10
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionCanceledEvent; |
|
11
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionChangedEvent; |
|
12
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionClosedEvent; |
|
13
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionCreatedEvent; |
|
14
|
|
|
use Speicher210\FastbillBundle\Event\SubscriptionReactivatedEvent; |
|
15
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
16
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Controller for subscriptions notifications. |
|
20
|
|
|
*/ |
|
21
|
|
|
class SubscriptionController extends AbstractController |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* Action when a subscription is created. |
|
25
|
|
|
* |
|
26
|
|
|
* @param Request $request The made request. |
|
27
|
|
|
* @return Response |
|
28
|
|
|
*/ |
|
29
|
21 |
|
public function createdAction(Request $request) |
|
30
|
|
|
{ |
|
31
|
21 |
|
$event = new SubscriptionCreatedEvent(); |
|
32
|
|
|
|
|
33
|
21 |
|
return $this->handleNotification($request, $event, SubscriptionCreatedNotification::class); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Action when a subscription is changed. |
|
38
|
|
|
* |
|
39
|
|
|
* @param Request $request The made request. |
|
40
|
|
|
* @return Response |
|
41
|
|
|
*/ |
|
42
|
3 |
|
public function changedAction(Request $request) |
|
43
|
|
|
{ |
|
44
|
3 |
|
$event = new SubscriptionChangedEvent(); |
|
45
|
|
|
|
|
46
|
3 |
|
return $this->handleNotification($request, $event, SubscriptionChangedNotification::class); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Action when a subscription is canceled. |
|
51
|
|
|
* |
|
52
|
|
|
* @param Request $request The made request. |
|
53
|
|
|
* @return Response |
|
54
|
|
|
*/ |
|
55
|
3 |
|
public function canceledAction(Request $request) |
|
56
|
|
|
{ |
|
57
|
3 |
|
$event = new SubscriptionCanceledEvent(); |
|
58
|
|
|
|
|
59
|
3 |
|
return $this->handleNotification($request, $event, SubscriptionCanceledNotification::class); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Action when a subscription is closed. |
|
64
|
|
|
* |
|
65
|
|
|
* @param Request $request The made request. |
|
66
|
|
|
* @return Response |
|
67
|
|
|
*/ |
|
68
|
3 |
|
public function closedAction(Request $request) |
|
69
|
|
|
{ |
|
70
|
3 |
|
$event = new SubscriptionClosedEvent(); |
|
71
|
|
|
|
|
72
|
3 |
|
return $this->handleNotification($request, $event, SubscriptionClosedNotification::class); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Action when a subscription is reactivated. |
|
77
|
|
|
* |
|
78
|
|
|
* @param Request $request The made request. |
|
79
|
|
|
* @return Response |
|
80
|
|
|
*/ |
|
81
|
3 |
|
public function reactivatedAction(Request $request) |
|
82
|
|
|
{ |
|
83
|
3 |
|
$event = new SubscriptionReactivatedEvent(); |
|
84
|
|
|
|
|
85
|
3 |
|
return $this->handleNotification($request, $event, SubscriptionReactivatedNotification::class); |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|