Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): [Cybersource] signature authentication in incremental_authorization flow (#3141)

Sai Harsha Vardhand47a7cc418b0
diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rs
index f74ab55595..a2f14801a4 100644
--- a/crates/router/src/connector/cybersource.rs
+++ b/crates/router/src/connector/cybersource.rs
@@ -54,10 +54,17 @@ impl Cybersource {
api_secret,
} = auth;
let is_post_method = matches!(http_method, services::Method::Post);
- let digest_str = if is_post_method { "digest " } else { "" };
+ let is_patch_method = matches!(http_method, services::Method::Patch);
+ let digest_str = if is_post_method || is_patch_method {
+ "digest "
+ } else {
+ ""
+ };
let headers = format!("host date (request-target) {digest_str}v-c-merchant-id");
let request_target = if is_post_method {
format!("(request-target): post {resource}\ndigest: SHA-256={payload}\n")
+ } else if is_patch_method {
+ format!("(request-target): patch {resource}\ndigest: SHA-256={payload}\n")
} else {
format!("(request-target): get {resource}\n")
};
@@ -854,6 +861,10 @@ impl
self.build_headers(req, connectors)
}
+ fn get_http_method(&self) -> services::Method {
+ services::Method::Patch
+ }
+
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}