hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

refactor: Add dynamic secure link

Open mrudulvajpayee4935 opened this issue 11 months ago • 1 comments

Type of Change

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

Description

We need to refactor the flow of generating payments link. Instead of having two separate routes for generating simple payment link and secure payment link we will maintain single route which will generate payment links accordingly with certain checks.

Additional Changes

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

Motivation and Context

How did you test it?

This can be tested by creating payment link using payment create curl. Single link will be provided in payment_link struct which can be used accordingly in secure or open environment.

  • Curl
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_****' \
--data-raw '{
    "amount": 100,
    "currency": "EUR",
    "payment_link": true,
    "connector": [
        "novalnet"
    ],
    "session_expiry": 1000000,
    "return_url": "https://google.com",
    "payment_link_config": {
        "theme": "#14356f",
        "logo": "https://logosandtypes.com/wp-content/uploads/2020/08/zurich.svg",
        "seller_name": "Zurich Inc."
    },
    "customer": {
        "id": "cus_ZUT9N3LGGMVUkcxlC6xG",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "cus_ZUT9N3LGGMVUkcxlC6xG"
}'

1) Open environment Screenshot 2025-01-30 at 9 49 16 PM 2) Secure environment Screenshot 2025-01-30 at 9 49 24 PM

Checklist

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

mrudulvajpayee4935 avatar Jan 28 '25 13:01 mrudulvajpayee4935

This is not required any more

mrudulvajpayee4935 avatar Sep 12 '25 07:09 mrudulvajpayee4935