1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PatricPoba\MtnMomo; |
4
|
|
|
|
5
|
|
|
use PatricPoba\MtnMomo\MtnCollection; |
6
|
|
|
use PatricPoba\MtnMomo\MtnRemittance; |
7
|
|
|
use Illuminate\Support\ServiceProvider; |
8
|
|
|
use PatricPoba\MtnMomo\MtnDisbursement; |
9
|
|
|
|
10
|
|
|
class MtnMomoServiceProvider extends ServiceProvider |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* Bootstrap the application services. |
14
|
|
|
*/ |
15
|
|
|
public function boot() |
16
|
|
|
{ |
17
|
|
|
/* |
18
|
|
|
* Optional methods to load your package assets |
19
|
|
|
*/ |
20
|
|
|
// $this->registerResources(); |
21
|
|
|
|
22
|
|
|
// $this->registerRoutes(); |
23
|
|
|
|
24
|
|
|
if ($this->app->runningInConsole()) { |
25
|
|
|
$this->registerPublishing(); |
26
|
|
|
} |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Register the application services. |
31
|
|
|
*/ |
32
|
|
|
public function register() |
33
|
|
|
{ |
34
|
|
|
// Automatically apply the package configuration |
35
|
|
|
$this->mergeConfigFrom(__DIR__.'/../config/mtn-momo.php', 'mtn-momo'); |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
$config = new MtnConfig([ |
39
|
|
|
// general credentials |
40
|
|
|
'baseUrl' => config('mtn-momo.base_url'), |
41
|
|
|
'currency' => config('mtn-momo.currency'), |
42
|
|
|
'targetEnvironment' => config('mtn-momo.environment'), |
43
|
|
|
// collection credentials |
44
|
|
|
'collectionApiSecret' => config('mtn-momo.collection.api_secret'), |
45
|
|
|
'collectionPrimaryKey' => config('mtn-momo.collection.primary_key'), |
46
|
|
|
'collectionUserId' => config('mtn-momo.collection.user_id'), |
47
|
|
|
'collectionCallbackUrl' => config('mtn-momo.collection.callback_url'), |
48
|
|
|
// disbursement credentials |
49
|
|
|
'disbursementApiSecret' => config('mtn-momo.disbursement.api_secret'), |
50
|
|
|
'disbursementPrimaryKey' => config('mtn-momo.disbursement.primary_key'), |
51
|
|
|
'disbursementUserId' => config('mtn-momo.disbursement.user_id'), |
52
|
|
|
'disbursementCallbackUrl' => config('mtn-momo.disbursement.callback_url'), |
53
|
|
|
// remittance credentials |
54
|
|
|
'remittanceApiSecret' => config('mtn-momo.remittance.api_secret'), |
55
|
|
|
'remittancePrimaryKey' => config('mtn-momo.remittance.primary_key'), |
56
|
|
|
'remittanceUserId' => config('mtn-momo.remittance.user_id'), |
57
|
|
|
'remittanceCallbackUrl' => config('mtn-momo.remittance.callback_url'), |
58
|
|
|
]); |
59
|
|
|
|
60
|
|
|
|
61
|
|
|
$this->app->singleton('mtn-momo-collection', function () use ($config) { |
62
|
|
|
return new MtnCollection($config); |
63
|
|
|
}); |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
$this->app->singleton('mtn-momo-disbursement', function () use ($config) { |
67
|
|
|
return new MtnDisbursement($config); |
68
|
|
|
}); |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
$this->app->singleton('mtn-momo-remittance', function () use ($config) { |
72
|
|
|
return new MtnRemittance($config); |
73
|
|
|
}); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
// protected function registerRoutes() |
78
|
|
|
// { |
79
|
|
|
// // $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
80
|
|
|
|
81
|
|
|
// \Route::group([ |
82
|
|
|
// 'as' => 'qh-support-ticket-system.', |
83
|
|
|
// 'namespace' => 'Qodehub\TicketingApp\Http\Controllers', |
84
|
|
|
// ], function () { |
85
|
|
|
// $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
86
|
|
|
// }); |
87
|
|
|
// } |
88
|
|
|
|
89
|
|
|
// protected function registerResources() |
90
|
|
|
// { |
91
|
|
|
// // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'reports'); |
92
|
|
|
|
93
|
|
|
// $this->loadViewsFrom(__DIR__.'/../resources/views', 'qh-tickets'); |
94
|
|
|
|
95
|
|
|
// // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
96
|
|
|
// } |
97
|
|
|
|
98
|
|
|
|
99
|
|
|
|
100
|
|
|
protected function registerPublishing() |
101
|
|
|
{ |
102
|
|
|
// Automatically apply the package configuration |
103
|
|
|
$this->publishes([ |
104
|
|
|
__DIR__.'/../config/config.php' => config_path('mtn-momo.php'), |
105
|
|
|
], 'config'); |
106
|
|
|
|
107
|
|
|
// Publishing the views. |
108
|
|
|
/*$this->publishes([ |
109
|
|
|
__DIR__.'/../resources/views' => resource_path('views/vendor/reports'), |
110
|
|
|
], 'views');*/ |
111
|
|
|
|
112
|
|
|
// Publishing assets. |
113
|
|
|
/*$this->publishes([ |
114
|
|
|
__DIR__.'/../resources/assets' => public_path('vendor/reports'), |
115
|
|
|
], 'assets');*/ |
116
|
|
|
|
117
|
|
|
// Publishing the translation files. |
118
|
|
|
/*$this->publishes([ |
119
|
|
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/reports'), |
120
|
|
|
], 'lang');*/ |
121
|
|
|
|
122
|
|
|
// Registering package commands. |
123
|
|
|
// $this->commands([]); |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|