Skip to content

Adds return_code to MLE response#171

Open
ShepFc3 wants to merge 1 commit into
CyberSource:masterfrom
Breeze-Aviation:master
Open

Adds return_code to MLE response#171
ShepFc3 wants to merge 1 commit into
CyberSource:masterfrom
Breeze-Aviation:master

Conversation

@ShepFc3

@ShepFc3 ShepFc3 commented Jul 13, 2026

Copy link
Copy Markdown

An error was being returned incorrectly because of the missing return_code on the Typhoeus::Response object when MLE was enabled. The success? call on the response object (line 95) returns false without the return_code set as seen here:

=> #<Typhoeus::Response:0x0000000127e23330 @options={:code=>200, :body=>"ok"}>
[6] pry(main)> r.success?
=> false
[7] pry(main)> r = Typhoeus::Response.new(code: 200, return_code: :ok, body: 'ok')
=> #<Typhoeus::Response:0x0000000126782d88 @options={:code=>200, :return_code=>:ok, :body=>"ok"}>
[8] pry(main)> r.success?
=> true

This is causing the SDK to return/raise an error even though the API response was successful. Here is an example response from before the fix:

CyberSource::ApiError: {:code=>200, :response_headers=>{...}, :response_body=>"{\"_links\":{\"self\":{\"href\":\"https://apitest.cybersource.com/tms/v1/instrumentidentifiers/564759D17DDxxxxxxxxxxF598E0A7598\"},\"paymentInstruments\":{\"href\":\"https://apitest.cybersource.com/tms/v1/instrumentidentifiers/564759D17DDxxxxxxxxxxF598E0A7598/paymentinstruments\"}},\"id\":\"564759D17DDxxxxxxxxxxF598E0A7598\",\"object\":\"instrumentIdentifier\",\"state\":\"ACTIVE\",\"card\":{\"number\":\"411111XXXXXX2222\"},\"metadata\":{\"creator\":\"org_id_01\"},\"_embedded\":{\"binLookup\":{\"issuer\":{\"country\":\"PL\",\"name\":\"Conotoxia Sp.zo.o.\"},\"status\":\"COMPLETED\",\"paymentAccountInformation\":{\"card\":{\"type\":\"001\",\"brandName\":\"VISA\",\"credentialType\":\"PAN\",\"currency\":\"PLN\",\"cardType\":\"VISA\"}}}}}"} (CyberSource::ApiError)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant