Skip to content

feat(core): added customer phone_number and email to session token response for click to pay#6863

Merged
Gnanasundari24 merged 18 commits intomainfrom
7863-add-email-and-phone-number-to-session-token-response
Dec 19, 2024
Merged

feat(core): added customer phone_number and email to session token response for click to pay#6863
Gnanasundari24 merged 18 commits intomainfrom
7863-add-email-and-phone-number-to-session-token-response

Conversation

@sahkal
Copy link
Contributor

@sahkal sahkal commented Dec 17, 2024

Type of Change

  • Enhancement

Description

Add customer phone_number and email to session token response for click to pay

How did you test it?

Add Ctp_mastercard as a connector and send relevant details to ctp in connector metadata

curl --location 'http://localhost:8080/account/dqwdwljildqwjd/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '

{
    "connector_type": "authentication_processor",
    "connector_name": "ctp_mastercard",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "API-KEY"
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "business_country": "US",
    "business_label": "default",
     "metadata": {
    "dpa_id": "b6e06cc6-3018-4c4c-bbf5-9fb232615090",
    "dpa_name": "TestMerchant",
    "locale": "en_AU",
    "card_brands": ["mastercard", "visa"],
    "acquirer_bin": "545301",
    "acquirer_merchant_id": "SRC3DS",
    "merchant_category_code": "0001",
    "merchant_country_code": "US"
  }
}
'

update business profile with

"is_click_to_pay_enabled": true,
"authentication_product_ids": {"click_to_pay": "mca_id"}

Do payments create with customer details

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_myZVgK2frn2tWuTghpqBw4YmFcVOKoQ0etjGKyZCdegwHvKiGQgZOvhGsu7ShkaU' \
--data-raw '{
    "amount": 1130,
    "currency": "USD",
    "confirm": false,
    "return_url": "https://hyperswitch.io",
    "customer": {
        "email": "john@example.com",
        "id": "cus_abcdccqjciefgh",
        "name": "John Dough",
        "phone": "9123456789"
  } 
}'

Look for customer details in click to pay session response

curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'x-feature: integ-custom' \
--header 'api-key: pk_dev_a82510aa11054218bfbae152586fb16d' \
--data '{
    "payment_id": "pay_gEidbQrgy29Hu2JfUWto",
    "client_secret": "pay_gEidbQrgy29Hu2JfUWto_secret_PfoMiqnCRZL3uCKrNDmv",
    "wallets": []
}
'

Response

{
    "payment_id": "pay_gEidbQrgy29Hu2JfUWto",
    "client_secret": "pay_gEidbQrgy29Hu2JfUWto_secret_PfoMiqnCRZL3uCKrNDmv",
    "session_token": [
        {
            "wallet_name": "click_to_pay",
            "dpa_id": "b6e06cc6-3018-4c4c-bbf5-9fb232615090",
            "dpa_name": "TestMerchant",
            "locale": "en_AU",
            "card_brands": [
                "mastercard",
                "visa"
            ],
            "acquirer_bin": "545301",
            "acquirer_merchant_id": "SRC3DS",
            "merchant_category_code": "0001",
            "merchant_country_code": "US",
            "transaction_amount": "11.30",
            "transaction_currency_code": "USD",
            "phone_number": "9123456789",
            "email": "john@example.com"
        }
    ]
}

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

@sahkal sahkal added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Dec 17, 2024
@sahkal sahkal added this to the December 2024 Release milestone Dec 17, 2024
@sahkal sahkal self-assigned this Dec 17, 2024
@sahkal sahkal requested review from a team as code owners December 17, 2024 12:10
@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 17, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments.rs  2% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/api_models/src/payments.rs  0% smaller

@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Dec 18, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Dec 19, 2024
Merged via the queue into main with commit 092c79e Dec 19, 2024
@Gnanasundari24 Gnanasundari24 deleted the 7863-add-email-and-phone-number-to-session-token-response branch December 19, 2024 12:03
pixincreate added a commit that referenced this pull request Dec 20, 2024
…ete-pm

* 'main' of github.com:juspay/hyperswitch:
  refactor(dynamic_routing): add col payment_method_type in dynamic_routing_stats (#6853)
  refactor(customers_v2): include minor fixes for customer v2 flows (#6876)
  fix: cypress reports generation (#6894)
  fix(connector): Paypal BankRedirects (Ideal/EPS)  (#6864)
  chore(version): 2024.12.19.1
  fix(connector): [UNIFIED_AUTHENTICATION_SERVICE] change url path to `pre_authentication_processing` in pre-auth flow (#6885)
  refactor(users): move roles schema to global interface (#6862)
  feat(payment_methods): add support to pass apple pay recurring details to obtain apple pay merchant token (#6770)
  feat(payments): [Payment links] Add config for changing button text for payment links (#6860)
  feat(core): added customer phone_number and email to session token response for click to pay (#6863)
  FEAT(klarna): Klarna Kustom Checkout Integration (#6839)
  feat(users): handle email url for users in different tenancies (#6809)
  chore(version): 2024.12.19.0
  refactor(dynamic_routing): update the authentication for update config to include JWT type (#6785)
  chore(env): remove unified_authentication_service base_url from integ, sandbox and production toml (#6865)
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-core Area: Core flows M-api-contract-changes Metadata: This PR involves API contract changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants