mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
refactor(merchant_account): make organization_id as mandatory (#2458)
This commit is contained in:
@ -265,7 +265,7 @@ pub struct MerchantAccountResponse {
|
||||
pub intent_fulfillment_time: Option<i64>,
|
||||
|
||||
/// The organization id merchant is associated with
|
||||
pub organization_id: Option<String>,
|
||||
pub organization_id: String,
|
||||
|
||||
/// A boolean value to indicate if the merchant has recon service is enabled or not, by default value is false
|
||||
pub is_recon_enabled: bool,
|
||||
|
||||
@ -36,7 +36,7 @@ pub struct MerchantAccount {
|
||||
pub modified_at: time::PrimitiveDateTime,
|
||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||
pub payout_routing_algorithm: Option<serde_json::Value>,
|
||||
pub organization_id: Option<String>,
|
||||
pub organization_id: String,
|
||||
pub is_recon_enabled: bool,
|
||||
pub default_profile: Option<String>,
|
||||
pub recon_status: storage_enums::ReconStatus,
|
||||
@ -65,7 +65,7 @@ pub struct MerchantAccountNew {
|
||||
pub modified_at: time::PrimitiveDateTime,
|
||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||
pub payout_routing_algorithm: Option<serde_json::Value>,
|
||||
pub organization_id: Option<String>,
|
||||
pub organization_id: String,
|
||||
pub is_recon_enabled: bool,
|
||||
pub default_profile: Option<String>,
|
||||
pub recon_status: storage_enums::ReconStatus,
|
||||
|
||||
@ -437,7 +437,7 @@ diesel::table! {
|
||||
frm_routing_algorithm -> Nullable<Jsonb>,
|
||||
payout_routing_algorithm -> Nullable<Jsonb>,
|
||||
#[max_length = 32]
|
||||
organization_id -> Nullable<Varchar>,
|
||||
organization_id -> Varchar,
|
||||
is_recon_enabled -> Bool,
|
||||
#[max_length = 64]
|
||||
default_profile -> Nullable<Varchar>,
|
||||
|
||||
@ -31,6 +31,8 @@ use crate::{
|
||||
utils::{self, OptionExt},
|
||||
};
|
||||
|
||||
const DEFAULT_ORG_ID: &str = "org_abcdefghijklmn";
|
||||
|
||||
#[inline]
|
||||
pub fn create_merchant_publishable_key() -> String {
|
||||
format!(
|
||||
@ -164,7 +166,7 @@ pub async fn create_merchant_account(
|
||||
intent_fulfillment_time: req.intent_fulfillment_time.map(i64::from),
|
||||
payout_routing_algorithm: req.payout_routing_algorithm,
|
||||
id: None,
|
||||
organization_id: req.organization_id,
|
||||
organization_id: req.organization_id.unwrap_or(DEFAULT_ORG_ID.to_string()),
|
||||
is_recon_enabled: false,
|
||||
default_profile: None,
|
||||
recon_status: diesel_models::enums::ReconStatus::NotRequested,
|
||||
|
||||
@ -40,7 +40,7 @@ pub struct MerchantAccount {
|
||||
pub modified_at: time::PrimitiveDateTime,
|
||||
pub intent_fulfillment_time: Option<i64>,
|
||||
pub payout_routing_algorithm: Option<serde_json::Value>,
|
||||
pub organization_id: Option<String>,
|
||||
pub organization_id: String,
|
||||
pub is_recon_enabled: bool,
|
||||
pub default_profile: Option<String>,
|
||||
pub recon_status: diesel_models::enums::ReconStatus,
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE merchant_account
|
||||
ALTER COLUMN organization_id DROP NOT NULL;
|
||||
@ -0,0 +1,8 @@
|
||||
-- Your SQL goes here
|
||||
UPDATE merchant_account
|
||||
SET organization_id = 'org_abcdefghijklmn'
|
||||
WHERE organization_id IS NULL;
|
||||
|
||||
ALTER TABLE merchant_account
|
||||
ALTER COLUMN organization_id
|
||||
SET NOT NULL;
|
||||
@ -6113,6 +6113,7 @@
|
||||
"enable_payment_response_hash",
|
||||
"redirect_to_merchant_with_http_post",
|
||||
"primary_business_details",
|
||||
"organization_id",
|
||||
"is_recon_enabled",
|
||||
"recon_status"
|
||||
],
|
||||
@ -6241,8 +6242,7 @@
|
||||
},
|
||||
"organization_id": {
|
||||
"type": "string",
|
||||
"description": "The organization id merchant is associated with",
|
||||
"nullable": true
|
||||
"description": "The organization id merchant is associated with"
|
||||
},
|
||||
"is_recon_enabled": {
|
||||
"type": "boolean",
|
||||
|
||||
Reference in New Issue
Block a user