1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-03-21 12:29:03 +01:00

improve error message in case of payzen error

This commit is contained in:
Sylvain 2021-05-27 17:13:24 +02:00
parent 6cd74ac33e
commit 136159a2b5

View File

@ -27,7 +27,12 @@ class PayZen::Client
}
res = Net::HTTP.post(uri, payload.to_json, headers)
JSON.parse(res.body) if res.is_a?(Net::HTTPSuccess)
raise PayzenError unless res.is_a?(Net::HTTPSuccess)
json = JSON.parse(res.body)
raise PayzenError(json['answer']['errorMessage']) if json['status'] == 'ERROR'
json
end
def base_url