Skip to content

feat(core): Consuming locale in PaymentsAuthorizeData from SessionState#8731

Merged
Gnanasundari24 merged 3 commits intomainfrom
adyen/locale
Jul 24, 2025
Merged

feat(core): Consuming locale in PaymentsAuthorizeData from SessionState#8731
Gnanasundari24 merged 3 commits intomainfrom
adyen/locale

Conversation

@bsayak03
Copy link
Contributor

@bsayak03 bsayak03 commented Jul 23, 2025

Type of Change

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

Description

Accept-Language we pass in headers and we will consume locale from SessionState in PaymentsAuthorizeData.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Payments Link Create ( Confirm False ) :

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ECvrFYxLG0HyJfKyvLX6AI8TlBKre5HV8JyEPflpWStcL0MNYiRxO6I6ygoTV9zM' \
--header 'Accept-Language: zh-hk' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data '{
    "authentication_type": "no_three_ds",
    "customer_id": "cus_r9KFfEGCaZOo0v9K4f4g",
    
    "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"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "CA",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "HK",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "amount": 1,
    "currency": "HKD",
    "confirm": false,
    "payment_link": true,
    "session_expiry": 2629800,
    "return_url": "https://www.example.com"
}'

Response :

{
    "payment_id": "pay_6aSu1146nOWGFU1nHba0",
    "merchant_id": "merchant_1753270998",
    "status": "requires_payment_method",
    "amount": 1,
    "net_amount": 1,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_6aSu1146nOWGFU1nHba0_secret_5n6XyQfzhH1awaPXpoaV",
    "created": "2025-07-23T12:07:46.620Z",
    "currency": "HKD",
    "customer_id": "cus_r9KFfEGCaZOo0v9K4f4g",
    "customer": {
        "id": "cus_r9KFfEGCaZOo0v9K4f4g",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": null,
    "payment_method_data": null,
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "HK",
            "line1": "1467",
            "line2": "CA",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "CA",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.example.com/",
    "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": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cus_r9KFfEGCaZOo0v9K4f4g",
        "created_at": 1753272466,
        "expires": 1753276066,
        "secret": "epk_1bfcae3a1ae147aa81717faadc24d405"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": {
        "link": "http://localhost:8080/payment_link/merchant_1753270998/pay_6aSu1146nOWGFU1nHba0?locale=zh-hk",
        "secure_link": null,
        "payment_link_id": "plink_6hSyiN1JxpIBfs6LxzF7"
    },
    "profile_id": "pro_z03ICBN6bBbLQCA5g0JW",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-22T22:37:46.617Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-23T12:07:46.632Z",
    "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": null,
    "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
}
Screenshot 2025-07-23 at 6 14 30 PM

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

@bsayak03 bsayak03 requested review from a team as code owners July 23, 2025 11:20
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jul 23, 2025

@bsayak03 bsayak03 self-assigned this Jul 23, 2025
@bsayak03 bsayak03 changed the title feat(core): Consuming locale in AuthorizeData from SessionState feat(core): Consuming locale in PaymentsAuthorizeData from SessionState Jul 23, 2025
pub merchant_config_currency: Option<storage_enums::Currency>,
pub connector_testing_data: Option<pii::SecretSerdeValue>,
pub order_id: Option<String>,
pub locale: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should local be string or enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in struct SessionState, it is marked as String.
ref: crates/router/src/routes/app.rs

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 24, 2025
Merged via the queue into main with commit be03dd2 Jul 24, 2025
20 of 24 checks passed
@Gnanasundari24 Gnanasundari24 deleted the adyen/locale branch July 24, 2025 15:49
pixincreate added a commit that referenced this pull request Jul 28, 2025
…rver

* 'main' of github.com:juspay/hyperswitch: (24 commits)
  chore(version): 2025.07.28.1
  feat(core): Hyperswitch <|> UCS Mandate flow integration (#8738)
  feat(themes): Create user APIs for managing themes (#8387)
  chore: update devDependencies for cypress (#8735)
  refactor: Add routing_approach other variant to handle unknown data (#8754)
  chore(version): 2025.07.28.0
  refactor(connector): [facilitapay] move destination bank account number to connector metadata (#8704)
  feat(recovery-events): add revenue recovery topic and vector config to push these events to s3 (#8285)
  ci(cypress): add authorizedotnet connector (#8688)
  refactor(schema): add a new column for storing large customer user agents in mandate table (#8616)
  feat(authentication): add authentication api for modular authentication (#8459)
  feat(connector): [MPGS] template code (#8544)
  fix(chat): append request id to headers for chat request (#8680)
  feat(connector): [Flexiti]template code for flexiti connector (#8714)
  chore(version): 2025.07.25.0
  feat(core): Consuming locale in PaymentsAuthorizeData from SessionState (#8731)
  fix(payment-methods): fetch payment method details in payouts flow (#8729)
  refactor(core): remove hardcoded timeout limit of 5s for outgoing webhook requests (#8725)
  feat(connector): [Breadpay]Add support for Breadpay connector (#8676)
  fix(feature_matrix): refunds are supported by jpmorgan (#8699)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants