@@ 85-100 (lines=16) @@ | ||
82 | * @Method("GET") |
|
83 | * @View() |
|
84 | */ |
|
85 | public function discountAction(Request $request) |
|
86 | { |
|
87 | $em = $this->get('em'); |
|
88 | $query = $em->getRepository('Newscoop\PaywallBundle\Entity\Discount') |
|
89 | ->findActive(); |
|
90 | ||
91 | $paginator = $this->get('newscoop.paginator.paginator_service'); |
|
92 | $discounts = $paginator->paginate( |
|
93 | $query, |
|
94 | array( |
|
95 | 'distinct' => false, |
|
96 | ) |
|
97 | ); |
|
98 | ||
99 | return $discounts; |
|
100 | } |
|
101 | ||
102 | /** |
|
103 | * @Route("/api/paywall/currencies.{_format}", defaults={"_format"="json"}, name="newscoop_gimme_paywall_currency") |
|
@@ 108-122 (lines=15) @@ | ||
105 | * @Method("GET") |
|
106 | * @View() |
|
107 | */ |
|
108 | public function currencyAction(Request $request) |
|
109 | { |
|
110 | $currencyRepository = $this->get('newscoop_paywall.currency.repository'); |
|
111 | $query = $currencyRepository->findAllAvailable(); |
|
112 | ||
113 | $paginator = $this->get('newscoop.paginator.paginator_service'); |
|
114 | $currencies = $paginator->paginate( |
|
115 | $query, |
|
116 | array( |
|
117 | 'distinct' => false, |
|
118 | ) |
|
119 | ); |
|
120 | ||
121 | return $currencies; |
|
122 | } |
|
123 | ||
124 | /** |
|
125 | * @Route("/api/paywall/gateways.{_format}", defaults={"_format"="json"}, name="newscoop_gimme_paywall_gateways") |
|
@@ 130-143 (lines=14) @@ | ||
127 | * @Method("GET") |
|
128 | * @View() |
|
129 | */ |
|
130 | public function gatewaysAction(Request $request) |
|
131 | { |
|
132 | $provider = $this->get('newscoop_paywall.method_provider'); |
|
133 | $query = $provider->getEnabledMethods(); |
|
134 | $paginator = $this->get('newscoop.paginator.paginator_service'); |
|
135 | $gateways = $paginator->paginate( |
|
136 | $query, |
|
137 | array( |
|
138 | 'distinct' => false, |
|
139 | ) |
|
140 | ); |
|
141 | ||
142 | return $gateways; |
|
143 | } |
|
144 | } |
|
145 |