Skip to content

Commit a345abd

Browse files
committed
refactor: resolve comments
1 parent 0ad7bba commit a345abd

File tree

5 files changed

+8
-20
lines changed

5 files changed

+8
-20
lines changed

api-reference/v2/openapi_spec_v2.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19224,7 +19224,7 @@
1922419224
},
1922519225
"PaymentsRetrieveRequest": {
1922619226
"type": "object",
19227-
"description": "Request for Payment Status",
19227+
"description": "Request body for Payment Status",
1922819228
"properties": {
1922919229
"force_sync": {
1923019230
"type": "boolean",
@@ -19287,6 +19287,7 @@
1928719287
},
1928819288
"PaymentsStatusRequest": {
1928919289
"type": "object",
19290+
"description": "Request for Payment Status",
1929019291
"properties": {
1929119292
"force_sync": {
1929219293
"type": "boolean",

crates/api_models/src/payments.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ pub struct PaymentsCreateIntentRequest {
271271
pub force_3ds_challenge: Option<bool>,
272272

273273
/// Merchant connector details used to make payments.
274-
#[schema(value_type = Option<MerchantConnectorDetails>)]
275274
pub merchant_connector_details: Option<MerchantConnectorDetails>,
276275
}
277276

@@ -5371,7 +5370,6 @@ pub struct PaymentsConfirmIntentRequest {
53715370
pub payment_token: Option<String>,
53725371

53735372
/// Merchant connector details used to make payments.
5374-
#[schema(value_type = Option<MerchantConnectorDetails>)]
53755373
pub merchant_connector_details: Option<MerchantConnectorDetails>,
53765374
}
53775375

@@ -5547,7 +5545,6 @@ pub struct PaymentsRequest {
55475545
pub is_iframe_redirection_enabled: Option<bool>,
55485546

55495547
/// Merchant connector details used to make payments.
5550-
#[schema(value_type = Option<MerchantConnectorDetails>)]
55515548
pub merchant_connector_details: Option<MerchantConnectorDetails>,
55525549
}
55535550

@@ -5609,9 +5606,9 @@ impl From<&PaymentsRequest> for PaymentsConfirmIntentRequest {
56095606
// Serialize is implemented because, this will be serialized in the api events.
56105607
// Usually request types should not have serialize implemented.
56115608
//
5612-
/// Request for Payment Status
5609+
/// Request body for Payment Status
56135610
#[cfg(feature = "v2")]
5614-
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
5611+
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
56155612
pub struct PaymentsRetrieveRequest {
56165613
/// A boolean used to indicate if the payment status should be fetched from the connector
56175614
/// If this is set to true, the status will be fetched from the connector
@@ -5627,12 +5624,12 @@ pub struct PaymentsRetrieveRequest {
56275624
/// If enabled, provides whole connector response
56285625
pub all_keys_required: Option<bool>,
56295626
/// Merchant connector details used to make payments.
5630-
#[schema(value_type = Option<MerchantConnectorDetails>)]
56315627
pub merchant_connector_details: Option<MerchantConnectorDetails>,
56325628
}
56335629

56345630
#[cfg(feature = "v2")]
56355631
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
5632+
/// Request for Payment Status
56365633
pub struct PaymentsStatusRequest {
56375634
/// A boolean used to indicate if the payment status should be fetched from the connector
56385635
/// If this is set to true, the status will be fetched from the connector

crates/common_utils/src/id_type/merchant.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Ids for merchant account are derived from the merchant name
44
//! If there are any special characters, they are removed
55
6-
use std::{fmt::Display, str::FromStr};
6+
use std::fmt::Display;
77

88
use crate::{
99
date_time,
@@ -38,15 +38,6 @@ impl From<MerchantId> for router_env::opentelemetry::Value {
3838
}
3939
}
4040

41-
impl FromStr for MerchantId {
42-
type Err = error_stack::Report<ValidationError>;
43-
44-
fn from_str(s: &str) -> Result<Self, Self::Err> {
45-
let cow_string = std::borrow::Cow::Owned(s.to_string());
46-
Self::try_from(cow_string)
47-
}
48-
}
49-
5041
impl MerchantId {
5142
/// Create a Merchant id from MerchantName
5243
pub fn from_merchant_name(merchant_name: MerchantName) -> Self {

crates/router/src/core/payments/operations/payment_get.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ use api_models::{enums::FrmSuggestion, payments::PaymentsRetrieveRequest};
22
use async_trait::async_trait;
33
use common_utils::ext_traits::AsyncExt;
44
use error_stack::ResultExt;
5-
#[cfg(feature = "v2")]
6-
use hyperswitch_connectors::connectors::payme;
75
use hyperswitch_domain_models::payments::PaymentStatusData;
86
use router_env::{instrument, tracing};
97

crates/router/src/routes/payments.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2886,7 +2886,7 @@ pub async fn payment_status(
28862886
expand_attempts: payload.expand_attempts,
28872887
param: payload.param.clone(),
28882888
all_keys_required: payload.all_keys_required,
2889-
..Default::default()
2889+
merchant_connector_details: None,
28902890
};
28912891

28922892
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
@@ -2966,6 +2966,7 @@ pub async fn payments_status_with_gateway_creds(
29662966
true => Flow::PaymentsRetrieveForceSync,
29672967
false => Flow::PaymentsRetrieve,
29682968
};
2969+
tracing::Span::current().record("flow", flow.to_string());
29692970

29702971
let global_payment_id = path.into_inner();
29712972
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());

0 commit comments

Comments
 (0)