Skip to content

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Apr 2, 2025

Type of Change

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

Description

Currently, if the forex_enabled feature flag is not present as an ENV, it is leading to deserialization errors.
Modified it in such a way to assume the default value (false) if the ENV is not present.

Additional Changes

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

Motivation and Context

Fix deserialization errors for analytics

How did you test it?

Removed the forex_enabled feature flag from local envs, and replicated the error
Screenshot 2025-04-02 at 2 34 43 PM

Need to remove the env forex_enabled during deployment, and then test out the analytics section..
Tested on local, by removing the forex_enabled env and checking the analytics API calls, worked as expected
image

Curl:

curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiM2RlMDFhYWYtOWVkMi00YTY5LTg3YWItNWU1YmI2ZWFiNGQ5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQyMjEyMzQxIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0Mjk4MDgyOCwib3JnX2lkIjoib3JnX3pMQmRNTnpLaDZrNmhiT2tockdJIiwicHJvZmlsZV9pZCI6InByb19LWnhHZ21rUHFkMldQdXBFa2psWCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.aD185AZEOcIjHnLnZZ9GJ2ujSHIdRPbPtrYhzNo0V4M' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
    {
        "timeRange": {
            "startTime": "2025-03-01T18:30:00Z",
            "endTime": "2025-03-31T09:22:00Z"
        },
        "source": "BATCH",
        "metrics": [
            "payment_processed_amount"   
        ],
        "timeSeries": {
            "granularity": "G_ONEDAY"
        },
        "delta": true
    }
]'

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

@tsdk02 tsdk02 added C-bug Category: Bug A-Analytics labels Apr 2, 2025
@tsdk02 tsdk02 self-assigned this Apr 2, 2025
@tsdk02 tsdk02 requested a review from a team as a code owner April 2, 2025 09:12
Copy link

semanticdiff-com bot commented Apr 2, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/analytics/src/lib.rs  25% smaller

@tsdk02 tsdk02 linked an issue Apr 2, 2025 that may be closed by this pull request
Copy link
Contributor

@su-shivanshmathur su-shivanshmathur left a comment

Choose a reason for hiding this comment

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

lgtm

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Apr 3, 2025
Merged via the queue into main with commit 11f7804 Apr 3, 2025
24 of 28 checks passed
@Gnanasundari24 Gnanasundari24 deleted the forex-enabled-default branch April 3, 2025 10:44
pixincreate added a commit that referenced this pull request Apr 4, 2025
…acilitapay-pix-pmt

* 'main' of github.com:juspay/hyperswitch: (33 commits)
  fix(connector): [Nexixpay] handle error code and message in failure response (#7713)
  fix(connector): [Coingate] Fix Wasm Changes  (#7716)
  fix(config): add billing payment sync configs in different environments (#7708)
  chore(dashboard): update dashboard toml (#7703)
  chore(postman): update auth for payment connectors in postman collection (#7702)
  feat(connector): [BANKOFAMERICA] Enable SamsungPay In Dashboard (#7677)
  feat(session): Added dpa_client_id, provider to click to pay session response (#7683)
  feat(core): add network error related columns in payment attempt [v2] (#7706)
  chore(version): 2025.04.04.0
  refactor(accounts): move accounts related tables to accounts schema (#7626)
  revert: implement `NameType` for name validation (#6734) (#7717)
  fix(errors): Entry not found error as 4xx instead of 5xx (#7712)
  refactor(analytics): default config for forex_enabled (#7695)
  refactor(core): made provider field in ctp_service_details backward compatible (#7705)
  refactor(openapi): modify profile-delete auth to AdminAPIKey in API doc (#7697)
  fix: web-docker pull from docker hub (#7700)
  ci(cypress): fix iatapay upi payments (#7698)
  docs: Updated next steps after deployment setup on Readme (#7686)
  chore(version): 2025.04.03.0
  fix(connector): [JPMORGAN, PAYU, DIGITALVIRGO, BITPAY, HELCIM, PAYBOX] Replaced lazystatic macros with LazyLock (#7524)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default value for forex_enabled if config is not set
4 participants