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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(connector): [GlobalPay] Address `5xx` when cancelling a paypal transaction (#7605)
Pa1NarK8b0c133371fc
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/requests.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/requests.rsindex 223be54d3f..4574933208 100644--- a/crates/hyperswitch_connectors/src/connectors/globalpay/requests.rs+++ b/crates/hyperswitch_connectors/src/connectors/globalpay/requests.rs@@ -187,6 +187,9 @@ pub struct Notifications {/// The merchant URL that will receive the notification when the 3DS ACS successfully gathers/// de ice informatiSon and tonotification_configurations.cordingly.pub three_ds_method_return_url: Option<String>,+ /// The URL on merchant's website to which the customer should be redirected in the event of+ /// the customer canceling the transaction.+ pub cancel_url: Option<String>,}#[derive(Debug, Serialize, Deserialize)]diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/response.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/response.rsindex a5f905d0e7..a36cdc2a53 100644--- a/crates/hyperswitch_connectors/src/connectors/globalpay/response.rs+++ b/crates/hyperswitch_connectors/src/connectors/globalpay/response.rs@@ -69,7 +69,7 @@ pub struct Action {pub time_created: Option<String>,/// Indicates the action taken.#[serde(rename = "type")]- pub action_type: Option<String>,+ pub action_type: Option<ActionType>,}#[derive(Debug, Deserialize, Serialize)]@@ -266,6 +266,35 @@ pub struct ProviderClass {pub enum ResultCode {Declined,Success,+ Pending,+ Error,+}++/// Indicates the specific action taken.+#[derive(Debug, Serialize, Deserialize)]+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]+pub enum ActionType {+ Adjust,+ Authorize,+ Capture,+ Confirm,+ Force,+ Increment,+ Initiate,+ MultipleCapture,+ Preauthorize,+ PreauthorizeMultipleCapturere,+ Authorization,+ RedirectFrom,+ RedirectTo,+ Refund,+ Hold,+ Release,+ Reverse,+ Split,+ StatusNotification,+ TransactionList,+ TransactionSingle,}/// A string generated by the payment method that represents to what degree the merchant is@@ -335,19 +364,6 @@ pub enum Brand {Visa,}-/// If enabled, this field indicates whether the payment method has been seen before or is-/// new.-#[derive(Debug, Serialize, Deserialize)]-#[serde(rename_all = "SCREAMING_SNAKE_CASE")]-pub enum FingerprintPresenceIndicator {- /// Indicates that the payment method was seen on the platform before by this- /// merchant.- Exists,- /// Indicates that the payment method was not seen on the platform before by this- /// merchant.- New,-}-/// Indicates where a transaction is in its lifecycle.#[derive(Clone, Copy, Debug, Serialize, Deserialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]@@ -389,13 +405,6 @@ pub struct GlobalpayWebhookObjectEventType {pub status: GlobalpayWebhookStatus,}-#[derive(Debug, Deserialize, Serialize)]-pub struct GlobalpayPaymentsWebhookResponse {- pub id: String,- pub account_id: Option<String>,- pub account_name: Option<String>,-}-#[derive(Debug, Deserialize)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum GlobalpayWebhookStatus {@@ -404,8 +413,3 @@ pub enum GlobalpayWebhookStatus {#[serde(other)]Unknown,}--#[derive(Debug, Serialize, Deserialize)]-pub struct GlobalpayRedirectResponse {- pub status: Option<GlobalpayPaymentStatus>,-}diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rsindex 24cfa66ef3..124b611d04 100644--- a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs@@ -116,6 +116,7 @@ impl TryFrom<&GlobalPayRouterData<&PaymentsAuthorizeRouterData>> for GlobalpayPadecoupled_challenge_return_url: None,status_url: item.router_data.request.webhook_url.clone(),three_ds_method_return_url: None,+ cancel_url: get_return_url(item.router_data),}),authorization_mode: None,cashback_amount: None,@@ -477,7 +478,14 @@ fn get_return_url(item: &PaymentsAuthorizeRouterData) -> Option<String> {match item.request.payment_method_data.clone() {payment_method_data::PaymentMethodData::Wallet(payment_method_data::WalletData::PaypalRedirect(_),- ) => item.request.complete_authorize_url.clone(),+ ) => {+ // Return URL handling for PayPal via Globalpay:+ // - PayPal inconsistency: Return URLs work with HTTP, but cancel URLs require HTTPS+ // - Local development: When testing locally, expose your server via HTTPS and replace+ // the base URL with an HTTPS URL to ensure proper cancellation flow+ // - Refer to commit 6499d429da87 for more information+ item.request.complete_authorize_url.clone()+ }_ => item.request.router_return_url.clone(),}}diff --git a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rsindex 23a0daa45b..a1fc1bdd82 100644--- a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs@@ -309,7 +309,7 @@ impl TryFrom<enums::AttemptStatus> for RecurlyRecordStatus {#[derive(Debug, Deserialize, Serialize, Clone)]pub struct RecurlyRecordbackResponse {- // inovice id+ // invoice idpub id: id_type::PaymentReferenceId,}