Skip to content

Crud response enhancement#137

Merged
jagan-jaya merged 3 commits into
mainfrom
crud-response-enhancement
Aug 20, 2025
Merged

Crud response enhancement#137
jagan-jaya merged 3 commits into
mainfrom
crud-response-enhancement

Conversation

@AnkitKmrGupta
Copy link
Copy Markdown
Collaborator

@AnkitKmrGupta AnkitKmrGupta commented Aug 14, 2025

Summary:
This PR improves API response structures and enriches request/response handling across merchant account configuration, rule configuration, and gateway score update endpoints. It also enhances type definitions for routing configurations by adding PartialEq derives for easier testing and comparisons.

Changes:

  1. src/feedback/types.rs

    • Reordered txn_details type imports (minor style change).
    • Added new fields (merchant_id, gateway, payment_id) to UpdateScoreResponse.
  2. src/routes/merchant_account_config.rs

    • Added MerchantAccountCreateResponse struct to provide a structured API response instead of plain strings.
    • Updated create_merchant_config and delete_merchant_config to return structured responses with merchant ID and relevant metadata.
  3. src/routes/rule_configuration.rs

    • Added RuleConfigResponse struct to include merchant ID and config details in responses.
    • Refactored create_rule_config and update_rule_config to return structured responses.
    • Improved serialization by cloning configs before sending in responses.
    • Updated delete operations to include merchant ID in success messages.
  4. src/routes/update_gateway_score.rs

    • Enhanced update_gateway_score to return UpdateScoreResponse with merchant ID, gateway, and payment ID for better traceability.
  5. src/types/routing_configuration.rs

    • Added PartialEq derives to multiple config-related structs/enums (ConfigVariant, SuccessRateData, SRSubLevelInputConfig, GatewayWiseExtraScore, EliminationData, DebitRoutingData, TransactionLatencyThreshold).
    • No changes to schema, only type enhancements for equality checks.

Screenshots:

Screenshot 2025-08-14 at 2 01 18 PM Screenshot 2025-08-14 at 2 01 29 PM Screenshot 2025-08-14 at 2 01 44 PM Screenshot 2025-08-14 at 2 01 56 PM Screenshot 2025-08-14 at 2 02 39 PM

Copilot AI review requested due to automatic review settings August 14, 2025 08:15

This comment was marked as outdated.

@AnkitKmrGupta AnkitKmrGupta force-pushed the crud-response-enhancement branch from 81e5962 to deaac5c Compare August 14, 2025 08:25
@AnkitKmrGupta AnkitKmrGupta changed the title feat : Crud response enhancement feat (routing_config): Crud response enhancement Aug 14, 2025
@AnkitKmrGupta AnkitKmrGupta requested review from Sarthak1799 and jagan-jaya and removed request for Sarthak1799 August 14, 2025 08:34
@AnkitKmrGupta AnkitKmrGupta changed the title feat (routing_config): Crud response enhancement Crud response enhancement Aug 14, 2025
jagan-jaya
jagan-jaya previously approved these changes Aug 14, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances API response structures across multiple endpoints to provide more comprehensive and structured responses. It replaces plain string responses with structured JSON objects containing merchant IDs, configuration data, and descriptive messages, improving API consistency and client integration.

  • Adds structured response types (RuleConfigResponse, MerchantAccountCreateResponse, UpdateScoreResponse) to replace plain string responses
  • Enhances type definitions with PartialEq derives for routing configuration structs to support testing and comparisons
  • Improves response traceability by including merchant IDs, gateway information, and payment IDs in API responses

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/types/routing_configuration.rs Adds PartialEq derives to configuration structs for equality comparisons
src/routes/update_score.rs Minor import reordering and formatting cleanup
src/routes/update_gateway_score.rs Enhances response with merchant ID, gateway, and payment ID for better traceability
src/routes/rule_configuration.rs Adds structured RuleConfigResponse with merchant ID and config data
src/routes/merchant_account_config.rs Adds MerchantAccountCreateResponse with structured merchant account information
src/merchant_config_util.rs Minor import formatting cleanup
src/feedback/types.rs Adds new fields to UpdateScoreResponse and reorders imports
src/feedback/gateway_scoring_service.rs Minor formatting improvement in function call

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/routes/rule_configuration.rs
Comment thread src/routes/rule_configuration.rs Outdated
Comment thread src/routes/rule_configuration.rs Outdated
@juspay juspay deleted a comment from Copilot AI Aug 14, 2025
@juspay juspay deleted a comment from Copilot AI Aug 14, 2025
Comment thread src/routes/merchant_account_config.rs Outdated
@jagan-jaya jagan-jaya merged commit 65a9358 into main Aug 20, 2025
9 of 11 checks passed
@jagan-jaya jagan-jaya deleted the crud-response-enhancement branch August 20, 2025 14:00
@AnkitKmrGupta AnkitKmrGupta removed the request for review from GauravRawat369 August 20, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return resource information in CRUD operations of resource instead of just returning success of error_message

3 participants