Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(router): add list payment link support (#2805)
Sahkal Poddarb441a1f2f9d9
diff --git a/README.md b/README.mdindex bc528da9bb..edc8cae5cf 100644--- a/README.md+++ b/README.md@@ -66,7 +66,6 @@ The fastest and easiest way to try hyperswitch is via our CDK scripts   <a href="https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=HyperswitchBootstarp&templateURL=https://hyperswitch-synth.s3.eu-central-1.amazonaws.com/hs-starter-config.yaml"><img src="./docs/imgs/aws_button.png" height="35"></a>-2. Sign-in to your AWS console.3. Follow the instructions provided on the console to successfully deploy Hyperswitchdiff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rsindex 0ce7638b5e..782c02be7a 100644--- a/crates/api_models/src/events.rs+++ b/crates/api_models/src/events.rs@@ -36,6 +36,7 @@ impl_misc_api_event_type!(MandateResponse,MandateRevokedResponse,RetrievePaymentLinkRequest,+ PaymentLinkListConstraints,MandateId,DisputeListConstraints,RetrieveApiKeyResponse,diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex c427088d68..508eeb8d73 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -3194,18 +3194,17 @@ pub struct PaymentLinkResponse {#[derive(Clone, Debug, serde::Serialize, ToSchema)]pub struct RetrievePaymentLinkResponse {pub payment_link_id: String,- pub payment_id: String,pub merchant_id: String,pub link_to_pay: String,pub amount: i64,- #[schema(value_type = Option<Currency>, example = "USD")]- pub currency: Option<api_enums::Currency>,#[serde(with = "common_utils::custom_serde::iso8601")]pub created_at: PrimitiveDateTime,- #[serde(with = "common_utils::custom_serde::iso8601")]- pub last_modified_at: PrimitiveDateTime,#[serde(default, with = "common_utils::custom_serde::iso8601::option")]pub link_expiry: Option<PrimitiveDateTime>,+ pub description: Option<String>,+ pub status: String,+ #[schema(value_type = Option<Currency>)]+ pub currency: Option<api_enums::Currency>,}#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]@@ -3230,3 +3229,57 @@ pub struct PaymentLinkDetails {pub max_items_visible_after_collapse: i8,pub sdk_theme: Option<String>,}++#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]+#[serde(deny_unknown_fields)]++pub struct PaymentLinkListConstraints {+ /// limit on the number of objects to return+ pub limit: Option<i64>,++ /// The time at which payment link is created+ #[schema(example = "2022-09-10T10:11:12Z")]+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]+ pub created: Option<PrimitiveDateTime>,++ /// Time less than the payment link created time+ #[schema(example = "2022-09-10T10:11:12Z")]+ #[serde(+ default,+ with = "common_utils::custom_serde::iso8601::option",+ rename = "created.lt"+ )]+ pub created_lt: Option<PrimitiveDateTime>,++ /// Time greater than the payment link created time+ #[schema(example = "2022-09-10T10:11:12Z")]+ #[serde(+ default,+ with = "common_utils::custom_serde::iso8601::option",+ rename = "created.gt"+ )]+ pub created_gt: Option<PrimitiveDateTime>,++ /// Time less than or equals to the payment link created time+ #[schema(example = "2022-09-10T10:11:12Z")]+ #[serde(+ default,+ with = "common_utils::custom_serde::iso8601::option",+ rename = "created.lte"+ )]+ pub created_lte: Option<PrimitiveDateTime>,++ /// Time greater than or equals to the payment link created time+ #[schema(example = "2022-09-10T10:11:12Z")]+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]+ #[serde(rename = "created.gte")]+ pub created_gte: Option<PrimitiveDateTime>,+}++#[derive(Clone, Debug, serde::Serialize, ToSchema)]+pub struct PaymentLinkListResponse {+ /// The number of payment links included in the list+ pub size: usize,+ // The list of payment link response objects+ pub data: Vec<PaymentLinkResponse>,+}diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rsindex 60756192d6..7f9533d7ea 100644--- a/crates/common_utils/src/consts.rs+++ b/crates/common_utils/src/consts.rs@@ -24,6 +24,9 @@ pub const PAYMENTS_LIST_MAX_LIMIT_V1: u32 = 100;/// Maximum limit for payments list post api with filterspub const PAYMENTS_LIST_MAX_LIMIT_V2: u32 = 20;+/// Maximum limit for payment link list get api+pub const PAYMENTS_LINK_LIST_LIMIT: u32 = 100;+/// surcharge percentage maximum precision lengthpub const SURCHARGE_PERCENTAGE_PRECISION_LENGTH: u8 = 2;diff --git a/crates/diesel_models/src/payment_link.rs b/crates/diesel_models/src/payment_link.rsindex 264cc915b3..999a6767d8 100644--- a/crates/diesel_models/src/payment_link.rs+++ b/crates/diesel_models/src/payment_link.rs@@ -22,6 +22,7 @@ pub struct PaymentLink {pub fulfilment_time: Option<PrimitiveDateTime>,pub custom_merchant_name: Option<String>,pub payment_link_config: Option<serde_json::Value>,+ pub description: Option<String>,}#[derive(@@ -51,4 +52,5 @@ pub struct PaymentLinkNew {pub fulfilment_time: Option<PrimitiveDateTime>,pub custom_merchant_name: Option<String>,pub payment_link_config: Option<serde_json::Value>,+ pub description: Option<String>,}diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 2ce4f2b6d9..33400635f0 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -678,6 +678,8 @@ diesel::table! {#[max_length = 64]custom_merchant_name -> Nullable<Varchar>,payment_link_config -> Nullable<Jsonb>,+ #[max_length = 255]+ description -> Nullable<Varchar>,}}diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rsindex 89d345b286..07fdf4ae40 100644--- a/crates/router/src/core/payment_link.rs+++ b/crates/router/src/core/payment_link.rs@@ -6,7 +6,9 @@ use common_utils::{ext_traits::{OptionExt, ValueExt},};use error_stack::{IntoReport, ResultExt};+use futures::future;use masking::{PeekInterface, Secret};+use time::PrimitiveDateTime;use super::errors::{self, RouterResult, StorageErrorExt};use crate::{@@ -14,7 +16,10 @@ use crate::{errors::RouterResponse,routes::AppState,services,- types::{domain, storage::enums as storage_enums, transformers::ForeignFrom},+ types::{+ api::payment_link::PaymentLinkResponseExt, domain, storage::enums as storage_enums,+ transformers::ForeignFrom,+ },};pub async fn retrieve_payment_link(@@ -27,8 +32,12 @@ pub async fn retrieve_payment_link(.await.to_not_found_response(errors::ApiErrorResponse::PaymentLinkNotFound)?;- let response =- api_models::payments::RetrievePaymentLinkResponse::foreign_from(payment_link_object);+ let status = check_payment_link_status(payment_link_object.fulfilment_time);++ let response = api_models::payments::RetrievePaymentLinkResponse::foreign_from((+ payment_link_object,+ status,+ ));Ok(services::ApplicationResponse::Json(response))}@@ -62,7 +71,7 @@ pub async fn intiate_payment_link_flow(storage_enums::IntentStatus::RequiresCapture,storage_enums::IntentStatus::RequiresMerchantAction,],- "create payment link",+ "use payment link for",)?;let payment_link = db@@ -197,6 +206,34 @@ fn validate_sdk_requirements(Ok((pub_key, currency, client_secret))}+pub async fn list_payment_link(+ state: AppState,+ merchant: domain::MerchantAccount,+ constraints: api_models::payments::PaymentLinkListConstraints,+) -> RouterResponse<Vec<api_models::payments::RetrievePaymentLinkResponse>> {+ let db = state.store.as_ref();+ let payment_link = db+ .list_payment_link_by_merchant_id(&merchant.merchant_id, constraints)+ .await+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("Unable to retrieve payment link")?;+ let payment_link_list = future::try_join_all(payment_link.into_iter().map(|payment_link| {+ api_models::payments::RetrievePaymentLinkResponse::from_db_payment_link(payment_link)+ }))+ .await?;+ Ok(services::ApplicationResponse::Json(payment_link_list))+}++pub fn check_payment_link_status(fulfillment_time: Option<PrimitiveDateTime>) -> String {+ let curr_time = Some(common_utils::date_time::now());++ if curr_time > fulfillment_time {+ "expired".to_string()+ } else {+ "active".to_string()+ }+}+fn validate_order_details(order_details: Option<Vec<Secret<serde_json::Value>>>,) -> Result<diff --git a/crates/router/src/core/payment_link/payment_link.html b/crates/router/src/core/payment_link/payment_link.htmlindex abacf0998f..0ca4abd340 100644--- a/crates/router/src/core/payment_link/payment_link.html+++ b/crates/router/src/core/payment_link/payment_link.html@@ -46,6 +46,7 @@width: 100%;height: 100%;max-width: 1900px;+ overflow: scroll;}#hyper-footer {@@ -418,6 +419,7 @@margin-top: 20px;border-radius: 3px;border: 1px solid #e6e6e6;+ width: 90vw;}.hyper-checkout-status-item {@@ -432,12 +434,15 @@}.hyper-checkout-item-header {- width: 15ch;+ min-width: 13ch;font-size: 12px;}.hyper-checkout-item-value {font-size: 12px;+ overflow-x: hidden;+ overflow-y: auto;+ word-wrap: break-word;}@keyframes loading {diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex 845915cc33..eee937071d 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -75,6 +75,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>db,state,amount,+ request.description.clone(),).await?} else {@@ -779,6 +780,7 @@ pub fn payments_create_request_validation(Ok((amount, currency))}+#[allow(clippy::too_many_arguments)]async fn create_payment_link(request: &api::PaymentsRequest,payment_link_object: api_models::payments::PaymentLinkObject,@@ -787,6 +789,7 @@ async fn create_payment_link(db: &dyn StorageInterface,state: &AppState,amount: api::Amount,+ description: Option<String>,) -> RouterResult<Option<api_models::payments::PaymentLinkResponse>> {let created_at @ last_modified_at = Some(common_utils::date_time::now());let domain = if let Some(domain_name) = payment_link_object.merchant_custom_domain_name {@@ -817,6 +820,7 @@ async fn create_payment_link(created_at,last_modified_at,fulfilment_time: payment_link_object.link_expiry,+ description,payment_link_config,custom_merchant_name: payment_link_object.custom_merchant_name,};diff --git a/crates/router/src/db/payment_link.rs b/crates/router/src/db/payment_link.rsindex 38b59b1d60..5dc9871e70 100644--- a/crates/router/src/db/payment_link.rs+++ b/crates/router/src/db/payment_link.rs@@ -1,10 +1,11 @@use error_stack::IntoReport;-use super::{MockDb, Store};use crate::{connection,core::errors::{self, CustomResult},- types::storage,+ db::MockDb,+ services::Store,+ types::storage::{self, PaymentLinkDbExt},};#[async_trait::async_trait]@@ -18,6 +19,12 @@ pub trait PaymentLinkInterface {&self,_payment_link: storage::PaymentLinkNew,) -> CustomResult<storage::PaymentLink, errors::StorageError>;++ async fn list_payment_link_by_merchant_id(+ &self,+ merchant_id: &str,+ payment_link_constraints: api_models::payments::PaymentLinkListConstraints,+ ) -> CustomResult<Vec<storage::PaymentLink>, errors::StorageError>;}#[async_trait::async_trait]@@ -44,6 +51,18 @@ impl PaymentLinkInterface for Store {.map_err(Into::into).into_report()}++ async fn list_payment_link_by_merchant_id(+ &self,+ merchant_id: &str,+ payment_link_constraints: api_models::payments::PaymentLinkListConstraints,+ ) -> CustomResult<Vec<storage::PaymentLink>, errors::StorageError> {+ let conn = connection::pg_connection_read(self).await?;+ storage::PaymentLink::filter_by_constraints(&conn, merchant_id, payment_link_constraints)+ .await+ .map_err(Into::into)+ .into_report()+ }}#[async_trait::async_trait]@@ -63,4 +82,13 @@ impl PaymentLinkInterface for MockDb {// TODO: Implement function for `MockDb`xErr(errors::StorageError::MockDbError)?}++ async fn list_payment_link_by_merchant_id(+ &self,+ _merchant_id: &str,+ _payment_link_constraints: api_models::payments::PaymentLinkListConstraints,+ ) -> CustomResult<Vec<storage::PaymentLink>, errors::StorageError> {+ // TODO: Implement function for `MockDb`x+ Err(errors::StorageError::MockDbError)?+ }}diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rsindex 58d77d9e02..0bc8e492c4 100644--- a/crates/router/src/lib.rs+++ b/crates/router/src/lib.rs@@ -133,7 +133,6 @@ pub fn mk_app(.service(routes::PaymentMethods::server(state.clone())).service(routes::EphemeralKey::server(state.clone())).service(routes::Webhooks::server(state.clone()))- .service(routes::PaymentLink::server(state.clone()));}#[cfg(feature = "olap")]@@ -147,6 +146,7 @@ pub fn mk_app(.service(routes::Routing::server(state.clone())).service(routes::LockerMigrate::server(state.clone())).service(routes::Gsm::server(state.clone()))+ .service(routes::PaymentLink::server(state.clone())).service(routes::User::server(state.clone()))}diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rsindex 79801e8e64..96bb47ea4e 100644--- a/crates/router/src/routes/app.rs+++ b/crates/router/src/routes/app.rs@@ -19,8 +19,11 @@ use super::routing as cloud_routing;#[cfg(all(feature = "olap", feature = "kms"))]use super::verification::{apple_pay_merchant_registration, retrieve_apple_pay_verified_domains};#[cfg(feature = "olap")]-use super::{admin::*, api_keys::*, disputes::*, files::*, gsm::*, locker_migration, user::*};-use super::{cache::*, health::*, payment_link::*};+use super::{+ admin::*, api_keys::*, disputes::*, files::*, gsm::*, locker_migration, payment_link::*,+ user::*,+};+use super::{cache::*, health::*};#[cfg(any(feature = "olap", feature = "oltp"))]use super::{configs::*, customers::*, mandates::*, payments::*, refunds::*};#[cfg(feature = "oltp")]@@ -675,11 +678,12 @@ impl Cache {}pub struct PaymentLink;-+#[cfg(feature = "olap")]impl PaymentLink {pub fn server(state: AppState) -> Scope {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)),)diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rsindex 84b00867b9..a9cf7b44a7 100644--- a/crates/router/src/routes/lock_utils.rs+++ b/crates/router/src/routes/lock_utils.rs@@ -132,9 +132,12 @@ impl From<Flow> for ApiIdentifier {| Flow::BusinessProfileDelete| Flow::BusinessProfileList => Self::Business,+ Flow::PaymentLinkRetrieve | Flow::PaymentLinkInitiate | Flow::PaymentLinkList => {+ Self::PaymentLink+ }+Flow::Verification => Self::Verification,- Flow::PaymentLinkInitiate | Flow::PaymentLinkRetrieve => Self::PaymentLink,Flow::RustLockerMigration => Self::RustLockerMigration,Flow::GsmRuleCreate| Flow::GsmRuleRetrievediff --git a/crates/router/src/routes/payment_link.rs b/crates/router/src/routes/payment_link.rsindex 7d6bf1a05f..4c26ea71f7 100644--- a/crates/router/src/routes/payment_link.rs+++ b/crates/router/src/routes/payment_link.rs@@ -80,3 +80,46 @@ pub async fn initiate_payment_link()).await}++/// Payment Link - List+///+/// To list the payment links+#[utoipa::path(+ get,+ path = "/payment_link/list",+ params(+ ("limit" = Option<i64>, Query, description = "The maximum number of payment_link Objects to include in the response"),+ ("connector" = Option<String>, Query, description = "The connector linked to payment_link"),+ ("created_time" = Option<PrimitiveDateTime>, Query, description = "The time at which payment_link is created"),+ ("created_time.lt" = Option<PrimitiveDateTime>, Query, description = "Time less than the payment_link created time"),+ ("created_time.gt" = Option<PrimitiveDateTime>, Query, description = "Time greater than the payment_link created time"),+ ("created_time.lte" = Option<PrimitiveDateTime>, Query, description = "Time less than or equals to the payment_link created time"),+ ("created_time.gte" = Option<PrimitiveDateTime>, Query, description = "Time greater than or equals to the payment_link created time"),+ ),+ responses(+ (status = 200, description = "The payment link list was retrieved successfully"),+ (status = 401, description = "Unauthorized request")+ ),+ tag = "Payment Link",+ operation_id = "List all Payment links",+ security(("api_key" = []))+)]+#[instrument(skip_all, fields(flow = ?Flow::PaymentLinkList))]+pub async fn payments_link_list(+ state: web::Data<AppState>,+ req: actix_web::HttpRequest,+ payload: web::Query<api_models::payments::PaymentLinkListConstraints>,+) -> impl Responder {+ let flow = Flow::PaymentLinkList;+ let payload = payload.into_inner();+ api::server_wrap(+ flow,+ state,+ &req,+ payload,+ |state, auth, payload| list_payment_link(state, auth.merchant_account, payload),+ auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),+ api_locking::LockAction::NotApplicable,+ )+ .await+}diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rsindex dc615c4e41..b7d2fc8db3 100644--- a/crates/router/src/types/api.rs+++ b/crates/router/src/types/api.rs@@ -7,6 +7,7 @@ pub mod enums;pub mod ephemeral_key;pub mod files;pub mod mandates;+pub mod payment_link;pub mod payment_methods;pub mod payments;pub mod payouts;@@ -20,8 +21,8 @@ use api_models::payment_methods::{SurchargeDetailsResponse, SurchargeMetadata};use error_stack::{report, IntoReport, ResultExt};pub use self::{- admin::*, api_keys::*, configs::*, customers::*, disputes::*, files::*, payment_methods::*,- payments::*, payouts::*, refunds::*, webhooks::*,+ admin::*, api_keys::*, configs::*, customers::*, disputes::*, files::*, payment_link::*,+ payment_methods::*, payments::*, payouts::*, refunds::*, webhooks::*,};use super::ErrorResponse;use crate::{diff --git a/crates/router/src/types/api/payment_link.rs b/crates/router/src/types/api/payment_link.rsnew file mode 100644index 0000000000..e56af6b4ae--- /dev/null+++ b/crates/router/src/types/api/payment_link.rs@@ -0,0 +1,29 @@+pub use api_models::payments::RetrievePaymentLinkResponse;++use crate::{+ core::{errors::RouterResult, payment_link},+ types::storage::{self},+};++#[async_trait::async_trait]+pub(crate) trait PaymentLinkResponseExt: Sized {+ async fn from_db_payment_link(payment_link: storage::PaymentLink) -> RouterResult<Self>;+}++#[async_trait::async_trait]+impl PaymentLinkResponseExt for RetrievePaymentLinkResponse {+ async fn from_db_payment_link(payment_link: storage::PaymentLink) -> RouterResult<Self> {+ let status = payment_link::check_payment_link_status(payment_link.fulfilment_time);+ Ok(Self {+ link_to_pay: payment_link.link_to_pay,+ payment_link_id: payment_link.payment_link_id,+ amount: payment_link.amount,+ description: payment_link.description,+ created_at: payment_link.created_at,+ merchant_id: payment_link.merchant_id,+ link_expiry: payment_link.fulfilment_time,+ currency: payment_link.currency,+ status,+ })+ }+}diff --git a/crates/router/src/types/storage/payment_link.rs b/crates/router/src/types/storage/payment_link.rsindex 1fa2465e51..4dd9e06b4b 100644--- a/crates/router/src/types/storage/payment_link.rs+++ b/crates/router/src/types/storage/payment_link.rs@@ -1 +1,66 @@-pub use diesel_models::payment_link::{PaymentLink, PaymentLinkNew};+use async_bb8_diesel::AsyncRunQueryDsl;+use diesel::{associations::HasTable, ExpressionMethods, QueryDsl};+pub use diesel_models::{+ payment_link::{PaymentLink, PaymentLinkNew},+ schema::payment_link::dsl,+};+use error_stack::{IntoReport, ResultExt};++use crate::{+ connection::PgPooledConn,+ core::errors::{self, CustomResult},+ logger,+};+#[async_trait::async_trait]++pub trait PaymentLinkDbExt: Sized {+ async fn filter_by_constraints(+ conn: &PgPooledConn,+ merchant_id: &str,+ payment_link_list_constraints: api_models::payments::PaymentLinkListConstraints,+ ) -> CustomResult<Vec<Self>, errors::DatabaseError>;+}++#[async_trait::async_trait]+impl PaymentLinkDbExt for PaymentLink {+ async fn filter_by_constraints(+ conn: &PgPooledConn,+ merchant_id: &str,+ payment_link_list_constraints: api_models::payments::PaymentLinkListConstraints,+ ) -> CustomResult<Vec<Self>, errors::DatabaseError> {+ let mut filter = <Self as HasTable>::table()+ .filter(dsl::merchant_id.eq(merchant_id.to_owned()))+ .order(dsl::created_at.desc())+ .into_boxed();++ if let Some(created_time) = payment_link_list_constraints.created {+ filter = filter.filter(dsl::created_at.eq(created_time));+ }+ if let Some(created_time_lt) = payment_link_list_constraints.created_lt {+ filter = filter.filter(dsl::created_at.lt(created_time_lt));+ }+ if let Some(created_time_gt) = payment_link_list_constraints.created_gt {+ filter = filter.filter(dsl::created_at.gt(created_time_gt));+ }+ if let Some(created_time_lte) = payment_link_list_constraints.created_lte {+ filter = filter.filter(dsl::created_at.le(created_time_lte));+ }+ if let Some(created_time_gte) = payment_link_list_constraints.created_gte {+ filter = filter.filter(dsl::created_at.ge(created_time_gte));+ }+ if let Some(limit) = payment_link_list_constraints.limit {+ filter = filter.limit(limit);+ }++ logger::debug!(query = %diesel::debug_query::<diesel::pg::Pg, _>(&filter).to_string());++ filter+ .get_results_async(conn)+ .await+ .into_report()+ // The query built here returns an empty Vec when no records are found, and if any error does occur,+ // it would be an internal database error, due to which we are raising a DatabaseError::Unknown error+ .change_context(errors::DatabaseError::Others)+ .attach_printable("Error filtering payment link by specified constraints")+ }+}diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex b73ba0964f..45aad93371 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -992,18 +992,20 @@ impl}}-impl ForeignFrom<storage::PaymentLink> for api_models::payments::RetrievePaymentLinkResponse {- fn foreign_from(payment_link_object: storage::PaymentLink) -> Self {+impl ForeignFrom<(storage::PaymentLink, String)>+ for api_models::payments::RetrievePaymentLinkResponse+{+ fn foreign_from((payment_link_object, status): (storage::PaymentLink, String)) -> Self {Self {payment_link_id: payment_link_object.payment_link_id,- payment_id: payment_link_object.payment_id,merchant_id: payment_link_object.merchant_id,link_to_pay: payment_link_object.link_to_pay,amount: payment_link_object.amount,- currency: payment_link_object.currency,created_at: payment_link_object.created_at,- last_modified_at: payment_link_object.last_modified_at,link_expiry: payment_link_object.fulfilment_time,+ description: payment_link_object.description,+ currency: payment_link_object.currency,+ status,}}}diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rsindex f6d61f5508..178f837fce 100644--- a/crates/router_env/src/logger/types.rs+++ b/crates/router_env/src/logger/types.rs@@ -223,6 +223,8 @@ pub enum Flow {PaymentLinkRetrieve,/// payment Link Initiate flowPaymentLinkInitiate,+ /// Payment Link List flow+ PaymentLinkList,/// Create a business profileBusinessProfileCreate,/// Update a business profilediff --git a/migrations/2023-10-31-070509_add_payment_link_config_in_payment_link_db/down.sql b/migrations/2023-10-31-070509_add_payment_link_config_in_payment_link_db/down.sqlindex b5ffba7269..f16e280059 100644--- a/migrations/2023-10-31-070509_add_payment_link_config_in_payment_link_db/down.sql+++ b/migrations/2023-10-31-070509_add_payment_link_config_in_payment_link_db/down.sql@@ -1,2 +1,2 @@-- This file should undo anything in `up.sql`-ALTER TABLE payment_link DROP COLUMN IF EXISTS payment_link_config;\ No newline at end of file+ALTER TABLE payment_link DROP COLUMN IF EXISTS payment_link_config;diff --git a/migrations/2023-11-06-065213_add_description_to_payment_link/down.sql b/migrations/2023-11-06-065213_add_description_to_payment_link/down.sqlnew file mode 100644index 0000000000..b184a2ce3d--- /dev/null+++ b/migrations/2023-11-06-065213_add_description_to_payment_link/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+ALTER TABLE payment_link DROP COLUMN IF EXISTS description;\ No newline at end of filediff --git a/migrations/2023-11-06-065213_add_description_to_payment_link/up.sql b/migrations/2023-11-06-065213_add_description_to_payment_link/up.sqlnew file mode 100644index 0000000000..65a074063e--- /dev/null+++ b/migrations/2023-11-06-065213_add_description_to_payment_link/up.sql@@ -0,0 +1,2 @@+-- Your SQL goes here+ALTER table payment_link ADD COLUMN IF NOT EXISTS description VARCHAR (255);\ No newline at end of filediff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.jsonindex 9ca4dea4a1..df9df43a43 100644--- a/openapi/openapi_spec.json+++ b/openapi/openapi_spec.json@@ -11306,20 +11306,16 @@"type": "object","required": ["payment_link_id",- "payment_id","merchant_id","link_to_pay","amount","created_at",- "last_modified_at"+ "status"],"properties": {"payment_link_id": {"type": "string"},- "payment_id": {- "type": "string"- },"merchant_id": {"type": "string"},@@ -11330,26 +11326,29 @@"type": "integer","format": "int64"},- "currency": {- "allOf": [- {- "$ref": "#/components/schemas/Currency"- }- ],- "nullable": true- },"created_at": {"type": "string","format": "date-time"},- "last_modified_at": {- "type": "string",- "format": "date-time"- },"link_expiry": {"type": "string","format": "date-time","nullable": true+ },+ "description": {+ "type": "string",+ "nullable": true+ },+ "status": {+ "type": "string"+ },+ "currency": {+ "allOf": [+ {+ "$ref": "#/components/schemas/Currency"+ }+ ],+ "nullable": true}}},