feat(router): add db interface for /relay#6879
Conversation
…ay/db-interface
bbef5a3 to
e7db9e0
Compare
crates/router/src/db/relay.rs
Outdated
| _merchant_key_store: &domain::MerchantKeyStore, | ||
| _new: hyperswitch_domain_models::relay::Relay, | ||
| ) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> { | ||
| Err(errors::StorageError::MockDbError)? |
There was a problem hiding this comment.
Do no throw error here, and call diesel store implementations from here
crates/router/src/core/relay.rs
Outdated
| .await | ||
| .to_refund_failed_response()?; | ||
|
|
||
| let relay_response = match router_data_res.response { |
sai-harsha-vardhan
left a comment
There was a problem hiding this comment.
api-reference/api-reference/relay/relay-retrieve.mdx
Renaming this would require changes in mint.json, Can you please revert this change? @ShankarSinghC
| impl common_utils::events::ApiEventMetric for RelayRequest {} | ||
|
|
||
| impl common_utils::events::ApiEventMetric for RelayResponse {} |
There was a problem hiding this comment.
Why are we not raising any API events here?
| pub profile_id: common_utils::id_type::ProfileId, | ||
| pub merchant_id: common_utils::id_type::MerchantId, | ||
| pub relay_type: storage_enums::RelayType, | ||
| pub request_data: Option<pii::SecretSerdeValue>, |
There was a problem hiding this comment.
Do we have an option to store structured data (serialized as JSON) in the request_data and response_data fields?
| -- Your SQL goes here | ||
| CREATE TYPE "RelayStatus" AS ENUM ('created', 'pending', 'failure', 'success'); | ||
|
|
||
| CREATE TYPE "RelayType" AS ENUM ('refund'); |
There was a problem hiding this comment.
Should we consider using a string instead of enum for the relay_type field? This is considering that adding support for new relay types would involve database migrations to add enum variants each time.
This is open for discussion, we need not take it up now.
ShankarSinghC
left a comment
There was a problem hiding this comment.
@SanchithHegde as this is a priority pr, can I address all of your comments in my next pr ?
…ete-pm * 'main' of github.com:juspay/hyperswitch: chore(version): 2024.12.23.0 feat(connector): [JPMORGAN] add Payment flows for cards (#6668) refactor(grpc): send `x-tenant-id` and `x-request-id` in grpc headers (#6904) feat(payment_methods_v2): Added Ephemeral auth for v2 (#6813) chore(cypress): payout - fix test cases for adyenplatform bank (#6887) refactor(connector): [Airwallex] add device_data in payment request (#6881) feat(router): add db interface for `/relay` (#6879) feat(payments_v2): implement payments capture v2 (#6722) feat(router): add /relay endpoint (#6870)
The above resolved comments are addressed in #6954 |
Type of Change
Description
/relay is a api that will be used to just forward the request sent by merchant without performing any application logic on it. In this pr the changes is particular to support the refunds for the payments that was directly performed with the connector (example stripe) with out hyperswitch involved during the payment flow.
Flow
Additional Changes
Motivation and Context
How did you test it?
-> Create a merchant connector account
-> Make a refund request with invalid
connector_resource_id-> Make a refund request with valid
connector_resource_idChecklist
cargo +nightly fmt --allcargo clippy