lib/active_merchant/billing/gateways/adyen.rb in activemerchant-1.120.0 vs lib/active_merchant/billing/gateways/adyen.rb in activemerchant-1.121.0
- old
+ new
@@ -395,10 +395,11 @@
end
def add_reference(post, authorization, options = {})
_, psp_reference, = authorization.split('#')
post[:originalReference] = single_reference(authorization) || psp_reference
+ post[:networkTxReference] = options[:network_transaction_id] if options[:network_transaction_id]
end
def add_original_reference(post, authorization, options = {})
if authorization.start_with?('#')
_, original_psp_reference, = authorization.split('#')
@@ -509,18 +510,20 @@
response = parse(raw_response)
rescue ResponseError => e
raw_response = e.response.body
response = parse(raw_response)
end
+
success = success_from(action, response, options)
Response.new(
success,
message_from(action, response),
response,
authorization: authorization_from(action, parameters, response),
test: test?,
error_code: success ? nil : error_code_from(response),
+ network_transaction_id: network_transaction_id_from(response),
avs_result: AVSResult.new(code: avs_code_from(response)),
cvv_result: CVVResult.new(cvv_result_from(response))
)
end
@@ -617,9 +620,13 @@
JSON.generate(parameters)
end
def error_code_from(response)
STANDARD_ERROR_CODE_MAPPING[response['errorCode']]
+ end
+
+ def network_transaction_id_from(response)
+ response.dig('additionalData', 'networkTxReference')
end
def add_browser_info(browser_info, post)
return unless browser_info