Skip to content

Conversation

Riddhiagrawal001
Copy link
Contributor

@Riddhiagrawal001 Riddhiagrawal001 commented Sep 10, 2024

Type of Change

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

Description

  • Add support for profile level aggregates in payments.
  • For now it will have list of intent status along with the their count for a given time range.

Additional Changes

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

Motivation and Context

Closes ##5846

How did you test it?

Request :

curl --location 'http://localhost:8080/payments/profile/aggregate?start_time=2022-08-10T18%3A30%3A00Z' \
--header 'Authorization: Bearer JWT token' \
--data ''

Response :

{
    "status_with_count": {
        "failed": 5,
        "cancelled": 0,
        "processing": 0,
        "requires_capture": 0,
        "partially_captured_and_capturable": 0,
        "requires_merchant_action": 0,
        "requires_payment_method": 0,
        "requires_customer_action": 0,
        "requires_confirmation": 0,
        "succeeded": 40,
        "partially_captured": 0
    }
}

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

@Riddhiagrawal001 Riddhiagrawal001 added C-feature Category: Feature request or enhancement A-payments Area: payments labels Sep 10, 2024
@Riddhiagrawal001 Riddhiagrawal001 self-assigned this Sep 10, 2024
@Riddhiagrawal001 Riddhiagrawal001 requested review from a team as code owners September 10, 2024 07:40
Copy link

semanticdiff-com bot commented Sep 10, 2024

Review changes with SemanticDiff.

Analyzed 7 of 7 files.

Overall, the semantic diff is 2% smaller than the GitHub diff.

Filename Status
✔️ crates/storage_impl/src/payments/payment_intent.rs 0.23% smaller
✔️ crates/storage_impl/src/mock_db/payment_intent.rs Analyzed
✔️ crates/router/src/routes/app.rs 16.0% smaller
✔️ crates/router/src/routes/payments.rs 0.04% smaller
✔️ crates/router/src/db/kafka_store.rs 1.0% smaller
✔️ crates/router/src/core/payments.rs 0.97% smaller
✔️ crates/hyperswitch_domain_models/src/payments/payment_intent.rs Analyzed

@Riddhiagrawal001 Riddhiagrawal001 linked an issue Sep 10, 2024 that may be closed by this pull request
apoorvdixit88
apoorvdixit88 previously approved these changes Sep 10, 2024
time_range: api::TimeRange,
) -> RouterResponse<api::PaymentsAggregateResponse> {
let db = state.store.as_ref();
let intent_status_with_count = db
.get_intent_status_with_count(merchant.get_id(), &time_range)
.get_intent_status_with_count(merchant.get_id(), profile_id_list.as_ref(), &time_range)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can pass the owned value here and avoid clone in the end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to owned type

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Sep 11, 2024
Merged via the queue into main with commit b7b0a08 Sep 11, 2024
14 checks passed
@Gnanasundari24 Gnanasundari24 deleted the profile-level-payments-aggregate branch September 11, 2024 11:31
pixincreate added a commit that referenced this pull request Sep 13, 2024
* 'main' of github.com:juspay/hyperswitch: (51 commits)
  feat(connector): [DEUTSCHEBANK] Integrate SEPA Payments (#5826)
  feat(payments_v2): payment intent diesel and domain models changes v2 (#5783)
  feat(connector): [Fiuu] ADD Wasm Configs (#5874)
  chore(version): 2024.09.13.0
  refactor(core): Update shipping_cost and order_tax_amount to net_amount of payment_attempt (#5844)
  refactor: return optional request body from build_request_v2 in ConnectorIntegrationV2 trait (#5865)
  feat(refunds): Refunds aggregate api (#5795)
  refactor: handle redirections for iframed content (#5591)
  refactor(payment_links): Update API contract for dynamic transaction details and upgrade UI (#5849)
  fix(router): add payment_method check in `get_mandate_type` (#5828)
  fix(connector): [ZSL] compare consr_paid_amt with the total amount for identifying partial payments (#5873)
  feat(connector): [Novalnet] add Payment flows for cards (#5726)
  chore(version): 2024.09.12.0
  fix(router): return `collect_billing_details_from_wallet_connector` if `always_collect_billing_details_from_wallet_connector ` is false in merchant payment method list (#5854)
  feat(opensearch): add profile_id and organization_id to /search APIs (#5705)
  build(deps): bump `sqlx` to `0.8.2` (#5859)
  refactor: Remove unwanted commented lines (#5851)
  feat(payments): add support for profile aggregates (#5845)
  Feat(connector): [Fiuu] Add DuitNow/FPX PaymentMethod (#5841)
  chore: remove Connectors enum dependency from ConnectorIntegrationV2 trait (#5840)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-payments Area: payments C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(payments): add support for profile aggregates
6 participants