Skip to content

fix(connector): [redsys] psync transaction type mapping#7628

Merged
likhinbopanna merged 5 commits intomainfrom
redsys-capture-fix
Mar 26, 2025
Merged

fix(connector): [redsys] psync transaction type mapping#7628
likhinbopanna merged 5 commits intomainfrom
redsys-capture-fix

Conversation

@AkshayaFoiger
Copy link
Contributor

@AkshayaFoiger AkshayaFoiger commented Mar 25, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

In this PR

  1. Authorized Attempt status was mapped to Confirmation transaction type. But it should be mapped to Pre-Authorization.
  2. Adds browserIP to the connector payment request which is a mandatory field to be sent in production environment.

How did you test it?

Test

  1. Create a manual 3ds card transaction and do a psync before capture call
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_EGQ7GlLUxISLGlUsiVADWtoqBmxw07LrGBvztBw3GFnOYhYVAh5nT2chXJOfOW7u' \
--data-raw '{
    "amount": 10,
    "currency": "EUR",
    "return_url": "https://hyperswitch.io",
    "confirm": true,
    "customer_acceptance": null,
    "customer_id" :"asbh",
    "capture_method": "manual",
    "authentication_type": "three_ds",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "Ceutâ",
            "zip": "94122",
            "country": "ES",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "email": "mauro.morandi@nexi.it",
        "phone": {
            "number": "9123456789",
            "country_code": "+91"
        }
    },
    "email": "hyperswitch_sdk_demo_id@gmail.com",
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "en-US",
        "color_depth": 32,
        "screen_height": 1117,
        "screen_width": 1728,
        "time_zone": -330,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    
    "payment_method": "card",
    
    "payment_method_data": {
        "card": {
            "card_number": "4548814479727229",
            "card_exp_month": "12",
            "card_exp_year": "49",
            "card_holder_name": "Joseph",
            "card_cvc": "123"
        }
    },
    "setup_future_usage": "on_session",
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "Ceuta",
            "zip": "94122",
            "country": "ES",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "email": "mauro.morandi@nexi.it",
        "phone": {
            "number": "9123456789",
            "country_code": "+91"
        }
    }
}'

Response

{"payment_id":"pay_rwKhRr9dAqAttQe4JgTn","merchant_id":"postman_merchant_GHAction_42f3b809-6439-4372-b361-f9bc8e9498dd","status":"requires_capture","amount":10,"net_amount":10,"shipping_cost":null,"amount_capturable":10,"amount_received":null,"connector":"redsys","client_secret":"pay_rwKhRr9dAqAttQe4JgTn_secret_ulEePhsTatEfTfUm11Pk","created":"2025-03-25T11:54:53.876Z","currency":"EUR","customer_id":"asbh","customer":{"id":"asbh","name":null,"email":"hyperswitch_sdk_demo_id@gmail.com","phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"manual","payment_method":"card","payment_method_data":{"card":{"last4":"7229","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"454881","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"49","card_holder_name":"Joseph","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":"token_5PuVXvwm2RmXchPox71K","shipping":{"address":{"city":"San Fransico","country":"ES","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"Ceuta","first_name":"joseph","last_name":"Doe"},"phone":{"number":"9123456789","country_code":"+91"},"email":"mauro.morandi@nexi.it"},"billing":{"address":{"city":"San Fransico","country":"ES","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"Ceutâ","first_name":"joseph","last_name":"Doe"},"phone":{"number":"9123456789","country_code":"+91"},"email":"mauro.morandi@nexi.it"},"order_details":null,"email":"hyperswitch_sdk_demo_id@gmail.com","name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"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":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"asbh","created_at":1742903693,"expires":1742907293,"secret":"epk_2f88c0bacc514f5c9993dcc6a8ed88f0"},"manual_retry_allowed":false,"connector_transaction_id":"959804361926","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":"959804361926","payment_link":null,"profile_id":"pro_c5tItNnUXgY4Q5FJ7yjz","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_8xML5xLiLKwhfhWhoC0B","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-03-25T12:09:53.876Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-03-25T11:54:57.350Z","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":null,"card_discovery":"manual","issuer_error_code":null,"issuer_error_message":null}

Psync

curl --location 'http://localhost:8080/payments/pay_rwKhRr9dAqAttQe4JgTn?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_EGQ7GlLUxISLGlUsiVADWtoqBmxw07LrGBvztBw3GFnOYhYVAh5nT2chXJOfOW7u'

