Skip to content

Commit

Permalink
fix(connector): [BOA/CYBERSOURCE] Handle error reason as string
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshu-iiitu committed Dec 18, 2023
1 parent 3e7d683 commit d5135df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
22 changes: 1 addition & 21 deletions crates/router/src/connector/bankofamerica/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,30 +1020,10 @@ pub struct BankOfAmericaErrorResponse {
pub error_information: Option<ErrorInformation>,
pub status: Option<String>,
pub message: Option<String>,
pub reason: Option<Reason>,
pub reason: Option<String>,
pub details: Option<Vec<Details>>,
}

#[derive(Debug, Deserialize, strum::Display)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum Reason {
MissingField,
InvalidData,
DuplicateRequest,
InvalidCard,
AuthAlreadyReversed,
CardTypeNotAccepted,
InvalidMerchantConfiguration,
ProcessorUnavailable,
InvalidAmount,
InvalidCardType,
InvalidPaymentId,
NotSupported,
SystemError,
ServerTimeout,
ServiceTimeout,
}

#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Details {
Expand Down
22 changes: 1 addition & 21 deletions crates/router/src/connector/cybersource/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1292,30 +1292,10 @@ pub struct ErrorResponse {
pub error_information: Option<ErrorInformation>,
pub status: Option<String>,
pub message: Option<String>,
pub reason: Option<Reason>,
pub reason: Option<String>,
pub details: Option<Vec<Details>>,
}

#[derive(Debug, Deserialize, strum::Display)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum Reason {
MissingField,
InvalidData,
DuplicateRequest,
InvalidCard,
AuthAlreadyReversed,
CardTypeNotAccepted,
InvalidMerchantConfiguration,
ProcessorUnavailable,
InvalidAmount,
InvalidCardType,
InvalidPaymentId,
NotSupported,
SystemError,
ServerTimeout,
ServiceTimeout,
}

#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Details {
Expand Down

0 comments on commit d5135df

Please sign in to comment.