fix(authorizedotnet): refund via ucs missing connector_metadata #9581
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
pendingstate where no connector call is madeconnector_metadatais empty in attempt tableconnector_metadatais not empty but this happened via ucs.solution
connector_metadatacontains last4 digits which can be fetched form payment_method_datahow did i test
{ "amount": 689, "customer_id": "hello_world", "currency": "USD", "confirm": true, "capture_method": "automatic", "payment_method": "card", "payment_method_type": "debit", "authentication_type": "no_three_ds", "setup_future_usage": "off_session", "customer_acceptance": { "acceptance_type": "online", "accepted_at": "1963-05-03T04:07:52.723Z", "online": { "ip_address": "127.0.0.1", "user_agent": "amet irure esse" } }, "email": "[email protected]", "description": "hellow world", "connector": [ "authorizedotnet" ], "billing": { "address": { "zip": "560095", "country": "US", "first_name": "Sakil", "last_name": "Mostak", "line1": "Fasdf", "line2": "Fasdf", "city": "Fasdf" } }, "payment_method_data": { "card": { "card_number": "4111111111111111", "card_exp_month": "12", "card_exp_year": "2029", "card_holder_name": "John Doe", "card_cvc": "123", "card_network": "Visa" } } }{ "payment_id": "pay_n4mGvzhDDxV8ontN4pNa", "merchant_id": "merchant_1759037295", "status": "succeeded", "amount": 689, "net_amount": 689, "shipping_cost": null, "amount_capturable": 0, "amount_received": 689, "connector": "authorizedotnet", "client_secret": "pay_n4mGvzhDDxV8ontN4pNa_secret_nJprHzvgyCnAQQxGeSD9", "created": "2025-09-28T07:38:56.792Z", "currency": "USD", "customer_id": "hello_world", "customer": { "id": "hello_world", "name": null, "email": "[email protected]", "phone": null, "phone_country_code": null }, "description": "hellow world", "refunds": null, "disputes": null, "mandate_id": null, "mandate_data": null, "setup_future_usage": "off_session", "off_session": null, "capture_on": null, "capture_method": "automatic", "payment_method": "card", "payment_method_data": { "card": { "last4": "1111", "card_type": null, "card_network": null, "card_issuer": null, "card_issuing_country": null, "card_isin": "411111", "card_extended_bin": null, "card_exp_month": "12", "card_exp_year": "2029", "card_holder_name": "John Doe", "payment_checks": { "description": "The street address and postal code matched.", "avs_result_code": "Y" }, "authentication_data": null }, "billing": null }, "payment_token": null, "shipping": null, "billing": { "address": { "city": "Fasdf", "country": "US", "line1": "Fasdf", "line2": "Fasdf", "line3": null, "zip": "560095", "state": null, "first_name": "Sakil", "last_name": "Mostak", "origin_zip": null }, "phone": null, "email": null }, "order_details": null, "email": "[email protected]", "name": null, "phone": null, "return_url": null, "authentication_type": "no_three_ds", "statement_descriptor_name": null, "statement_descriptor_suffix": null, "next_action": null, "cancellation_reason": null, "error_code": null, "error_message": null, "unified_code": null, "unified_message": null, "payment_experience": null, "payment_method_type": "debit", "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": { "customer_id": "hello_world", "created_at": 1759045136, "expires": 1759048736, "secret": "epk_d109625edc44483a9a0d6e034153633f" }, "manual_retry_allowed": null, "connector_transaction_id": "120071750406", "frm_message": null, "metadata": null, "connector_metadata": null, "feature_metadata": { "redirect_response": null, "search_tags": null, "apple_pay_recurring_details": null, "gateway_system": "direct" }, "reference_id": "120071750406", "payment_link": null, "profile_id": "pro_KP1SMsZKdiOrioYnjKO2", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_Ym77o958MRzqZWCyOQXt", "incremental_authorization_allowed": false, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2025-09-28T07:53:56.792Z", "fingerprint": null, "browser_info": null, "payment_channel": null, "payment_method_id": "pm_BS4qjY5VS1ARCBexzcfb", "network_transaction_id": "ZKS4CMGOARXYQR4IVKIRAOE", "payment_method_status": "active", "updated": "2025-09-28T07:38:59.120Z", "split_payments": null, "frm_metadata": null, "extended_authorization_applied": null, "capture_before": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": "932841928-932130361", "card_discovery": "manual", "force_3ds_challenge": false, "force_3ds_challenge_trigger": false, "issuer_error_code": null, "issuer_error_message": null, "is_iframe_redirection_enabled": null, "whole_connector_response": null, "enable_partial_authorization": null, "enable_overcapture": null, "is_overcapture_enabled": null, "network_details": null }Delete connector metadata
NOTE THAT in sbx we cannot make successful refund , its skipped in cypress too. Now the api call is goign
{ "refund_id": "ref_KlllCvhIs4k7Twk6teXh", "payment_id": "pay_n4mGvzhDDxV8ontN4pNa", "amount": 689, "currency": "USD", "status": "failed", "reason": "pause", "metadata": null, "error_message": "The referenced transaction does not meet the criteria for issuing a credit.", "error_code": "54", "unified_code": "UE_9000", "unified_message": "Something went wrong", "created_at": "2025-09-28T07:46:51.621Z", "updated_at": "2025-09-28T07:46:53.144Z", "connector": "authorizedotnet", "profile_id": "pro_KP1SMsZKdiOrioYnjKO2", "merchant_connector_id": "mca_Ym77o958MRzqZWCyOQXt", "split_refunds": null, "issuer_error_code": null, "issuer_error_message": null }Additional Changes
Motivation and Context
How did you test it?
Checklist
cargo +nightly fmt --allcargo clippy