Response

{"payment_id":"pay_rwKhRr9dAqAttQe4JgTn","merchant_id":"postman_merchant_GHAction_42f3b809-6439-4372-b361-f9bc8e9498dd","status":"requires_capture","amount":10,"net_amount":10,"shipping_cost":null,"amount_capturable":10,"amount_received":null,"connector":"redsys","client_secret":"pay_rwKhRr9dAqAttQe4JgTn_secret_ulEePhsTatEfTfUm11Pk","created":"2025-03-25T11:54:53.876Z","currency":"EUR","customer_id":"asbh","customer":{"id":"asbh","name":null,"email":"hyperswitch_sdk_demo_id@gmail.com","phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"manual","payment_method":"card","payment_method_data":{"card":{"last4":"7229","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"454881","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"49","card_holder_name":"Joseph","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":"token_5PuVXvwm2RmXchPox71K","shipping":{"address":{"city":"San Fransico","country":"ES","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"Ceuta","first_name":"joseph","last_name":"Doe"},"phone":{"number":"9123456789","country_code":"+91"},"email":"mauro.morandi@nexi.it"},"billing":{"address":{"city":"San Fransico","country":"ES","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"Ceutâ","first_name":"joseph","last_name":"Doe"},"phone":{"number":"9123456789","country_code":"+91"},"email":"mauro.morandi@nexi.it"},"order_details":null,"email":"hyperswitch_sdk_demo_id@gmail.com","name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"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":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"959804361926","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":"959804361926","payment_link":null,"profile_id":"pro_c5tItNnUXgY4Q5FJ7yjz","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_8xML5xLiLKwhfhWhoC0B","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-03-25T12:09:53.876Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-03-25T11:55:51.691Z","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":null,"card_discovery":"manual","issuer_error_code":null,"issuer_error_message":null}

Earlier payment was failed when psync failed

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@AkshayaFoiger AkshayaFoiger requested a review from a team as a code owner March 25, 2025 11:57
@semanticdiff-com
Copy link

semanticdiff-com bot commented Mar 25, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/redsys.rs  63% smaller
  crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs  6% smaller

@AkshayaFoiger AkshayaFoiger self-assigned this Mar 25, 2025
@AkshayaFoiger AkshayaFoiger added A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration C-bug Category: Bug labels Mar 25, 2025
swangi-kumari
swangi-kumari previously approved these changes Mar 25, 2025
@AkshayaFoiger AkshayaFoiger changed the title fix(connector): [redsys] fix psync transaction type mapping fix(connector): [redsys] psync transaction type mapping Mar 25, 2025
@hyperswitch-bot hyperswitch-bot bot dismissed stale reviews from deepanshu-iiitu and swangi-kumari via 0eb229c March 25, 2025 12:46
@likhinbopanna likhinbopanna added this pull request to the merge queue Mar 26, 2025
Merged via the queue into main with commit 9159823 Mar 26, 2025
16 of 20 checks passed
@likhinbopanna likhinbopanna deleted the redsys-capture-fix branch March 26, 2025 14:24
GauravRawat369 pushed a commit that referenced this pull request Mar 27, 2025
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
pixincreate added a commit that referenced this pull request Mar 27, 2025
…e-status-check

* 'main' of github.com:juspay/hyperswitch:
  build(docker): specify user for runner stage (#7641)
  chore(version): 2025.03.27.0
  fix(connector): [Nexixpay] update status mapping nexixpay (#7612)
  refactor(connector): [TrustPay] Fix status and wasm changes  (#7649)
  fix(connector): [redsys] psync transaction type mapping (#7628)
  feat(themes): Add email configuration support for themes (#7580)
  feat(core): add profile level config for debit routing feature (#7470)
  fix(connector): [CYBERSOURCE]  change ucaf_collection_indicator for mastercard payments via netcetera (#7623)
  fix(connector): fix required fields for mandates supported connectors (#6930)
  chore(cypress): bump cypress to `v14.2.0` (#7640)
  feat(connector): [BRAINTREE] Pass connector request reference id (#7609)
  fix(connector): [GlobalPay] Address `5xx` when cancelling a paypal transaction (#7605)
  feat(dashboard_metadata): Add `ReconStatus` in `dashboard_metadata` (#7595)
  fix(connectors): [Adyen] remove redundant enums  (#7601)
  feat: add routing support for v2 sdk session flow (#6763)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration C-bug Category: Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants