hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(authentication): Initial commit to modular authentication create

Open sahkal opened this issue 7 months ago • 1 comments

Type of Change

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

Description

Initial commit to modular authentication create

Additional Changes

  • [x] This PR modifies the API contract
  • [x] This PR modifies the database schema

Motivation and Context

Create authentication create api for modular authentication

Request

curl --location 'localhost:8080/authentication/create' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_OUNohkfDdQJBZQ7bWHdrfhezONhOhEjO5ilOc33GocU1AXH1P8TmYX5tViJYoIc5' \
--data '{
    "amount": 10,
    "currency": "USD",
    "acquirer_details": {
        "bin": "13443",
        "merchant_id": null,
        "country_code": null
    }
}'

Response

{
    "authentication_id": "authn_NtY3TDSs37gFli7vYgwD",
    "merchant_id": "sahkal",
    "status": "started",
    "client_secret": "authn_NtY3TDSs37gFli7vYgwD_secret_MUxz520URz0BqowhxY84",
    "amount": 10,
    "currency": "USD",
    "customer": null,
    "force_3ds_challenge": false,
    "authentication_connector": null,
    "return_url": null,
    "created_at": "2025-05-22T10:13:10.312Z",
    "error_code": null,
    "error_message": null,
    "metadata": null,
    "profile_id": "pro_RAtfSMf2Fo8ejkcX5Aoc",
    "browser_info": null,
    "psd2_sca_exemption_type": null,
    "acquirer_details": {
        "bin": "13443",
        "merchant_id": null,
        "country_code": null
    }
}

How did you test it?

Checklist

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

sahkal avatar May 20 '25 11:05 sahkal

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments/operations/payment_status.rs  92% smaller
  crates/router/src/core/payments.rs  88% smaller
  crates/router/src/lib.rs  75% smaller
  crates/router/src/services/kafka/payment_attempt_event.rs  74% smaller
  crates/router/src/core/webhooks/incoming.rs  72% smaller
  crates/router/src/routes.rs  68% smaller
  crates/router/src/core/authentication.rs  62% smaller
  crates/router/src/services/kafka/payment_attempt.rs  60% smaller
  crates/router/src/db/authentication.rs  37% smaller
  crates/router/src/utils.rs  31% smaller
  crates/router/src/core/payments/operations/payment_confirm.rs  29% smaller
  crates/router/src/services/kafka/authentication.rs  22% smaller
  crates/router/src/services/kafka/authentication_event.rs  22% smaller
  crates/diesel_models/src/schema.rs  7% smaller
  crates/diesel_models/src/schema_v2.rs  7% smaller
  crates/router/src/core/unified_authentication_service.rs  5% smaller
  crates/diesel_models/src/authentication.rs  3% smaller
  crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs  1% smaller
  api-reference/v1/openapi_spec_v1.json  0% smaller
  crates/api_models/src/authentication.rs  0% smaller
  crates/api_models/src/lib.rs  0% smaller
  crates/api_models/src/webhooks.rs  0% smaller
  crates/common_utils/src/events.rs  0% smaller
  crates/common_utils/src/id_type.rs  0% smaller
  crates/common_utils/src/id_type/authentication.rs  0% smaller
  crates/diesel_models/src/payment_attempt.rs  0% smaller
  crates/diesel_models/src/query/authentication.rs  0% smaller
  crates/diesel_models/src/user/sample_data.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_attempt.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_data.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs  0% smaller
  crates/openapi/src/openapi.rs  0% smaller
  crates/openapi/src/routes.rs  0% smaller
  crates/openapi/src/routes/authentication.rs  0% smaller
  crates/router/src/core/authentication/utils.rs Unsupported file format
  crates/router/src/core/payments/helpers.rs  0% smaller
  crates/router/src/core/unified_authentication_service/types.rs  0% smaller
  crates/router/src/core/unified_authentication_service/utils.rs Unsupported file format
  crates/router/src/db/kafka_store.rs  0% smaller
  crates/router/src/routes/app.rs  0% smaller
  crates/router/src/routes/authentication.rs  0% smaller
  crates/router/src/routes/lock_utils.rs  0% smaller
  crates/router_env/src/logger/types.rs  0% smaller
  migrations/2025-05-19-130655_authentication_table_refactor/down.sql Unsupported file format
  migrations/2025-05-19-130655_authentication_table_refactor/up.sql Unsupported file format

semanticdiff-com[bot] avatar May 20 '25 11:05 semanticdiff-com[bot]

Need to run migrations for clickhouse to make authentication_connector as Nullable. Need to discuss the approach and determine whether the existing test data needs to be retained or not

tsdk02 avatar Jun 24 '25 09:06 tsdk02

Analytics and Dashboard changes look fine

tsdk02 avatar Jun 24 '25 09:06 tsdk02