I want to get the content from YALM file qqpay, online_banking, bank_payout
using Ruby. I tried this:
YAML File content:
paysec:
supported_trx_types: [qqpay, online_banking, bank_payout]
Ruby code:
def load_paysec_payment_type_with_base_params
YAML.load_file("config/gateway_supported_trx_types.yml")['paysec']['supported_trx_types']
raise "\n\nMissing configuration for paysec in file config/gateway_supported_trx_types.yaml}"
end
Iterate into the file content:
load_paysec_payment_type_with_base_params.each do |factory_name|
process_trx([factory_name.to_s], GATEWAY_NAME, base_params_for(factory_name))
end
But I get exception:
sanity_checks.rb:32:in `execute': (RuntimeError)
Missing configuration for paysec in file config/gateway_supported_trx_types.yaml}
What is the proper way to get the content?
it should be something like this:
def load_paysec_payment_type_with_base_params
begin
YAML.load_file("config/gateway_supported_trx_types.yml")['paysec']['supported_trx_types']
rescue Exception => e
"\n\nMissing configuration for paysec in file config/gateway_supported_trx_types.yaml}. reason: " + e.message
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.