-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix(connector): [payload] RSync throwing 404 and re-use existing util functions #10542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the Payload connector implementation to use existing utility trait methods (PaymentsSyncRequestData::get_connector_transaction_id() and RefundsRequestData::get_connector_refund_id()) instead of manually extracting and error-handling these fields.
- Simplifies payment sync and refund sync URL construction by delegating to utility methods
- Updates imports to include the necessary trait methods
- Reduces code duplication by leveraging existing utility functions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10542 +/- ##
=======================================
Coverage ? 6.46%
=======================================
Files ? 1251
Lines ? 311785
Branches ? 0
=======================================
Hits ? 20164
Misses ? 291621
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Type of Change
Description
this is a minor refactor to use the existing util functions instead of re-inventing the wheel
Additional Changes
Motivation and Context
while working on ucs, observed this.
How did you test it?
psync and rsync should not be affected:
Payment
{ "payment_id": "pay_BrlKK94mKFH3wP5Vmv1A", "merchant_id": "postman_merchant_GHAction_1765219033", "status": "succeeded", "amount": 60159, "net_amount": 60159, "shipping_cost": null, "amount_capturable": 0, "amount_received": 60159, "connector": "payload", "client_secret": "pay_BrlKK94mKFH3wP5Vmv1A_secret_yNl4ulRKiBsBQVuH1wvQ", "created": "2025-12-08T18:37:26.789Z", "modified_at": "2025-12-08T18:37:29.407Z", "currency": "USD", "customer_id": "customer", "customer": { "id": "customer", "name": null, "email": "[email protected]", "phone": "999999999", "phone_country_code": "+1" }, "description": "Its my first payment request", "refunds": null, "disputes": null, "mandate_id": null, "mandate_data": null, "setup_future_usage": null, "off_session": null, "capture_on": null, "capture_method": "automatic", "payment_method": "card", "payment_method_data": { "card": { "last4": "1111", "card_type": "CREDIT", "card_network": "Visa", "card_issuer": "JP Morgan", "card_issuing_country": "INDIA", "card_isin": "411111", "card_extended_bin": null, "card_exp_month": "10", "card_exp_year": "26", "card_holder_name": "Joseph Doe", "payment_checks": { "avs_result": "street_and_zip" }, "authentication_data": null }, "billing": null }, "payment_token": null, "shipping": { "address": { "city": "San Fransico", "country": "US", "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "zip": "94122", "state": "California", "first_name": "PiX", "last_name": null, "origin_zip": null }, "phone": null, "email": null }, "billing": { "address": { "city": "San Fransico", "country": "US", "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "zip": "94122", "state": "California", "first_name": "PiX", "last_name": "THE", "origin_zip": null }, "phone": null, "email": null }, "order_details": null, "email": "[email protected]", "name": null, "phone": "999999999", "return_url": "https://duck.com/", "authentication_type": "no_three_ds", "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "next_action": null, "cancellation_reason": null, "error_code": null, "error_message": null, "unified_code": null, "unified_message": null, "payment_experience": null, "payment_method_type": "credit", "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": { "customer_id": "customer", "created_at": 1765219046, "expires": 1765222646, "secret": "epk_406f0b86642641c0a32a6767e4803852" }, "manual_retry_allowed": null, "connector_transaction_id": "txn_3f3D5P0q3P2t5nqOMJwDT", "frm_message": null, "metadata": { "udf1": "value1", "login_date": "2019-09-10T10:11:12Z", "new_customer": "true" }, "connector_metadata": null, "feature_metadata": { "redirect_response": null, "search_tags": null, "apple_pay_recurring_details": null, "gateway_system": "direct" }, "reference_id": "PL-UMV-PCV-TF5", "payment_link": null, "profile_id": "pro_3V2idKMuFgUCTiOjFUM0", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_LJWkcQEbnAOXgJ4WJZV0", "incremental_authorization_allowed": false, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2025-12-08T18:52:26.789Z", "fingerprint": null, "browser_info": { "language": "en-GB", "time_zone": -330, "ip_address": "208.127.127.193", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0", "color_depth": 24, "java_enabled": true, "screen_width": 1280, "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", "screen_height": 720, "java_script_enabled": true }, "payment_channel": null, "payment_method_id": null, "network_transaction_id": null, "payment_method_status": null, "updated": "2025-12-08T18:37:29.407Z", "split_payments": null, "frm_metadata": null, "extended_authorization_applied": null, "extended_authorization_last_applied_at": null, "request_extended_authorization": null, "capture_before": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null, "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, "is_stored_credential": null, "mit_category": null, "billing_descriptor": null, "tokenization": null, "partner_merchant_identifier_details": null, "payment_method_tokenization_details": null }PSync
{ "payment_id": "pay_BrlKK94mKFH3wP5Vmv1A", "merchant_id": "postman_merchant_GHAction_1765219033", "status": "succeeded", "amount": 60159, "net_amount": 60159, "shipping_cost": null, "amount_capturable": 0, "amount_received": 60159, "connector": "payload", "client_secret": "pay_BrlKK94mKFH3wP5Vmv1A_secret_yNl4ulRKiBsBQVuH1wvQ", "created": "2025-12-08T18:37:26.789Z", "modified_at": "2025-12-08T18:37:29.407Z", "currency": "USD", "customer_id": "customer", "customer": { "id": "customer", "name": null, "email": "[email protected]", "phone": "999999999", "phone_country_code": "+1" }, "description": "Its my first payment request", "refunds": null, "disputes": null, "mandate_id": null, "mandate_data": null, "setup_future_usage": null, "off_session": null, "capture_on": null, "capture_method": "automatic", "payment_method": "card", "payment_method_data": { "card": { "last4": "1111", "card_type": "CREDIT", "card_network": "Visa", "card_issuer": "JP Morgan", "card_issuing_country": "INDIA", "card_isin": "411111", "card_extended_bin": null, "card_exp_month": "10", "card_exp_year": "26", "card_holder_name": "Joseph Doe", "payment_checks": { "avs_result": "street_and_zip" }, "authentication_data": null }, "billing": null }, "payment_token": null, "shipping": { "address": { "city": "San Fransico", "country": "US", "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "zip": "94122", "state": "California", "first_name": "PiX", "last_name": null, "origin_zip": null }, "phone": null, "email": null }, "billing": { "address": { "city": "San Fransico", "country": "US", "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "zip": "94122", "state": "California", "first_name": "PiX", "last_name": "THE", "origin_zip": null }, "phone": null, "email": null }, "order_details": null, "email": "[email protected]", "name": null, "phone": "999999999", "return_url": "https://duck.com/", "authentication_type": "no_three_ds", "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "next_action": null, "cancellation_reason": null, "error_code": null, "error_message": null, "unified_code": null, "unified_message": null, "payment_experience": null, "payment_method_type": "credit", "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": null, "manual_retry_allowed": null, "connector_transaction_id": "txn_3f3D5P0q3P2t5nqOMJwDT", "frm_message": null, "metadata": { "udf1": "value1", "login_date": "2019-09-10T10:11:12Z", "new_customer": "true" }, "connector_metadata": null, "feature_metadata": { "redirect_response": null, "search_tags": null, "apple_pay_recurring_details": null, "gateway_system": "direct" }, "reference_id": "PL-UMV-PCV-TF5", "payment_link": null, "profile_id": "pro_3V2idKMuFgUCTiOjFUM0", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_LJWkcQEbnAOXgJ4WJZV0", "incremental_authorization_allowed": false, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2025-12-08T18:52:26.789Z", "fingerprint": null, "browser_info": { "language": "en-GB", "time_zone": -330, "ip_address": "208.127.127.193", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0", "color_depth": 24, "java_enabled": true, "screen_width": 1280, "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", "screen_height": 720, "java_script_enabled": true }, "payment_channel": null, "payment_method_id": null, "network_transaction_id": null, "payment_method_status": null, "updated": "2025-12-08T18:37:29.407Z", "split_payments": null, "frm_metadata": null, "extended_authorization_applied": null, "extended_authorization_last_applied_at": null, "request_extended_authorization": null, "capture_before": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null, "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, "is_stored_credential": null, "mit_category": null, "billing_descriptor": null, "tokenization": null, "partner_merchant_identifier_details": null, "payment_method_tokenization_details": null }Refund
{ "refund_id": "ref_7ZiTs56tnbzOifmj1ZX9", "payment_id": "pay_BrlKK94mKFH3wP5Vmv1A", "amount": 600, "currency": "USD", "status": "succeeded", "reason": "Customer returned product", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" }, "error_message": null, "error_code": null, "unified_code": null, "unified_message": null, "created_at": "2025-12-08T18:38:37.292Z", "updated_at": "2025-12-08T18:38:38.200Z", "connector": "payload", "profile_id": "pro_3V2idKMuFgUCTiOjFUM0", "merchant_connector_id": "mca_LJWkcQEbnAOXgJ4WJZV0", "split_refunds": null, "issuer_error_code": null, "issuer_error_message": null, "raw_connector_response": null }RSync
{ "refund_id": "ref_7ZiTs56tnbzOifmj1ZX9", "payment_id": "pay_BrlKK94mKFH3wP5Vmv1A", "amount": 600, "currency": "USD", "status": "succeeded", "reason": "Customer returned product", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" }, "error_message": null, "error_code": null, "unified_code": null, "unified_message": null, "created_at": "2025-12-08T18:38:37.292Z", "updated_at": "2025-12-08T18:38:56.937Z", "connector": "payload", "profile_id": "pro_3V2idKMuFgUCTiOjFUM0", "merchant_connector_id": "mca_LJWkcQEbnAOXgJ4WJZV0", "split_refunds": null, "issuer_error_code": null, "issuer_error_message": null, "raw_connector_response": null }Checklist
cargo +nightly fmt --alljust clippy && just clippy_v2