Skip to content

feat(router): [dummy_connector] add upi collect #8014

Merged
Gnanasundari24 merged 7 commits intomainfrom
upi_collect
May 15, 2025
Merged

feat(router): [dummy_connector] add upi collect #8014
Gnanasundari24 merged 7 commits intomainfrom
upi_collect

Conversation

@AkshayaFoiger
Copy link
Contributor

@AkshayaFoiger AkshayaFoiger commented May 13, 2025

Type of Change

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

Description

Add UPI Collect support to dummy_connector

  1. To simulate a failure case, use: failure@upi

  2. To test a successful case, use success@upi. You will be redirected to a screen that simulates the waiting screen.

  3. Any other vpa data will result in an invalid VPA data error

Note : The waiting screen does not include a timer.
Note: Unlike the actual UPI Collect flow, this simulation does not involve webhooks

How did you test it?

Success
  1. Create a upi collect payment with stripe_test (dummy connector)
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_U9IBMuzndIcvICSELvrPGsmmi7jTWK1pOXMXKL4KpLbr4Gtg175t3UXukjU0U1w6' \
--data-raw '{
    "amount": 10,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic",
    "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"
        }
    },

    "payment_method": "upi",
    "payment_method_type": "upi_collect",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "success@upi"
            }
        }
    }, 
    "return_url": "https://hyperswitch.io"
}'

Response

{"payment_id":"pay_0HqygbvFE9WNt5oCM1Ra","merchant_id":"postman_merchant_GHAction_fbbf6c87-c0b3-4b76-84b3-b0bb04059ba3","status":"requires_customer_action","amount":10,"net_amount":10,"shipping_cost":null,"amount_capturable":10,"amount_received":null,"connector":"stripe_test","client_secret":"pay_0HqygbvFE9WNt5oCM1Ra_secret_xrD43aZQm90PFglQ2pbm","created":"2025-05-13T11:54:31.629Z","currency":"EUR","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":"automatic","payment_method":"upi","payment_method_data":{"upi":{"upi_collect":{"vpa_id":"su*****@upi"}},"billing":null},"payment_token":null,"shipping":null,"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":null,"name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_0HqygbvFE9WNt5oCM1Ra/postman_merchant_GHAction_fbbf6c87-c0b3-4b76-84b3-b0bb04059ba3/pay_0HqygbvFE9WNt5oCM1Ra_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"upi_collect","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":"pay_DPbMTZqgNL64ZcCzvSKy","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_ZLINwcXdgJlnx7VtnbTb","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_DGAdDTRmgnYhkSx7lYO9","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-05-13T12:09:31.629Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-05-13T11:54:32.743Z","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}
Failure
  1. Create a upi collect payment with stripe_test (dummy connector)
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_U9IBMuzndIcvICSELvrPGsmmi7jTWK1pOXMXKL4KpLbr4Gtg175t3UXukjU0U1w6' \
--data-raw '{
    "amount": 10,
    "currency": "EUR",
    "confirm": true, 
    "capture_method": "automatic",
    "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"
        }
    },

    "payment_method": "upi",
    "payment_method_type": "upi_collect",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "failure@upi"
            }
        }
    },  
    "return_url": "https://hyperswitch.io"
}'

Response

{"payment_id":"pay_agk2kqjZCJ6ji1XLXXsN","merchant_id":"postman_merchant_GHAction_fbbf6c87-c0b3-4b76-84b3-b0bb04059ba3","status":"failed","amount":10,"net_amount":10,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"stripe_test","client_secret":"pay_agk2kqjZCJ6ji1XLXXsN_secret_W4bCEQCHfSPHBx5zr8U4","created":"2025-05-13T10:42:14.250Z","currency":"EUR","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":"automatic","payment_method":"upi","payment_method_data":{"upi":{"upi_collect":{"vpa_id":"fa*****@upi"}},"billing":null},"payment_token":null,"shipping":null,"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":null,"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":"DC_06","error_message":"Payment is not successful","unified_code":"UE_9000","unified_message":"Something went wrong","payment_experience":null,"payment_method_type":"upi_collect","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":true,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_ZLINwcXdgJlnx7VtnbTb","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_DGAdDTRmgnYhkSx7lYO9","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-05-13T10:57:14.250Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-05-13T10:42:15.342Z","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}
Invalid Data
  1. Create a upi collect payment with stripe_test (dummy connector)
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_U9IBMuzndIcvICSELvrPGsmmi7jTWK1pOXMXKL4KpLbr4Gtg175t3UXukjU0U1w6' \
--data-raw '{
    "amount": 10,
    "currency": "EUR",
    "confirm": true,
   "capture_method": "automatic",
    "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"
        }
    }, 
    "payment_method": "upi",
    "payment_method_type": "upi_collect",
    "payment_method_data": {
        "upi": {
            "upi_collect": {
                "vpa_id": "failureupi"
            }
        }
    }, 
    "return_url": "https://hyperswitch.io"
}'

