File tree Expand file tree Collapse file tree 3 files changed +46
-1
lines changed
Expand file tree Collapse file tree 3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Netbums \Quickpay \Exceptions \Subscriptions ;
4+
5+ use Exception ;
6+
7+ class FetchSubscriptionsFailed extends Exception
8+ {
9+
10+ }
Original file line number Diff line number Diff line change 33namespace Netbums \Quickpay \Facades ;
44
55use Illuminate \Support \Facades \Facade ;
6+ use Netbums \Quickpay \Resources \CardResource ;
7+ use Netbums \Quickpay \Resources \FeeResource ;
8+ use Netbums \Quickpay \Resources \PaymentResource ;
9+ use Netbums \Quickpay \Resources \PayoutResource ;
10+ use Netbums \Quickpay \Resources \SubscriptionResource ;
11+
612
713/**
8- * @see \Netbums\Quickpay\Quickpay
14+ * @method static PaymentResource payments();
15+ * @method static SubscriptionResource subscriptions();
16+ * @method static CardResource cards();
17+ * @method static FeeResource fees();
18+ * @method static PayoutResource payouts();
919 */
1020class Quickpay extends Facade
1121{
Original file line number Diff line number Diff line change 22
33namespace Netbums \Quickpay \Resources ;
44
5+ use Netbums \Quickpay \Exceptions \CardNotAccepted ;
6+ use Netbums \Quickpay \Exceptions \QuickPayValidationError ;
7+ use Netbums \Quickpay \Exceptions \Subscriptions \FetchSubscriptionsFailed ;
58use Netbums \Quickpay \Resources \Concerns \QuickpayApiConsumer ;
9+ use Throwable ;
610
711class SubscriptionResource
812{
913 use QuickpayApiConsumer;
14+
15+ /**
16+ * @throws CardNotAccepted
17+ * @throws QuickPayValidationError
18+ * @throws FetchSubscriptionsFailed
19+ */
20+ public function all (): array
21+ {
22+ $ this ->method = 'get ' ;
23+ $ this ->endpoint = 'subscriptions ' ;
24+
25+ try {
26+ return $ this ->request ($ this ->method , $ this ->endpoint );
27+ } catch (Throwable $ exception ) {
28+ throw new FetchSubscriptionsFailed (
29+ message: 'The subscriptions could not be fetched. ' ,
30+ code: $ exception ->getCode (),
31+ previous: $ exception
32+ );
33+ }
34+ }
1035}
You can’t perform that action at this time.
0 commit comments