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(router): add support for multiple partial capture #1721

Merged
merged 42 commits into from
Aug 8, 2023

Conversation

hrithikesh026
Copy link
Contributor

@hrithikesh026 hrithikesh026 commented Jul 16, 2023

Type of Change

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

Description

Add feature to support multiple partial capture.
Any payment created with capture_method as manual_multiple will be considered as authorization made for multiple capture.

For each partial manual capture request, we will create an entry in captures table. This can be used to sync captures with the connector.

automatic capture and single manual capture will work like before.

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?

Manual
This change does not interfere with existing manual capture flow.

Create a payment with capture_method: manual
Screenshot 2023-08-07 at 12 11 31 PM

Capture the payment.
Status should change to succeeded. As expected.
Screenshot 2023-08-07 at 12 11 51 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@hrithikesh026 hrithikesh026 added A-core Area: Core flows C-feature Category: Feature request or enhancement M-database-changes Metadata: This PR involves database schema changes R-waiting-on-L1 Review: Waiting on L1 reviewer labels Jul 16, 2023
@hrithikesh026 hrithikesh026 added this to the July 2023 Release milestone Jul 16, 2023
@hrithikesh026 hrithikesh026 self-assigned this Jul 16, 2023
@hrithikesh026 hrithikesh026 requested review from a team as code owners July 16, 2023 14:44
@hrithikesh026 hrithikesh026 requested review from a team and ashokkjag as code owners July 16, 2023 15:29
return storage_enums::AttemptStatus::Charged;
}
let status_count_map = self.get_status_count();
if status_count_map.get(&storage_enums::CaptureStatus::Charged) > Some(&0) {
Copy link
Member

Choose a reason for hiding this comment

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

I see that this hashmap is used only to get the number of charged captures. Is there any reason that we are creating this hashmap, rather than just counting the status of charged captures?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just in case, in future, we might need count of other status also.

jarnura
jarnura previously approved these changes Aug 7, 2023
Narayanbhat166
Narayanbhat166 previously approved these changes Aug 7, 2023
@jarnura jarnura enabled auto-merge August 8, 2023 09:32
@jarnura jarnura added S-ready-for-merge and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Aug 8, 2023
crates/router/src/core/payments.rs Show resolved Hide resolved
@jarnura jarnura added this pull request to the merge queue Aug 8, 2023
Merged via the queue into main with commit c333fb7 Aug 8, 2023
11 of 12 checks passed
@jarnura jarnura deleted the add-validation-for-multiple-capture branch August 8, 2023 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows C-feature Category: Feature request or enhancement M-database-changes Metadata: This PR involves database schema changes
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

8 participants