Skip to content

feat(payments): [Payment links] Add support for traditional chinese locale for payment links#6745

Merged
likhinbopanna merged 1 commit intomainfrom
addTraditionalChineseLocale
Dec 5, 2024
Merged

feat(payments): [Payment links] Add support for traditional chinese locale for payment links#6745
likhinbopanna merged 1 commit intomainfrom
addTraditionalChineseLocale

Conversation

@dgeee13
Copy link
Contributor

@dgeee13 dgeee13 commented Dec 4, 2024

Type of Change

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

Description

Add support for traditional chinese locale for payment links

SDK PR juspay/hyperswitch-web#822

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?

(Need to run both hyperswitch-web and hyperswitch locally to test)

1. Update `allowed_domains` in business profile (Expand to see details)
curl --location 'http://localhost:8080/account/merchant_1733317126/business_profile/pro_I5CYJ8tVS6OHA1GMcXaW' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "payment_link_config": {
        "allowed_domains": [
            "*"
        ],
        "enabled_saved_payment_method": true,
        "hide_card_nickname_field" : true
    }
}'

2. Create a payment link with Accept-Language header as "zh-Hant"

cURL
curl --location --request POST 'http://localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: dev_9ujhlj2TyCy27k37JtCmZZMbTLKVVebPRTtPcWE1okFjsngoqlZEaw4nQtX1zClT' \ --header 'Accept-Language: zh-Hant' \ --data-raw '{ "amount": 100, "currency": "USD", "payment_link": true, "connector": [ "novalnet" ], "session_expiry": 1000000, "return_url": "http://127.0.0.1:5500/src/pl_iframe.html", "payment_link_config": { "theme": "#14356f", "logo": "https://logosandtypes.com/wp-content/uploads/2020/08/zurich.svg", "seller_name": "Zurich Inc.", "show_card_form_by_default": false } }'

Response of /payments

{
    "payment_id": "pay_rlQ6zFFw7dlEd87TcGlY",
    "merchant_id": "merchant_1733317126",
    "status": "requires_payment_method",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_rlQ6zFFw7dlEd87TcGlY_secret_l4amc98ygqRSMdN5bmQQ",
    "created": "2024-12-04T13:35:45.977Z",
    "currency": "USD",
    "customer_id": null,
    "customer": null,
    "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": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "http://127.0.0.1:5500/src/pl_iframe.html",
    "authentication_type": null,
    "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": 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_1733317126/pay_rlQ6zFFw7dlEd87TcGlY?locale=zh-Hant",
        "secure_link": "http://localhost:8080/payment_link/s/merchant_1733317126/pay_rlQ6zFFw7dlEd87TcGlY?locale=zh-Hant",
        "payment_link_id": "plink_ALMUnvEV9mgsuHTex9UQ"
    },
    "profile_id": "pro_I5CYJ8tVS6OHA1GMcXaW",
    "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": "2024-12-16T03:22:25.579Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-12-04T13:35:47.150Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
3. Screenshots (Expand to see details) Open the secure payment link (`secure_link` in API response) in an iframe for validating the functionality. For checking payment_link simply click on the payment_link (`payment_link` in API response)

Screenshot for payment link
Screenshot 2024-12-04 at 19 06 44

Screenshot for secured payment link
Screenshot 2024-12-04 at 19 07 32

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

@dgeee13 dgeee13 requested a review from a team as a code owner December 4, 2024 13:42
@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 4, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payment_link/locale.js  6% smaller

@dgeee13 dgeee13 self-assigned this Dec 4, 2024
@dgeee13 dgeee13 linked an issue Dec 4, 2024 that may be closed by this pull request
2 tasks
@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 5, 2024
Merged via the queue into main with commit 5704ca1 Dec 5, 2024
@likhinbopanna likhinbopanna deleted the addTraditionalChineseLocale branch December 5, 2024 13:37
dgeee13 added a commit that referenced this pull request Dec 6, 2024
dgeee13 added a commit that referenced this pull request Dec 6, 2024
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.

[FEATURE] Add support for traditional chinese locale for payment links

5 participants