Skip to content

Commit

Permalink
fix(connector): [BOA/Cybersource] Handle Invalid Api Secret (#3485)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshu-iiitu authored Jan 30, 2024
1 parent 9821935 commit 224c1cf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion crates/router/src/connector/bankofamerica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ impl Bankofamerica {
let key_value = consts::BASE64_ENGINE
.decode(api_secret.expose())
.into_report()
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "connector_account_details.api_secret",
})?;
let key = hmac::Key::new(hmac::HMAC_SHA256, &key_value);
let signature_value =
consts::BASE64_ENGINE.encode(hmac::sign(&key, signature_string.as_bytes()).as_ref());
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/bankofamerica/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ impl
})?
.parse_value("BankOfAmericaThreeDSMetadata")
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "Merchant connector account metadata",
config: "metadata",
})?;

let processing_information =
Expand Down
4 changes: 3 additions & 1 deletion crates/router/src/connector/cybersource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ impl Cybersource {
let key_value = consts::BASE64_ENGINE
.decode(api_secret.expose())
.into_report()
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "connector_account_details.api_secret",
})?;
let key = hmac::Key::new(hmac::HMAC_SHA256, &key_value);
let signature_value =
consts::BASE64_ENGINE.encode(hmac::sign(&key, signature_string.as_bytes()).as_ref());
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/cybersource/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ impl
})?
.parse_value("CybersourceThreeDSMetadata")
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "Merchant connector account metadata",
config: "metadata",
})?;

let processing_information =
Expand Down

0 comments on commit 224c1cf

Please sign in to comment.