Skip to content

Commit

Permalink
feat(core): [Payouts] add merchant_connector_id to payout_attempt and…
Browse files Browse the repository at this point in the history
… show in response (#5214)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
Sakilmostak and hyperswitch-bot[bot] authored Aug 20, 2024
1 parent 6e7b38a commit 4cc389a
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 152 deletions.
6 changes: 6 additions & 0 deletions api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -13958,6 +13958,12 @@
"description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.",
"nullable": true
},
"merchant_connector_id": {
"type": "string",
"description": "Unique identifier of the merchant connector account",
"example": "mca_sAD3OZLATetvjLOYhUSy",
"nullable": true
},
"status": {
"$ref": "#/components/schemas/PayoutStatus"
},
Expand Down
6 changes: 6 additions & 0 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -18780,6 +18780,12 @@
"description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.",
"nullable": true
},
"merchant_connector_id": {
"type": "string",
"description": "Unique identifier of the merchant connector account",
"example": "mca_sAD3OZLATetvjLOYhUSy",
"nullable": true
},
"status": {
"$ref": "#/components/schemas/PayoutStatus"
},
Expand Down
4 changes: 4 additions & 0 deletions crates/api_models/src/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,10 @@ pub struct PayoutCreateResponse {
#[schema(value_type = Option<Object>, example = r#"{ "udf1": "some-value", "udf2": "some-value" }"#)]
pub metadata: Option<pii::SecretSerdeValue>,

/// Unique identifier of the merchant connector account
#[schema(value_type = Option<String>, example = "mca_sAD3OZLATetvjLOYhUSy")]
pub merchant_connector_id: Option<String>,

/// Current status of the Payout
#[schema(value_type = PayoutStatus, example = RequiresConfirmation)]
pub status: api_enums::PayoutStatus,
Expand Down
7 changes: 7 additions & 0 deletions crates/diesel_models/src/payout_attempt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub enum PayoutAttemptUpdate {
UpdateRouting {
connector: String,
routing_info: Option<serde_json::Value>,
merchant_connector_id: Option<String>,
},
}

Expand All @@ -108,6 +109,7 @@ pub struct PayoutAttemptUpdateInternal {
pub last_modified_at: PrimitiveDateTime,
pub address_id: Option<String>,
pub customer_id: Option<common_utils::id_type::CustomerId>,
pub merchant_connector_id: Option<String>,
}

impl Default for PayoutAttemptUpdateInternal {
Expand All @@ -123,6 +125,7 @@ impl Default for PayoutAttemptUpdateInternal {
business_label: None,
connector: None,
routing_info: None,
merchant_connector_id: None,
last_modified_at: common_utils::date_time::now(),
address_id: None,
customer_id: None,
Expand Down Expand Up @@ -166,9 +169,11 @@ impl From<PayoutAttemptUpdate> for PayoutAttemptUpdateInternal {
PayoutAttemptUpdate::UpdateRouting {
connector,
routing_info,
merchant_connector_id,
} => Self {
connector: Some(connector),
routing_info,
merchant_connector_id,
..Default::default()
},
}
Expand All @@ -191,6 +196,7 @@ impl PayoutAttemptUpdate {
last_modified_at,
address_id,
customer_id,
merchant_connector_id,
} = self.into();
PayoutAttempt {
payout_token: payout_token.or(source.payout_token),
Expand All @@ -206,6 +212,7 @@ impl PayoutAttemptUpdate {
last_modified_at,
address_id: address_id.or(source.address_id),
customer_id: customer_id.or(source.customer_id),
merchant_connector_id: merchant_connector_id.or(source.merchant_connector_id),
..source
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub enum PayoutAttemptUpdate {
UpdateRouting {
connector: String,
routing_info: Option<serde_json::Value>,
merchant_connector_id: Option<String>,
},
}

Expand All @@ -169,6 +170,7 @@ pub struct PayoutAttemptUpdateInternal {
pub routing_info: Option<serde_json::Value>,
pub address_id: Option<String>,
pub customer_id: Option<id_type::CustomerId>,
pub merchant_connector_id: Option<String>,
}

impl From<PayoutAttemptUpdate> for PayoutAttemptUpdateInternal {
Expand Down Expand Up @@ -207,9 +209,11 @@ impl From<PayoutAttemptUpdate> for PayoutAttemptUpdateInternal {
PayoutAttemptUpdate::UpdateRouting {
connector,
routing_info,
merchant_connector_id,
} => Self {
connector: Some(connector),
routing_info,
merchant_connector_id,
..Default::default()
},
}
Expand Down
Loading

0 comments on commit 4cc389a

Please sign in to comment.