mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
refactor(gsm): add error_category column to gsm table (#6648)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -7776,6 +7776,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorCategory": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"frm_decline",
|
||||
"processor_downtime",
|
||||
"processor_decline_unauthorized",
|
||||
"issue_with_payment_method",
|
||||
"processor_decline_incorrect_data"
|
||||
]
|
||||
},
|
||||
"ErrorDetails": {
|
||||
"type": "object",
|
||||
"description": "Error details for the payment",
|
||||
@ -9162,6 +9172,14 @@
|
||||
"type": "string",
|
||||
"description": "error message unified across the connectors",
|
||||
"nullable": true
|
||||
},
|
||||
"error_category": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ErrorCategory"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -9295,6 +9313,14 @@
|
||||
"type": "string",
|
||||
"description": "error message unified across the connectors",
|
||||
"nullable": true
|
||||
},
|
||||
"error_category": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ErrorCategory"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -9391,6 +9417,14 @@
|
||||
"type": "string",
|
||||
"description": "error message unified across the connectors",
|
||||
"nullable": true
|
||||
},
|
||||
"error_category": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ErrorCategory"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -10296,6 +10296,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorCategory": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"frm_decline",
|
||||
"processor_downtime",
|
||||
"processor_decline_unauthorized",
|
||||
"issue_with_payment_method",
|
||||
"processor_decline_incorrect_data"
|
||||
]
|
||||
},
|
||||
"EventClass": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@ -11639,6 +11649,14 @@
|
||||
"type": "string",
|
||||
"description": "error message unified across the connectors",
|
||||
"nullable": true
|
||||
},
|
||||
"error_category": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ErrorCategory"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -11772,6 +11790,14 @@
|
||||
"type": "string",
|
||||
"description": "error message unified across the connectors",
|
||||
"nullable": true
|
||||
},
|
||||
"error_category": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ErrorCategory"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -11868,6 +11894,14 @@
|
||||
"type": "string",
|
||||
"description": "error message unified across the connectors",
|
||||
"nullable": true
|
||||
},
|
||||
"error_category": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ErrorCategory"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
use common_enums::ErrorCategory;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::enums::Connector;
|
||||
@ -26,6 +27,8 @@ pub struct GsmCreateRequest {
|
||||
pub unified_code: Option<String>,
|
||||
/// error message unified across the connectors
|
||||
pub unified_message: Option<String>,
|
||||
/// category in which error belongs to
|
||||
pub error_category: Option<ErrorCategory>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
@ -88,6 +91,8 @@ pub struct GsmUpdateRequest {
|
||||
pub unified_code: Option<String>,
|
||||
/// error message unified across the connectors
|
||||
pub unified_message: Option<String>,
|
||||
/// category in which error belongs to
|
||||
pub error_category: Option<ErrorCategory>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
@ -141,4 +146,6 @@ pub struct GsmResponse {
|
||||
pub unified_code: Option<String>,
|
||||
/// error message unified across the connectors
|
||||
pub unified_message: Option<String>,
|
||||
/// category in which error belongs to
|
||||
pub error_category: Option<ErrorCategory>,
|
||||
}
|
||||
|
||||
@ -3372,3 +3372,28 @@ pub enum ConnectorMandateStatus {
|
||||
/// Indicates that the connector mandate is not active and hence cannot be used for payments.
|
||||
Inactive,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
strum::Display,
|
||||
PartialEq,
|
||||
Eq,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
strum::EnumString,
|
||||
ToSchema,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
)]
|
||||
#[router_derive::diesel_enum(storage_type = "text")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum ErrorCategory {
|
||||
FrmDecline,
|
||||
ProcessorDowntime,
|
||||
ProcessorDeclineUnauthorized,
|
||||
IssueWithPaymentMethod,
|
||||
ProcessorDeclineIncorrectData,
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
//! Gateway status mapping
|
||||
|
||||
use common_enums::ErrorCategory;
|
||||
use common_utils::{
|
||||
custom_serde,
|
||||
events::{ApiEventMetric, ApiEventsType},
|
||||
@ -39,6 +40,7 @@ pub struct GatewayStatusMap {
|
||||
pub step_up_possible: bool,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
pub error_category: Option<ErrorCategory>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Insertable)]
|
||||
@ -55,17 +57,11 @@ pub struct GatewayStatusMappingNew {
|
||||
pub step_up_possible: bool,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
pub error_category: Option<ErrorCategory>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
PartialEq,
|
||||
Eq,
|
||||
AsChangeset,
|
||||
router_derive::DebugAsDisplay,
|
||||
Default,
|
||||
serde::Deserialize,
|
||||
Clone, Debug, PartialEq, Eq, AsChangeset, router_derive::DebugAsDisplay, serde::Deserialize,
|
||||
)]
|
||||
#[diesel(table_name = gateway_status_map)]
|
||||
pub struct GatewayStatusMapperUpdateInternal {
|
||||
@ -80,6 +76,8 @@ pub struct GatewayStatusMapperUpdateInternal {
|
||||
pub step_up_possible: Option<bool>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
pub error_category: Option<ErrorCategory>,
|
||||
pub last_modified: PrimitiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -90,6 +88,7 @@ pub struct GatewayStatusMappingUpdate {
|
||||
pub step_up_possible: Option<bool>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
pub error_category: Option<ErrorCategory>,
|
||||
}
|
||||
|
||||
impl From<GatewayStatusMappingUpdate> for GatewayStatusMapperUpdateInternal {
|
||||
@ -101,6 +100,7 @@ impl From<GatewayStatusMappingUpdate> for GatewayStatusMapperUpdateInternal {
|
||||
step_up_possible,
|
||||
unified_code,
|
||||
unified_message,
|
||||
error_category,
|
||||
} = value;
|
||||
Self {
|
||||
status,
|
||||
@ -109,7 +109,13 @@ impl From<GatewayStatusMappingUpdate> for GatewayStatusMapperUpdateInternal {
|
||||
step_up_possible,
|
||||
unified_code,
|
||||
unified_message,
|
||||
..Default::default()
|
||||
error_category,
|
||||
last_modified: common_utils::date_time::now(),
|
||||
connector: None,
|
||||
flow: None,
|
||||
sub_flow: None,
|
||||
code: None,
|
||||
message: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,6 +508,8 @@ diesel::table! {
|
||||
unified_code -> Nullable<Varchar>,
|
||||
#[max_length = 1024]
|
||||
unified_message -> Nullable<Varchar>,
|
||||
#[max_length = 64]
|
||||
error_category -> Nullable<Varchar>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -520,6 +520,8 @@ diesel::table! {
|
||||
unified_code -> Nullable<Varchar>,
|
||||
#[max_length = 1024]
|
||||
unified_message -> Nullable<Varchar>,
|
||||
#[max_length = 64]
|
||||
error_category -> Nullable<Varchar>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -605,6 +605,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::blocklist::ToggleBlocklistResponse,
|
||||
api_models::blocklist::ListBlocklistQuery,
|
||||
api_models::enums::BlocklistDataKind,
|
||||
api_models::enums::ErrorCategory,
|
||||
api_models::webhook_events::EventListItemResponse,
|
||||
api_models::webhook_events::EventRetrieveResponse,
|
||||
api_models::webhook_events::OutgoingWebhookRequestContent,
|
||||
|
||||
@ -569,6 +569,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::blocklist::ToggleBlocklistResponse,
|
||||
api_models::blocklist::ListBlocklistQuery,
|
||||
api_models::enums::BlocklistDataKind,
|
||||
api_models::enums::ErrorCategory,
|
||||
api_models::webhook_events::EventListItemResponse,
|
||||
api_models::webhook_events::EventRetrieveResponse,
|
||||
api_models::webhook_events::OutgoingWebhookRequestContent,
|
||||
|
||||
@ -67,6 +67,7 @@ pub async fn update_gsm_rule(
|
||||
step_up_possible,
|
||||
unified_code,
|
||||
unified_message,
|
||||
error_category,
|
||||
} = gsm_request;
|
||||
GsmInterface::update_gsm_rule(
|
||||
db,
|
||||
@ -82,6 +83,7 @@ pub async fn update_gsm_rule(
|
||||
step_up_possible,
|
||||
unified_code,
|
||||
unified_message,
|
||||
error_category,
|
||||
},
|
||||
)
|
||||
.await
|
||||
|
||||
@ -1690,6 +1690,7 @@ impl ForeignFrom<gsm_api_types::GsmCreateRequest> for storage::GatewayStatusMapp
|
||||
step_up_possible: value.step_up_possible,
|
||||
unified_code: value.unified_code,
|
||||
unified_message: value.unified_message,
|
||||
error_category: value.error_category,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1708,6 +1709,7 @@ impl ForeignFrom<storage::GatewayStatusMap> for gsm_api_types::GsmResponse {
|
||||
step_up_possible: value.step_up_possible,
|
||||
unified_code: value.unified_code,
|
||||
unified_message: value.unified_message,
|
||||
error_category: value.error_category,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE gateway_status_map DROP COLUMN error_category;
|
||||
@ -0,0 +1,2 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE gateway_status_map ADD COLUMN error_category VARCHAR(64);
|
||||
Reference in New Issue
Block a user