Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): api ,domain and diesel model changes for extended authorization #6607

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

hrithikesh026
Copy link
Contributor

@hrithikesh026 hrithikesh026 commented Nov 19, 2024

Type of Change

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

Description

About Extended Authentication.

Extended authorization allows merchants to extend the hold period on customer funds beyond the standard authorization window, ensuring availability for delayed or longer-term transactions.

Typically, when a payment is authorized (e.g., for a credit or debit card transaction), the issuing bank places a hold on the funds for a limited period—usually 7-10 days for most transactions, whereas extended validity periods can go up to 30 days depending on the card network.

Use- cases:

  • Hotel bookings: Hotels may use extended authorization to secure funds for room bookings, but the actual charge may not be completed until after checkout.
  • Car rentals: Car rental companies may place an extended hold to ensure funds are available for the duration of the rental period and any potential additional charges.
  • E-commerce: Some merchants may offer products that take time to ship or fulfill and therefore need an extended hold on funds until the order is processed and delivered.

Capabilities/Changes required at Hyperswitch:

  • Fields in initial payments requests to specify the extended auth requests - extended validity period
  • Confirm the extended validity of the auth request and store the validity period against the transaction

Changes in this PR

API contract changes:

  1. /payments create request to include request_extended_authorization boolean
  2. /payments response to include
extended_authorization_applied (boolean)
capture_before (date)

DB changes:

  1. a) request_extended_authorization boolean field to be introduced in payment_intent
  2. b) request_extended_authorization and extended_authorization_applied boolean fields to be introduced in payment_attempt
  3. c) capture_before date field to be introduced in payment_attempt
  4. d) always_request_extended_authorization boolean field to be introduced in business_profiles table

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?

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

@hrithikesh026 hrithikesh026 self-assigned this Nov 19, 2024
@hrithikesh026 hrithikesh026 requested review from a team as code owners November 19, 2024 10:34
Copy link

semanticdiff-com bot commented Nov 19, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/diesel_models/src/payment_intent.rs  67% smaller
  crates/api_models/src/admin.rs  37% smaller
  crates/diesel_models/src/payment_attempt.rs  34% smaller
  crates/diesel_models/src/user/sample_data.rs  33% smaller
  crates/api_models/src/payments.rs  15% smaller
  crates/hyperswitch_domain_models/src/payments/payment_attempt.rs  12% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/api_models/src/lib.rs  0% smaller
  crates/api_models/src/payments/trait_impls.rs  0% smaller
  crates/common_enums/Cargo.toml Unsupported file format
  crates/common_utils/src/types.rs  0% smaller
  crates/common_utils/src/types/primitive_wrappers.rs  0% smaller
  crates/diesel_models/Cargo.toml Unsupported file format
  crates/diesel_models/src/business_profile.rs  0% smaller
  crates/diesel_models/src/schema.rs  0% smaller
  crates/diesel_models/src/schema_v2.rs  0% smaller
  crates/hyperswitch_domain_models/src/business_profile.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_intent.rs  0% smaller
  crates/router/src/core/admin.rs  0% smaller
  crates/router/src/core/payments/helpers.rs  0% smaller
  crates/router/src/core/payments/operations/payment_create.rs  0% smaller
  crates/router/src/core/payments/retry.rs  0% smaller
  crates/router/src/core/payments/transformers.rs  0% smaller
  crates/router/src/types/api/admin.rs  0% smaller
  crates/router/src/types/storage/payment_attempt.rs  0% smaller
  crates/router/src/utils/user/sample_data.rs  0% smaller
  crates/router/tests/payments.rs  0% smaller
  crates/router/tests/payments2.rs  0% smaller
  crates/storage_impl/src/mock_db/payment_attempt.rs  0% smaller
  crates/storage_impl/src/payments/payment_attempt.rs  0% smaller
  migrations/2024-11-13-090548_add-extended-authorization-related-fields/down.sql Unsupported file format
  migrations/2024-11-13-090548_add-extended-authorization-related-fields/up.sql Unsupported file format

@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Nov 19, 2024
@hrithikesh026 hrithikesh026 added the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-api-contract-changes Metadata: This PR involves API contract changes M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant