-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathPlugin.php
More file actions
213 lines (197 loc) · 6.27 KB
/
Plugin.php
File metadata and controls
213 lines (197 loc) · 6.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php namespace Responsiv\Pay;
use Event;
use Backend;
use System\Classes\PluginBase;
use System\Classes\SettingsManager;
/**
* Pay Plugin Information File
*/
class Plugin extends PluginBase
{
/**
* @var array require plugins
*/
public $require = [
'RainLab.User',
'RainLab.UserPlus',
'RainLab.Location',
'Responsiv.Currency'
];
/**
* pluginDetails returns information about this plugin.
*/
public function pluginDetails()
{
return [
'name' => "Pay",
'description' => "Invoicing and Accounting",
'author' => 'Responsiv Software',
'icon' => 'icon-credit-card',
'homepage' => 'https://github.com/responsiv/pay-plugin'
];
}
/**
* boot
*/
public function boot()
{
Event::subscribe(\Responsiv\Pay\Classes\ExtendUserPlugin::class);
}
/**
* register the service provider.
*/
public function register()
{
$this->registerSingletons();
$this->registerDomPdf();
$this->registerConsoleCommand('pay.migratev1', \Responsiv\Pay\Console\MigrateV1Command::class);
}
/**
* registerSingletons
*/
protected function registerSingletons()
{
$this->app->singleton('pay.gateways', \Responsiv\Pay\Classes\GatewayManager::class);
}
/**
* registerDomPdf configures the dompdf library for October CMS
*/
protected function registerDomPdf()
{
$this->app['config']->set('dompdf.public_path', public_path());
$this->app['config']->set('dompdf.options.enable_remote', true);
$this->app['config']->set('dompdf.options.chroot', [
realpath(base_path()),
realpath(public_path()),
]);
}
/**
* registerComponents
*/
public function registerComponents()
{
return [
\Responsiv\Pay\Components\Payment::class => 'payment',
\Responsiv\Pay\Components\Invoice::class => 'invoice',
\Responsiv\Pay\Components\Invoices::class => 'invoices',
\Responsiv\Pay\Components\PayProfile::class => 'payProfile',
\Responsiv\Pay\Components\PayProfiles::class => 'payProfiles',
];
}
/**
* Registers any back-end permissions used by this plugin.
*
* @return array
*/
public function registerPermissions()
{
return [
'responsiv.pay.access_invoices' => [
'tab' => 'Pay',
'label' => 'Access invoices'
],
'responsiv.pay.manage_taxes' => [
'tab' => 'Pay',
'label' => 'Manage taxes'
],
'responsiv.pay.manage_gateways' => [
'tab' => 'Pay',
'label' => 'Manage gateways'
],
'responsiv.pay.access_settings' => [
'tab' => 'Pay',
'label' => 'Access settings'
],
];
}
/**
* registerMailTemplates
*/
public function registerMailTemplates()
{
return [
'pay:invoice' => 'responsiv.pay::mail.invoice',
];
}
/**
* registerPaymentGateways registers any payment gateways implemented in this plugin.
*
* The gateways must be returned in the following format:
*
* [DriverName1::class => 'alias'],
* [DriverName2::class => 'anotherAlias']
*/
public function registerPaymentGateways()
{
return [
\Responsiv\Pay\PaymentTypes\PayPalPayment::class => 'paypal',
\Responsiv\Pay\PaymentTypes\StripePayment::class => 'stripe',
\Responsiv\Pay\PaymentTypes\RazorPayPayment::class => 'razorpay',
\Responsiv\Pay\PaymentTypes\CustomPayment::class => 'custom',
];
}
/**
* registerNavigation
*/
public function registerNavigation()
{
return [
'pay' => [
'label' => "Payments",
'url' => Backend::url('responsiv/pay/invoices'),
'icon' => 'icon-credit-card',
'iconSvg' => 'plugins/responsiv/pay/assets/images/pay-icon.svg',
'permissions' => ['responsiv.pay.*'],
'order' => 420,
'sideMenu' => [
'invoices' => [
'label' => "Invoices",
'icon' => 'icon-file-text-o',
'url' => Backend::url('responsiv/pay/invoices'),
'permissions' => ['responsiv.pay.access_invoices'],
],
'taxes' => [
'label' => "Tax Classes",
'icon' => 'icon-table',
'url' => Backend::url('responsiv/pay/taxes'),
'permissions' => ['responsiv.pay.manage_taxes'],
'order' => 500,
],
'types' => [
'label' => "Payment Methods",
'icon' => 'icon-money',
'url' => Backend::url('responsiv/pay/paymentmethods'),
'permissions' => ['responsiv.pay.manage_gateways'],
'order' => 510,
],
]
]
];
}
/**
* registerSettings
*/
public function registerSettings()
{
return [
'settings' => [
'label' => "Payment Settings",
'description' => "Manage payment configuration",
'icon' => 'icon-credit-card',
'class' => \Responsiv\Pay\Models\Setting::class,
'category' => SettingsManager::CATEGORY_SHOP,
'permissions' => ['responsiv.pay.access_settings'],
'order' => 800,
],
'invoice_settings' => [
'label' => "Invoice Templates",
'description' => "Customize invoice templates and settings.",
'icon' => 'icon-file-excel-o',
'url' => Backend::url('responsiv/pay/invoicetemplates'),
'category' => SettingsManager::CATEGORY_SHOP,
'permissions' => ['responsiv.pay.access_settings'],
'order' => 900,
]
];
}
}