mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
(feat) error message on payzen misconfigured currency
This commit is contained in:
parent
373d53eea1
commit
5b14a9a4a7
@ -1,6 +1,7 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Italian language support (credits to https://crowdin.com/profile/olazzari)
|
||||
- Improved error message on payzen misconfigured currency
|
||||
- Fix a bug: broken admin notifications if an order has been paid
|
||||
- Fix a bug: unable to bulk update settings
|
||||
|
||||
|
5
app/exceptions/configuration_error.rb
Normal file
5
app/exceptions/configuration_error.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Raised when Fab-manager is misconfigured
|
||||
class ConfigurationError < StandardError
|
||||
end
|
@ -113,6 +113,8 @@ class PayZen::Service < Payment::Service
|
||||
|
||||
def payzen_amount(amount)
|
||||
currency = Setting.get('payzen_currency')
|
||||
raise ConfigurationError, 'PayZen currency is not configured. Unable to process online payments.' if currency.nil?
|
||||
|
||||
return amount / 100 if zero_decimal_currencies.any? { |s| s.casecmp(currency).zero? }
|
||||
return amount * 10 if three_decimal_currencies.any? { |s| s.casecmp(currency).zero? }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user