1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

include payzen frontend libs if enabled

This commit is contained in:
Sylvain 2021-04-07 17:17:17 +02:00
parent 635e8d3356
commit 4245747072
2 changed files with 29 additions and 0 deletions

View File

@ -20,6 +20,16 @@
<script type="text/javascript" src="//cdn.crowdin.com/jipt/jipt.js"></script>
<% end %>
<% require 'pay_zen/helper' %>
<% if PayZen::Helper.enabled? %>
<% endpoint = Setting.get('payzen_endpoint') %>
<%=stylesheet_link_tag "#{endpoint}/static/js/krypton-client/V4.0/ext/classic-reset.css" %>
<%=javascript_include_tag "#{endpoint}/static/js/krypton-client/V4.0/ext/classic.js" %>
<% if Rails.env.development? %>
<%=javascript_include_tag "#{endpoint}/static/js/krypton-client/V4.0/ext/classic.js.map" %>
<% end %>
<% end %>
<script type="text/javascript">
var Fablab = Fablab || {};

19
lib/pay_zen/helper.rb Normal file
View File

@ -0,0 +1,19 @@
# frozen_string_literal: true
# PayZen payement gateway
module PayZen; end
## Provides various methods around the PayZen payment gateway
class PayZen::Helper
class << self
def enabled?
return false unless Setting.get('payment_gateway') == 'payzen'
res = true
%w[payzen_username payzen_password payzen_endpoint payzen_public_key payzen_hmac payzen_currency].each do |pz_setting|
res = false unless Setting.get(pz_setting).present?
end
res
end
end
end