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 46 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.

image

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. / business profile request and response to include always_request_extended_authorization boolean
  3. /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

Other Changes:

  • Enabled 128-column-tables feature for diesel import in diesel_models and common_enums. As a result, compile time increased by an average of 40%.

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?

This cannot be tested since the feature is incomplete.

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  60% smaller
  crates/api_models/src/admin.rs  37% smaller
  crates/diesel_models/src/user/sample_data.rs  33% smaller
  crates/hyperswitch_domain_models/src/payments/payment_attempt.rs  30% smaller
  crates/diesel_models/src/payment_attempt.rs  23% smaller
  crates/api_models/src/payments.rs  15% 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_utils/src/types.rs  0% smaller
  crates/common_utils/src/types/primitive_wrappers.rs  0% smaller
  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
@hrithikesh026 hrithikesh026 requested a review from jarnura December 4, 2024 10:47
@hrithikesh026 hrithikesh026 added the increases-compile-time This change increases compilation time label Dec 5, 2024
@hrithikesh026 hrithikesh026 added this to the December 2024 Release milestone Dec 5, 2024
@hrithikesh026 hrithikesh026 added the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Dec 6, 2024
@SanchithHegde SanchithHegde added this to the February 2025 Release milestone Feb 3, 2025
@hrithikesh026 hrithikesh026 dismissed stale reviews from jarnura and ThisIsMani via 08f1318 February 6, 2025 09:08
jarnura
jarnura previously approved these changes Feb 14, 2025
ThisIsMani
ThisIsMani previously approved these changes Feb 14, 2025
@hrithikesh026 hrithikesh026 dismissed stale reviews from ThisIsMani and jarnura via 96dca90 February 14, 2025 17:59
@hrithikesh026 hrithikesh026 force-pushed the add-fields-for-extended-authorization branch from f8c8815 to eeb744a Compare February 16, 2025 04:32
@hrithikesh026 hrithikesh026 requested a review from a team as a code owner February 16, 2025 04:32
@hrithikesh026 hrithikesh026 force-pushed the add-fields-for-extended-authorization branch from eeb744a to 79ebec2 Compare February 16, 2025 04:34
This reverts commit 79ebec2.
@hrithikesh026 hrithikesh026 removed the request for review from a team February 17, 2025 05:32
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Feb 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
increases-compile-time This change increases compilation time M-api-contract-changes Metadata: This PR involves API contract changes M-database-changes Metadata: This PR involves database schema changes S-waiting-on-review Status: This PR has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants