1
0
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:
Sylvain 2023-04-05 09:46:00 +02:00
parent 373d53eea1
commit 5b14a9a4a7
3 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,5 @@
# frozen_string_literal: true
# Raised when Fab-manager is misconfigured
class ConfigurationError < StandardError
end

View File

@ -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? }