3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/hps/infrastructure/hps_gateway_response_validation.rb', line 3
def self.check_response(response, expected_type)
response_code = response["Header"]["GatewayRspCode"]
response_text = response["Header"]["GatewayRspMsg"]
transaction_id = response["Header"]["GatewayTxnId"]
if !response_code.eql? "0"
exception = Hps::ExceptionMapper.new.map_gateway_exception(transaction_id, response_code, response_text)
exception.response_code = response_code
exception.response_text = response_text
raise exception
end
unless response["Transaction"] && response["Transaction"][expected_type.to_s]
raise HpsGatewayException
end
end
|