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

chore(process_tracker): use const instead of String for business_status #4849

Merged
merged 3 commits into from
Jun 14, 2024

Conversation

pixincreate
Copy link
Member

@pixincreate pixincreate commented Jun 3, 2024

Type of Change

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

Description

When below command is executed in sandbox DB, we get a set of "distinct" business_statuses that is specified for process tracker:

SELECT DISTINCT(business_status) FROM process_tracker;

For debugging and fun, execute to learn more about process tracker and its behavior:

SELECT DISTINCT(name, retry_count, business_status, status), created_at FROM process_tracker order by created_at desc LIMIT 10000;

The main goal for us here is to keep all the business_statuses in a single place, confined for ease of access and increased readability. This also helps us keep track of the statuses we use.

Additional Changes

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

Motivation and Context

We need to keep a track of the statuses that we use in process_tracker

How did you test it?

This should not require any testing as the change done is here just a mere replacement of hardcoded string with consts. If needed, the changes can be verified by following #3712's instructions. Reproduced below:

Perform PSync call from connector like Checkout. Payment Status should go to processing state. Wait for process_tracker to kick in and do a force_sync on its own. Wait for the status to get updated. I had webhooks set up (invalid configuration), even that is verified to be working.

Command used in DB:

SELECT * FROM process_tracker ORDER BY created_at desc LIMIT 2;

image

image

image

image

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

@pixincreate pixincreate added A-process-tracker Area: Process tracker S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor labels Jun 3, 2024
@pixincreate pixincreate added this to the May 2024 Release milestone Jun 3, 2024
@pixincreate pixincreate self-assigned this Jun 3, 2024
@pixincreate pixincreate requested review from a team as code owners June 3, 2024 09:31
@pixincreate pixincreate linked an issue Jun 3, 2024 that may be closed by this pull request
@pixincreate pixincreate changed the base branch from main to process-tracker-db-refactor June 8, 2024 09:38
@pixincreate pixincreate requested review from a team as code owners June 8, 2024 15:11
@pixincreate pixincreate changed the base branch from process-tracker-db-refactor to main June 8, 2024 15:13
@pixincreate pixincreate force-pushed the business_status_pt branch 2 times, most recently from ddde33c to 9bc7628 Compare June 8, 2024 17:11
@pixincreate pixincreate changed the base branch from main to process-tracker-db-refactor June 8, 2024 17:13
@pixincreate pixincreate force-pushed the business_status_pt branch 2 times, most recently from 61431c6 to 9885e0c Compare June 8, 2024 17:39
@pixincreate pixincreate removed request for a team June 8, 2024 17:48
@pixincreate pixincreate force-pushed the process-tracker-db-refactor branch 2 times, most recently from e81be8b to 314b727 Compare June 9, 2024 08:04
@pixincreate pixincreate added S-blocked Status: Blocked on something else or other implementation work and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jun 11, 2024
@pixincreate pixincreate force-pushed the process-tracker-db-refactor branch 2 times, most recently from 102184f to 33c8e22 Compare June 12, 2024 10:05
@pixincreate pixincreate changed the base branch from process-tracker-db-refactor to main June 13, 2024 11:30
@pixincreate pixincreate removed the S-blocked Status: Blocked on something else or other implementation work label Jun 13, 2024
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

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

Other than that, looks good to me!

crates/diesel_models/src/process_tracker.rs Outdated Show resolved Hide resolved
Co-authored-by: SanchithHegde <[email protected]>
@likhinbopanna likhinbopanna added this pull request to the merge queue Jun 14, 2024
Merged via the queue into main with commit 40dfad8 Jun 14, 2024
11 checks passed
@likhinbopanna likhinbopanna deleted the business_status_pt branch June 14, 2024 11:53
pixincreate added a commit that referenced this pull request Jun 20, 2024
…ress-skip

* 'main' of github.com:juspay/hyperswitch: (27 commits)
  feat(cypress): add 2 more payout connectors and bank transfer support for payout (#4993)
  chore(version): 2024.06.20.0
  Refactor(core): reverts the payment method list filtering using constraint graph (#5044)
  feat(router): add payment method type duplication check for `google_pay` (#5023)
  refactor(storage): remove `id` from payment intent, attempt and remove datamodel ext from payment intent (#4923)
  fix(events): Correct parsing of API events with user event_type for Clickhouse (#5022)
  fix(connector):  add local bank redirect type in compatibility layer, default the country to AT for Local Bank Redirect and add creds_identifier in access token  (#5038)
  refactor(connector): add amount conversion framework for noon (#4843)
  fix(logging): fix stack overflow on recording restricted keys (#4423)
  feat(core): Add logger for sessions call failure (#5036)
  chore(version): 2024.06.19.0
  fix(opensearch): handle index not present errors in search api (#4965)
  feat(multitenancy): add tenant_id as a field for data pipeline and support individual database for clickhouse  (#4867)
  refactor: add basic counter metrics for IMC (#5006)
  fix(payment_methods): populate card fields while saving card again during metadata change condition (#5019)
  feat(router): Override the `setup_future_usage` to `on_session` based on the merchant config (#5016)
  chore(docker-compose): pass correct configuration values for running SDK demo app  (#5012)
  refactor: Move trait ConnectorIntegration to crate hyperswitch_interfaces (#4946)
  chore(version): 2024.06.17.0
  chore(process_tracker): use `const` instead of `String` for `business_status` (#4849)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-process-tracker Area: Process tracker C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] use const instead of String for business_status
4 participants