Skip to content

Commit

Permalink
refactor(router): addressed pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sahkal committed Nov 22, 2023
1 parent bccedec commit e49cb6b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use utoipa::ToSchema;

use crate::{
admin, disputes,
enums::{self as api_enums, enums as common_enums},
enums::{self as api_enums},
ephemeral_key::EphemeralKeyCreateResponse,
payment_methods::{Surcharge, SurchargeDetailsResponse},
refunds,
Expand Down Expand Up @@ -3204,7 +3204,7 @@ pub struct RetrievePaymentLinkResponse {
pub description: Option<String>,
pub status: String,
#[schema(value_type = Option<Currency>)]
pub currency: Option<common_enums::Currency>,
pub currency: Option<api_enums::Currency>,
}

#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/core/payment_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ pub async fn list_payment_link(
) -> RouterResponse<Vec<api_models::payments::RetrievePaymentLinkResponse>> {
let db = state.store.as_ref();
let payment_link = db
.find_list_payment_link_by_merchant_id(&merchant.merchant_id, constraints)
.list_payment_link_by_merchant_id(&merchant.merchant_id, constraints)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to retrieve payment link")?;
Expand Down
6 changes: 3 additions & 3 deletions crates/router/src/db/payment_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub trait PaymentLinkInterface {
_payment_link: storage::PaymentLinkNew,
) -> CustomResult<storage::PaymentLink, errors::StorageError>;

async fn find_list_payment_link_by_merchant_id(
async fn list_payment_link_by_merchant_id(
&self,
merchant_id: &str,
payment_link_constraints: api_models::payments::PaymentLinkListConstraints,
Expand Down Expand Up @@ -52,7 +52,7 @@ impl PaymentLinkInterface for Store {
.into_report()
}

async fn find_list_payment_link_by_merchant_id(
async fn list_payment_link_by_merchant_id(
&self,
merchant_id: &str,
payment_link_constraints: api_models::payments::PaymentLinkListConstraints,
Expand Down Expand Up @@ -83,7 +83,7 @@ impl PaymentLinkInterface for MockDb {
Err(errors::StorageError::MockDbError)?
}

async fn find_list_payment_link_by_merchant_id(
async fn list_payment_link_by_merchant_id(
&self,
_merchant_id: &str,
_payment_link_constraints: api_models::payments::PaymentLinkListConstraints,
Expand Down
9 changes: 3 additions & 6 deletions crates/router/src/routes/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,9 @@ pub struct PaymentLink;
#[cfg(feature = "olap")]
impl PaymentLink {
pub fn server(state: AppState) -> Scope {
let mut route = web::scope("/payment_link").app_data(web::Data::new(state));
#[cfg(feature = "olap")]
{
route = route.service(web::resource("/list").route(web::post().to(payments_link_list)));
}
route
web::scope("/payment_link")
.app_data(web::Data::new(state))
.service(web::resource("/list").route(web::post().to(payments_link_list)))
.service(
web::resource("/{payment_link_id}").route(web::get().to(payment_link_retrieve)),
)
Expand Down

0 comments on commit e49cb6b

Please sign in to comment.