Response

{"payment_id":"pay_TA9zg7M8Uvdr2Hd72ZrE","merchant_id":"postman_merchant_GHAction_fbbf6c87-c0b3-4b76-84b3-b0bb04059ba3","status":"failed","amount":10,"net_amount":10,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"stripe_test","client_secret":"pay_TA9zg7M8Uvdr2Hd72ZrE_secret_nrYJW0BNRtZbPZiZwrCx","created":"2025-05-13T10:43:19.791Z","currency":"EUR","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":"automatic","payment_method":"upi","payment_method_data":{"upi":{"upi_collect":{"vpa_id":"********pi"}},"billing":null},"payment_token":null,"shipping":null,"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":null,"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":"DC_08","error_message":"Payment declined: Invalid Upi id","unified_code":"UE_9000","unified_message":"Something went wrong","payment_experience":null,"payment_method_type":"upi_collect","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":true,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_ZLINwcXdgJlnx7VtnbTb","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_DGAdDTRmgnYhkSx7lYO9","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-05-13T10:58:19.791Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-05-13T10:43:20.767Z","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}

Sanity

Card test
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_U9IBMuzndIcvICSELvrPGsmmi7jTWK1pOXMXKL4KpLbr4Gtg175t3UXukjU0U1w6' \
--data-raw '{
    "amount": 10,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic", 
    "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"
        }
    },
 
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242", 
            "card_exp_month": "12",
            "card_exp_year": "49",
            "card_holder_name": "Joseph",
            "card_cvc": "123"
        }
    }
     ,"return_url": "https://hyperswitch.io"
}'

Response

{"payment_id":"pay_OaUBGJbTMxaNfxrysssW","merchant_id":"postman_merchant_GHAction_fbbf6c87-c0b3-4b76-84b3-b0bb04059ba3","status":"succeeded","amount":10,"net_amount":10,"shipping_cost":null,"amount_capturable":0,"amount_received":10,"connector":"stripe_test","client_secret":"pay_OaUBGJbTMxaNfxrysssW_secret_Oa7Ay6atjfCldbuCejzO","created":"2025-05-13T10:45:25.009Z","currency":"EUR","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":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"4242","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"424242","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":null,"shipping":null,"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":null,"name":null,"phone":null,"return_url":"https://hyperswitch.io/","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":"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":false,"connector_transaction_id":"pay_qwFoLJPAFDlMtcVsqjEM","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_ZLINwcXdgJlnx7VtnbTb","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_DGAdDTRmgnYhkSx7lYO9","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-05-13T11:00:25.009Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-05-13T10:45:26.127Z","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","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null}

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 review from a team as code owners May 13, 2025 10:46
@semanticdiff-com
Copy link

semanticdiff-com bot commented May 13, 2025

@AkshayaFoiger AkshayaFoiger self-assigned this May 13, 2025
@AkshayaFoiger AkshayaFoiger added A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration labels May 13, 2025
@AkshayaFoiger AkshayaFoiger changed the title add upi collect to dummy_connector feat(router): [dummy_connector] add upi collect May 13, 2025
awasthi21
awasthi21 previously approved these changes May 13, 2025
Copy link
Contributor

@ThisIsMani ThisIsMani left a comment

Choose a reason for hiding this comment

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

Other than that looks good to me. I don't remember much of this stuff. So, I'd suggest you to get a proper review from the connector team.

@AkshayaFoiger AkshayaFoiger dismissed stale reviews from deepanshu-iiitu and awasthi21 via b0b901a May 14, 2025 07:53
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 15, 2025
Merged via the queue into main with commit 32df401 May 15, 2025
14 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the upi_collect branch May 15, 2025 11:52
iemyashasvi pushed a commit that referenced this pull request May 22, 2025
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants