-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.rb
73 lines (57 loc) · 3.18 KB
/
init.rb
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
require 'redmine'
require 'wice_grid_config'
Rails.configuration.to_prepare do
require_dependency 'project'
Project.send(:include, RedminePayments::Decorators::ProjectDecorator)
require_dependency 'invoice'
Invoice.send(:include, RedminePayments::Decorators::InvoiceDecorator)
require_dependency 'invoice_payments_controller'
InvoicePaymentsController.send(:include, RedminePayments::Decorators::InvoicePaymentsDecorator)
require_dependency 'invoices_controller'
InvoicesController.send(:include, RedminePayments::Decorators::InvoicesDecorator)
require_dependency 'user'
User.send(:include, RedminePayments::Decorators::UserDecorator)
require_dependency 'invoice_payment'
InvoicePayment.send(:include, RedminePayments::Decorators::InvoicePaymentDecorator)
require_dependency 'contact'
Contact.send(:include, RedminePayments::Decorators::ContactDecorator)
Moneyjs.configure do |config|
config.only_currencies = ['PKR','USD']
end
end
Redmine::Plugin.register :redmine_payments do
name 'Redmine Payments plugin'
author 'Arkhitech'
description 'This is a plugin for Redmine which incorporates payment of invoices through credit cards'
version '0.0.1'
url 'https://github.com/arkhitech/redmine_payments'
author_url 'https://github.com/arkhitech'
menu :project_menu, :redmine_payments, { controller: 'payments', action: 'index' },
caption: :caption_redmine_payments, param: :project_id
menu :top_menu, :invoice_payments, {:controller => 'invoice_payments', :action => 'index', :project_id => nil}, :caption => "Invoice Payments", :if => Proc.new {
User.current.allowed_to?({:controller => 'invoice_payments', :action => 'index'}, nil, {:global => true}) && Setting.plugin_redmine_payments[:payment_invoices_show_payment_invoices_in_top_menu ]
}
menu :application_menu, :invoice_payments,
{:controller => 'invoice_payments', :action => 'index'},
:caption => "Invoice Payments",
:param => :project_id,
:if => Proc.new{
User.current.allowed_to?({controller: 'invoice_payments', action: 'index'},
nil, {global: true}) && Setting.plugin_redmine_payments[:payment_invoices_show_payment_in_app_menu]}
menu :project_menu, :copy_invoices,
{:controller => 'copy_invoices', :action => 'index'},
:caption => "Copy Invoice", :param => :project_id
menu :project_menu, :invoice_payments,
{:controller => 'invoice_payments', :action => 'index'},
:caption => "Invoice Payments", :param => :project_id
project_module :payments do
permission :make_payment, {payments: [:index, :generate, :finalize, :register],
invoice_payments: [:index, :show],
}
permission :list_and_edit_invoice_payments, {invoice_payments: [:index, :edit, :show], copy_invoices: [:index], invoices: [:copy]}
end
settings default: {
'payment_gateway_currency' => 'PKR',
'open_exchange_rate_app_id' => '24505f9c95c7405597f5eb5f43f3ed48'},
:partial => 'settings/payment_settings'
end