lib/fawry/contracts/charge_request_contract.rb in fawry-1.2.1 vs lib/fawry/contracts/charge_request_contract.rb in fawry-1.3.0

- old
+ new

@@ -37,17 +37,19 @@ key.failure('card_token is required when payment_method is CARD') end end rule(:fawry_secure_key) do - if ENV['FAWRY_SECURE_KEY'].nil? && value.nil? - key(:fawry_secure_key).failure('fawry secure key is required as a param or an env var') + if Fawry.configuration.fawry_secure_key.nil? && ENV['FAWRY_SECURE_KEY'].nil? && value.nil? + key(:fawry_secure_key).failure('fawry secure key is required in either Fawry.configuration or'\ + 'as an environment variable (FAWRY_SECURE_KEY), or as an argument to this method') end end rule(:merchant_code) do - if ENV['FAWRY_MERCHANT_CODE'].nil? && value.nil? - key(:merchant_code).failure('fawry merchant code is required as a param or an env var') + if Fawry.configuration.fawry_merchant_code.nil? && ENV['FAWRY_MERCHANT_CODE'].nil? && value.nil? + key(:merchant_code).failure('fawry merchant code is required in either Fawry.configuration or'\ + 'as an environment variable (FAWRY_MERCHANT_CODE), or as an argument to this method') end end end end end