File tree 2 files changed +26
-1
lines changed 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Subscription Billing for Laravel 5
2
2
3
+ [ ![ Build Status] ( https://travis-ci.org/laravel/framework.svg )] ( https://travis-ci.org/laravel/framework )
4
+ [ ![ Total Downloads] ( https://poser.pugx.org/laravel/framework/downloads.svg )] ( https://packagist.org/packages/laravel/framework )
5
+ [ ![ Latest Stable Version] ( https://poser.pugx.org/laravel/framework/v/stable.svg )] ( https://packagist.org/packages/laravel/framework )
6
+ [ ![ Latest Unstable Version] ( https://poser.pugx.org/laravel/framework/v/unstable.svg )] ( https://packagist.org/packages/laravel/framework )
7
+ [ ![ License] ( https://poser.pugx.org/laravel/framework/license.svg )] ( https://packagist.org/packages/laravel/framework )
8
+
3
9
laravel-subscription is a simple laravel 5 library for creating subscription billing and handling server notifications.
4
10
5
11
---
Original file line number Diff line number Diff line change @@ -10,7 +10,21 @@ class SubscriptionFactory{
10
10
protected $ serviceClassMap = array ();
11
11
12
12
public function __construct (){
13
- $ this ->registerService ('2checkout ' , 'Userdesk \\Subscription \\Services \\TwoCheckout ' );
13
+ $ this ->registerServiceAlias ('TwoCheckout ' , '2checkout ' );
14
+ }
15
+
16
+ /**
17
+ * Builds and returns payment services
18
+ *
19
+ * It will first try to build an payment service
20
+ *
21
+ * @param string $serviceName Name of service to create
22
+ *
23
+ * @return \Userdesk\Subscription\Contracts\Service
24
+ */
25
+
26
+ public function registerServiceAlias ($ serviceName , $ alias ){
27
+ $ this ->registerService ($ alias , 'Userdesk \\Subscription \\Services \\' .$ serviceName );
14
28
}
15
29
16
30
/**
@@ -24,6 +38,11 @@ public function __construct(){
24
38
*/
25
39
public function createService ($ serviceName ){
26
40
$ config = Config::get (sprintf ("subscription.services.%s " , $ serviceName ));
41
+
42
+ if (empty ($ config )){
43
+ throw new SubscriptionException (sprintf ('No Config exists for Service %s. ' , $ serviceName ));
44
+ }
45
+
27
46
$ fullyQualifiedServiceName = $ this ->getFullyQualifiedServiceName ($ serviceName );
28
47
if (class_exists ($ fullyQualifiedServiceName )) {
29
48
return $ this ->buildService ($ fullyQualifiedServiceName , $ config );
You can’t perform that action at this time.
0 commit comments