mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat: add organization_id to merchant account (#1611)
This commit is contained in:
@ -83,6 +83,9 @@ pub struct MerchantAccountCreate {
|
||||
///(900) for 15 mins
|
||||
#[schema(example = 900)]
|
||||
pub intent_fulfillment_time: Option<u32>,
|
||||
|
||||
/// The id of the organization to which the merchant belongs to
|
||||
pub organization_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema)]
|
||||
@ -221,6 +224,9 @@ pub struct MerchantAccountResponse {
|
||||
///Will be used to expire client secret after certain amount of time to be supplied in seconds
|
||||
///(900) for 15 mins
|
||||
pub intent_fulfillment_time: Option<i64>,
|
||||
|
||||
/// The organization id merchant is associated with
|
||||
pub organization_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
||||
|
||||
@ -35,6 +35,7 @@ pub struct MerchantAccount {
|
||||
pub created_at: time::PrimitiveDateTime,
|
||||
pub modified_at: time::PrimitiveDateTime,
|
||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||
pub organization_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
|
||||
@ -59,6 +60,7 @@ pub struct MerchantAccountNew {
|
||||
pub created_at: time::PrimitiveDateTime,
|
||||
pub modified_at: time::PrimitiveDateTime,
|
||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||
pub organization_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
|
||||
@ -82,4 +84,5 @@ pub struct MerchantAccountUpdateInternal {
|
||||
pub modified_at: Option<time::PrimitiveDateTime>,
|
||||
pub intent_fulfillment_time: Option<i64>,
|
||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||
pub organization_id: Option<String>,
|
||||
}
|
||||
|
||||
@ -328,6 +328,8 @@ diesel::table! {
|
||||
created_at -> Timestamp,
|
||||
modified_at -> Timestamp,
|
||||
frm_routing_algorithm -> Nullable<Jsonb>,
|
||||
#[max_length = 32]
|
||||
organization_id -> Nullable<Varchar>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -172,6 +172,7 @@ pub async fn create_merchant_account(
|
||||
frm_routing_algorithm: req.frm_routing_algorithm,
|
||||
intent_fulfillment_time: req.intent_fulfillment_time.map(i64::from),
|
||||
id: None,
|
||||
organization_id: req.organization_id,
|
||||
})
|
||||
}
|
||||
.await
|
||||
|
||||
@ -34,6 +34,7 @@ impl TryFrom<domain::MerchantAccount> for MerchantAccountResponse {
|
||||
primary_business_details,
|
||||
frm_routing_algorithm: item.frm_routing_algorithm,
|
||||
intent_fulfillment_time: item.intent_fulfillment_time,
|
||||
organization_id: item.organization_id,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ pub struct MerchantAccount {
|
||||
pub created_at: time::PrimitiveDateTime,
|
||||
pub modified_at: time::PrimitiveDateTime,
|
||||
pub intent_fulfillment_time: Option<i64>,
|
||||
pub organization_id: Option<String>,
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
@ -142,6 +143,7 @@ impl super::behaviour::Conversion for MerchantAccount {
|
||||
modified_at: self.modified_at,
|
||||
intent_fulfillment_time: self.intent_fulfillment_time,
|
||||
frm_routing_algorithm: self.frm_routing_algorithm,
|
||||
organization_id: self.organization_id,
|
||||
})
|
||||
}
|
||||
|
||||
@ -181,6 +183,7 @@ impl super::behaviour::Conversion for MerchantAccount {
|
||||
created_at: item.created_at,
|
||||
modified_at: item.modified_at,
|
||||
intent_fulfillment_time: item.intent_fulfillment_time,
|
||||
organization_id: item.organization_id,
|
||||
})
|
||||
}
|
||||
.await
|
||||
@ -211,6 +214,7 @@ impl super::behaviour::Conversion for MerchantAccount {
|
||||
modified_at: now,
|
||||
intent_fulfillment_time: self.intent_fulfillment_time,
|
||||
frm_routing_algorithm: self.frm_routing_algorithm,
|
||||
organization_id: self.organization_id,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE merchant_account DROP COLUMN IF EXISTS organization_id;
|
||||
@ -0,0 +1,3 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE merchant_account
|
||||
ADD COLUMN IF NOT EXISTS organization_id VARCHAR(32);
|
||||
@ -4846,6 +4846,11 @@
|
||||
"example": 900,
|
||||
"nullable": true,
|
||||
"minimum": 0.0
|
||||
},
|
||||
"organization_id": {
|
||||
"type": "string",
|
||||
"description": "The id of the organization to which the merchant belongs to",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -4991,6 +4996,11 @@
|
||||
"format": "int64",
|
||||
"description": "Will be used to expire client secret after certain amount of time to be supplied in seconds\n(900) for 15 mins",
|
||||
"nullable": true
|
||||
},
|
||||
"organization_id": {
|
||||
"type": "string",
|
||||
"description": "The organization id merchant is associated with",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user