Dataset Viewer
repo
stringclasses 1
value | instance_id
stringlengths 24
24
| problem_statement
stringlengths 24
8.41k
| patch
stringlengths 0
367k
| test_patch
stringclasses 1
value | created_at
stringdate 2023-04-18 16:43:29
2025-10-07 09:18:54
| hints_text
stringlengths 57
132k
| version
stringclasses 8
values | base_commit
stringlengths 40
40
| environment_setup_commit
stringlengths 40
40
|
---|---|---|---|---|---|---|---|---|---|
juspay/hyperswitch
|
juspay__hyperswitch-9675
|
Bug: [feature] add mit payment s2s call and invoice sync job to subscription webhook
Create Mit payment handler in subscription invoice_handler.rs
and add create_invoice_sync_job after updating the invoice with the payment ID
|
diff --git a/crates/api_models/src/subscription.rs b/crates/api_models/src/subscription.rs
index 9378d7796f..2829d58b88 100644
--- a/crates/api_models/src/subscription.rs
+++ b/crates/api_models/src/subscription.rs
@@ -5,6 +5,7 @@ use utoipa::ToSchema;
use crate::{
enums as api_enums,
+ mandates::RecurringDetails,
payments::{Address, PaymentMethodDataRequest},
};
@@ -279,6 +280,17 @@ pub struct PaymentResponseData {
pub payment_method_type: Option<api_enums::PaymentMethodType>,
pub client_secret: Option<String>,
}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct CreateMitPaymentRequestData {
+ pub amount: MinorUnit,
+ pub currency: api_enums::Currency,
+ pub confirm: bool,
+ pub customer_id: Option<common_utils::id_type::CustomerId>,
+ pub recurring_details: Option<RecurringDetails>,
+ pub off_session: Option<bool>,
+}
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ConfirmSubscriptionRequest {
/// Client secret for SDK based interaction.
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index b1859cc6c2..b9053b46bc 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
pub use ui::*;
use utoipa::ToSchema;
-pub use super::connector_enums::RoutableConnectors;
+pub use super::connector_enums::{InvoiceStatus, RoutableConnectors};
#[doc(hidden)]
pub mod diesel_exports {
pub use super::{
@@ -9598,3 +9598,23 @@ pub enum GooglePayCardFundingSource {
#[serde(other)]
Unknown,
}
+
+impl From<IntentStatus> for InvoiceStatus {
+ fn from(value: IntentStatus) -> Self {
+ match value {
+ IntentStatus::Succeeded => Self::InvoicePaid,
+ IntentStatus::RequiresCapture
+ | IntentStatus::PartiallyCaptured
+ | IntentStatus::PartiallyCapturedAndCapturable
+ | IntentStatus::PartiallyAuthorizedAndRequiresCapture
+ | IntentStatus::Processing
+ | IntentStatus::RequiresCustomerAction
+ | IntentStatus::RequiresConfirmation
+ | IntentStatus::RequiresPaymentMethod => Self::PaymentPending,
+ IntentStatus::RequiresMerchantAction => Self::ManualReview,
+ IntentStatus::Cancelled | IntentStatus::CancelledPostCapture => Self::PaymentCanceled,
+ IntentStatus::Expired => Self::PaymentPendingTimeout,
+ IntentStatus::Failed | IntentStatus::Conflicted => Self::PaymentFailed,
+ }
+ }
+}
diff --git a/crates/diesel_models/src/invoice.rs b/crates/diesel_models/src/invoice.rs
index 8ffd54c288..59ef0b272d 100644
--- a/crates/diesel_models/src/invoice.rs
+++ b/crates/diesel_models/src/invoice.rs
@@ -57,6 +57,7 @@ pub struct InvoiceUpdate {
pub status: Option<String>,
pub payment_method_id: Option<String>,
pub modified_at: time::PrimitiveDateTime,
+ pub payment_intent_id: Option<common_utils::id_type::PaymentId>,
}
impl InvoiceNew {
@@ -98,10 +99,15 @@ impl InvoiceNew {
}
impl InvoiceUpdate {
- pub fn new(payment_method_id: Option<String>, status: Option<InvoiceStatus>) -> Self {
+ pub fn new(
+ payment_method_id: Option<String>,
+ status: Option<InvoiceStatus>,
+ payment_intent_id: Option<common_utils::id_type::PaymentId>,
+ ) -> Self {
Self {
payment_method_id,
status: status.map(|status| status.to_string()),
+ payment_intent_id,
modified_at: common_utils::date_time::now(),
}
}
diff --git a/crates/router/src/core/subscription.rs b/crates/router/src/core/subscription.rs
index 1ec8514fc6..2d3fd64966 100644
--- a/crates/router/src/core/subscription.rs
+++ b/crates/router/src/core/subscription.rs
@@ -354,6 +354,7 @@ pub async fn confirm_subscription(
&state,
invoice.id,
payment_response.payment_method_id.clone(),
+ Some(payment_response.payment_id.clone()),
invoice_details
.clone()
.and_then(|invoice| invoice.status)
diff --git a/crates/router/src/core/subscription/invoice_handler.rs b/crates/router/src/core/subscription/invoice_handler.rs
index 3809474acf..8cc026fb37 100644
--- a/crates/router/src/core/subscription/invoice_handler.rs
+++ b/crates/router/src/core/subscription/invoice_handler.rs
@@ -77,11 +77,13 @@ impl InvoiceHandler {
state: &SessionState,
invoice_id: common_utils::id_type::InvoiceId,
payment_method_id: Option<Secret<String>>,
+ payment_intent_id: Option<common_utils::id_type::PaymentId>,
status: connector_enums::InvoiceStatus,
) -> errors::RouterResult<diesel_models::invoice::Invoice> {
let update_invoice = diesel_models::invoice::InvoiceUpdate::new(
payment_method_id.as_ref().map(|id| id.peek()).cloned(),
Some(status),
+ payment_intent_id,
);
state
.store
@@ -255,4 +257,31 @@ impl InvoiceHandler {
.attach_printable("invoices: unable to create invoice sync job in database")?;
Ok(())
}
+
+ pub async fn create_mit_payment(
+ &self,
+ state: &SessionState,
+ amount: MinorUnit,
+ currency: common_enums::Currency,
+ payment_method_id: &str,
+ ) -> errors::RouterResult<subscription_types::PaymentResponseData> {
+ let mit_payment_request = subscription_types::CreateMitPaymentRequestData {
+ amount,
+ currency,
+ confirm: true,
+ customer_id: Some(self.subscription.customer_id.clone()),
+ recurring_details: Some(api_models::mandates::RecurringDetails::PaymentMethodId(
+ payment_method_id.to_owned(),
+ )),
+ off_session: Some(true),
+ };
+
+ payments_api_client::PaymentsApiClient::create_mit_payment(
+ state,
+ mit_payment_request,
+ self.merchant_account.get_id().get_string_repr(),
+ self.profile.get_id().get_string_repr(),
+ )
+ .await
+ }
}
diff --git a/crates/router/src/core/subscription/payments_api_client.rs b/crates/router/src/core/subscription/payments_api_client.rs
index e483469be9..e530a5843c 100644
--- a/crates/router/src/core/subscription/payments_api_client.rs
+++ b/crates/router/src/core/subscription/payments_api_client.rs
@@ -192,4 +192,27 @@ impl PaymentsApiClient {
)
.await
}
+
+ pub async fn create_mit_payment(
+ state: &SessionState,
+ request: subscription_types::CreateMitPaymentRequestData,
+ merchant_id: &str,
+ profile_id: &str,
+ ) -> errors::RouterResult<subscription_types::PaymentResponseData> {
+ let base_url = &state.conf.internal_services.payments_base_url;
+ let url = format!("{}/payments", base_url);
+
+ Self::make_payment_api_call(
+ state,
+ services::Method::Post,
+ url,
+ Some(common_utils::request::RequestContent::Json(Box::new(
+ request,
+ ))),
+ "Create MIT Payment",
+ merchant_id,
+ profile_id,
+ )
+ .await
+ }
}
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index f207c243d2..657655c25b 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -2622,7 +2622,7 @@ async fn subscription_incoming_webhook_flow(
.await
.attach_printable("subscriptions: failed to get subscription entry in get_subscription")?;
- let invoice_handler = subscription_with_handler.get_invoice_handler(profile);
+ let invoice_handler = subscription_with_handler.get_invoice_handler(profile.clone());
let payment_method_id = subscription_with_handler
.subscription
@@ -2635,7 +2635,7 @@ async fn subscription_incoming_webhook_flow(
logger::info!("Payment method ID found: {}", payment_method_id);
- let _invoice_new = invoice_handler
+ let invoice_entry = invoice_handler
.create_invoice_entry(
&state,
billing_connector_mca_id.clone(),
@@ -2648,5 +2648,33 @@ async fn subscription_incoming_webhook_flow(
)
.await?;
+ let payment_response = invoice_handler
+ .create_mit_payment(
+ &state,
+ mit_payment_data.amount_due,
+ mit_payment_data.currency_code,
+ &payment_method_id.clone(),
+ )
+ .await?;
+
+ let updated_invoice = invoice_handler
+ .update_invoice(
+ &state,
+ invoice_entry.id.clone(),
+ payment_response.payment_method_id.clone(),
+ Some(payment_response.payment_id.clone()),
+ InvoiceStatus::from(payment_response.status),
+ )
+ .await?;
+
+ invoice_handler
+ .create_invoice_sync_job(
+ &state,
+ &updated_invoice,
+ mit_payment_data.invoice_id.get_string_repr().to_string(),
+ connector,
+ )
+ .await?;
+
Ok(WebhookResponseTracker::NoEffect)
}
diff --git a/crates/router/src/workflows/invoice_sync.rs b/crates/router/src/workflows/invoice_sync.rs
index ec2d2d7a91..c6daab0211 100644
--- a/crates/router/src/workflows/invoice_sync.rs
+++ b/crates/router/src/workflows/invoice_sync.rs
@@ -202,6 +202,7 @@ impl<'a> InvoiceSyncHandler<'a> {
self.state,
self.invoice.id.to_owned(),
None,
+ None,
common_enums::connector_enums::InvoiceStatus::from(invoice_sync_status),
)
.await
|
2025-10-04T20:28:58Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
This pr completes [9400](https://github.com/juspay/hyperswitch/pull/9400)
This pr adds support to do MIT payment for subscription and adds an invoice sync job
Created Mit payment handler in subscription invoice_handler.rs
and added create_invoice_sync_job after updating the invoice with the payment ID
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
```
Enable internal API key Auth by changing config/development.toml
[internal_merchant_id_profile_id_auth]
enabled = true
internal_api_key = "test_internal_api_key"
```
1. Create Merchant, API key, Payment connector, Billing Connector
2. Update profile to set the billing processor
Request
```
curl --location 'http://localhost:8080/account/merchant_1759125756/business_profile/pro_71jcERFiZERp44d8fuSJ' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_0RJW0cwZDeGfSkod0eJWOkfZHK0PCoZtDYJJ1FxeHqhHky1VNPU6nkgFQiTFSDvA' \
--data '{
"billing_processor_id": "mca_NLnCEvS2DfuHWHFVa09o"
}'
```
Response
```
{"merchant_id":"merchant_1759125756","profile_id":"pro_71jcERFiZERp44d8fuSJ","profile_name":"US_default","return_url":"https://google.com/success","enable_payment_response_hash":true,"payment_response_hash_key":"ZFjTKSE1EYiXaPcRhacrwlNh4wieUorlmP7r2uSHI8fyHigGmNCKY2hqVtzAq51m","redirect_to_merchant_with_http_post":false,"webhook_details":{"webhook_version":"1.0.1","webhook_username":"ekart_retail","webhook_password":"password_ekart@123","webhook_url":null,"payment_created_enabled":true,"payment_succeeded_enabled":true,"payment_failed_enabled":true,"payment_statuses_enabled":null,"refund_statuses_enabled":null,"payout_statuses_enabled":null},"metadata":null,"routing_algorithm":null,"intent_fulfillment_time":900,"frm_routing_algorithm":null,"payout_routing_algorithm":null,"applepay_verified_domains":null,"session_expiry":900,"payment_link_config":null,"authentication_connector_details":null,"use_billing_as_payment_method_billing":true,"extended_card_info_config":null,"collect_shipping_details_from_wallet_connector":false,"collect_billing_details_from_wallet_connector":false,"always_collect_shipping_details_from_wallet_connector":false,"always_collect_billing_details_from_wallet_connector":false,"is_connector_agnostic_mit_enabled":false,"payout_link_config":null,"outgoing_webhook_custom_http_headers":null,"tax_connector_id":null,"is_tax_connector_enabled":false,"is_network_tokenization_enabled":false,"is_auto_retries_enabled":false,"max_auto_retries_enabled":null,"always_request_extended_authorization":null,"is_click_to_pay_enabled":false,"authentication_product_ids":null,"card_testing_guard_config":{"card_ip_blocking_status":"disabled","card_ip_blocking_threshold":3,"guest_user_card_blocking_status":"disabled","guest_user_card_blocking_threshold":10,"customer_id_blocking_status":"disabled","customer_id_blocking_threshold":5,"card_testing_guard_expiry":3600},"is_clear_pan_retries_enabled":false,"force_3ds_challenge":false,"is_debit_routing_enabled":false,"merchant_business_country":null,"is_pre_network_tokenization_enabled":false,"acquirer_configs":null,"is_iframe_redirection_enabled":null,"merchant_category_code":null,"merchant_country_code":null,"dispute_polling_interval":null,"is_manual_retry_enabled":null,"always_enable_overcapture":null,"is_external_vault_enabled":"skip","external_vault_connector_details":null,"billing_processor_id":"mca_NLnCEvS2DfuHWHFVa09o"}
```
3. Create Customer
Request
```
curl --location 'http://localhost:8080/customers' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0RJW0cwZDeGfSkod0eJWOkfZHK0PCoZtDYJJ1FxeHqhHky1VNPU6nkgFQiTFSDvA' \
--data-raw '{
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "First customer",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
Response
```
{
"customer_id": "cus_OYy3hzTTt04Enegu3Go3",
"name": "John Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65",
"description": "First customer",
"address": null,
"created_at": "2025-09-29T14:45:14.430Z",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"default_payment_method_id": null,
"tax_registration_id": null
}
```
7. Subscription create and confirm
Request
```
curl --location 'http://localhost:8080/subscriptions' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Profile-Id: pro_MiKOgwbj84jJ095MoWdj' \
--header 'api-key: dev_I62cGvBVijteiN61aMcAOeYvXpO8s36gT8BFvPznYYDXF4GFtVtjzgiel9oIpvUK' \
--data '{
"item_price_id": "cbdemo_enterprise-suite-monthly",
"customer_id": "cus_efEv4nqfrYEo8wSKZ10C",
"description": "Hello this is description",
"merchant_reference_id": "mer_ref_1759334677",
"shipping": {
"address": {
"state": "zsaasdas",
"city": "Banglore",
"country": "US",
"line1": "sdsdfsdf",
"line2": "hsgdbhd",
"line3": "alsksoe",
"zip": "571201",
"first_name": "joseph",
"last_name": "doe"
},
"phone": {
"number": "123456789",
"country_code": "+1"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "123456789",
"country_code": "+1"
}
},
"payment_details": {
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "CLBRW dffdg",
"card_cvc": "737"
}
},
"authentication_type": "no_three_ds",
"setup_future_usage": "off_session",
"capture_method": "automatic",
"return_url": "https://google.com",
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
}
}
}'
```
Response
```
{
"id": "sub_CkPzNaFAyxzX2WwdKFCr",
"merchant_reference_id": "mer_ref_1759334529",
"status": "active",
"plan_id": null,
"price_id": null,
"coupon": null,
"profile_id": "pro_MiKOgwbj84jJ095MoWdj",
"payment": {
"payment_id": "sub_pay_KXEtoTxvu0EsadB5wxNn",
"status": "succeeded",
"amount": 14100,
"currency": "INR",
"connector": "stripe",
"payment_method_id": "pm_bDPHgNaP7UZGjtZ7QPrS",
"payment_experience": null,
"error_code": null,
"error_message": null
},
"customer_id": "cus_uBtUJLSVSICr8ctmoL8i",
"invoice": {
"id": "invoice_Ht72m0Enqy4YOGRKAtbZ",
"subscription_id": "sub_CkPzNaFAyxzX2WwdKFCr",
"merchant_id": "merchant_1759157014",
"profile_id": "pro_MiKOgwbj84jJ095MoWdj",
"merchant_connector_id": "mca_oMyzcBFcpfISftwDDVuG",
"payment_intent_id": "sub_pay_KXEtoTxvu0EsadB5wxNn",
"payment_method_id": null,
"customer_id": "cus_uBtUJLSVSICr8ctmoL8i",
"amount": 14100,
"currency": "INR",
"status": "payment_pending"
},
"billing_processor_subscription_id": "sub_CkPzNaFAyxzX2WwdKFCr"
}
```
incoming webhook for chargebee
```
curl --location 'http://localhost:8080/webhooks/merchant_1758710612/mca_YH3XxYGMv6IbKD0icBie' \
--header 'api-key: dev_5LNrrMNqyyFle8hvMssLob9pFq6OIEh0Vl3DqZttFXiDe7wrrScUePEYrIiYfSKT' \
--header 'Content-Type: application/json' \
--header 'authorization: Basic aHlwZXJzd2l0Y2g6aHlwZXJzd2l0Y2g=' \
--data-raw '{
"api_version": "v2",
"content": {
"invoice": {
"adjustment_credit_notes": [],
"amount_adjusted": 0,
"amount_due": 14100,
"amount_paid": 0,
"amount_to_collect": 14100,
"applied_credits": [],
"base_currency_code": "INR",
"channel": "web",
"credits_applied": 0,
"currency_code": "INR",
"customer_id": "gaurav_test",
"date": 1758711043,
"deleted": false,
"due_date": 1758711043,
"dunning_attempts": [],
"exchange_rate": 1.0,
"first_invoice": false,
"generated_at": 1758711043,
"has_advance_charges": false,
"id": "3",
"is_gifted": false,
"issued_credit_notes": [],
"line_items": [
{
"amount": 14100,
"customer_id": "gaurav_test",
"date_from": 1758711043,
"date_to": 1761303043,
"description": "Enterprise Suite Monthly",
"discount_amount": 0,
"entity_id": "cbdemo_enterprise-suite-monthly",
"entity_type": "plan_item_price",
"id": "li_169vD0Uxi8JBp46g",
"is_taxed": false,
"item_level_discount_amount": 0,
"object": "line_item",
"pricing_model": "flat_fee",
"quantity": 1,
"subscription_id": "169vD0Uxi8JB746e",
"tax_amount": 0,
"tax_exempt_reason": "tax_not_configured",
"unit_amount": 14100
}
],
"linked_orders": [],
"linked_payments": [],
"net_term_days": 0,
"new_sales_amount": 14100,
"object": "invoice",
"price_type": "tax_exclusive",
"recurring": true,
"reference_transactions": [],
"resource_version": 1758711043846,
"round_off_amount": 0,
"site_details_at_creation": {
"timezone": "Asia/Calcutta"
},
"status": "payment_due",
"sub_total": 14100,
"subscription_id": "169vD0Uxi8JB746e",
"tax": 0,
"term_finalized": true,
"total": 14100,
"updated_at": 1758711043,
"write_off_amount": 0
}
},
"event_type": "invoice_generated",
"id": "ev_169vD0Uxi8JDf46i",
"object": "event",
"occurred_at": 1758711043,
"source": "admin_console",
"user": "[email protected]",
"webhook_status": "scheduled",
"webhooks": [
{
"id": "whv2_169mYOUxi3nvkZ8v",
"object": "webhook",
"webhook_status": "scheduled"
}
]
}'
```
response
200 ok
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
invoice sync finished
<img width="1504" height="463" alt="image" src="https://github.com/user-attachments/assets/13e1469d-bb39-4484-b350-5ee278c66a3a" />
Record back successful
<img width="1200" height="115" alt="image" src="https://github.com/user-attachments/assets/d221b8da-44dc-4790-86be-70dfd9f601df" />
invoice table entry
<img width="668" height="402" alt="image" src="https://github.com/user-attachments/assets/29e59bea-dd08-4ae1-8e88-495abdaf8735" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
v1.117.0
|
c172f03c31e9b29b69490c7c5dfb3b4c78206f79
|
c172f03c31e9b29b69490c7c5dfb3b4c78206f79
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9696
|
Bug: [FIX] (connector) Skrill payment method in Paysafe throws 501
origin: paysafe transformers L566
payment going through pre process flow, unexpected.
skrill should go through authorize + complete authorize flow
rca:
preprocessing is being applied to entire wallet for paysafe connector. it needs to be restricted to apple pay since apple pay does not require complete authorize flow
|
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index e9a917153f..e3d153f2aa 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -6623,11 +6623,14 @@ where
false,
)
} else if connector.connector_name == router_types::Connector::Paysafe {
- router_data = router_data.preprocessing_steps(state, connector).await?;
-
- let is_error_in_response = router_data.response.is_err();
- // If is_error_in_response is true, should_continue_payment should be false, we should throw the error
- (router_data, !is_error_in_response)
+ match payment_data.get_payment_method_data() {
+ Some(domain::PaymentMethodData::Wallet(domain::WalletData::ApplePay(_))) => {
+ router_data = router_data.preprocessing_steps(state, connector).await?;
+ let is_error_in_response = router_data.response.is_err();
+ (router_data, !is_error_in_response)
+ }
+ _ => (router_data, should_continue_payment),
+ }
} else {
(router_data, should_continue_payment)
}
|
2025-10-06T11:39:33Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
this pr fixes bug in paysafe where skrill wallet payment method was throwing `501`. the reason being, we've added a check in preprocessing call that applied to all wallet payment methods for paysafe instead of having it applied to apple pay specifically.
this pr fixes that.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
skrill, unintentionally went to preprocessing step that resulted in 501 while the payment method is implemented in authorize call.
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
<details>
<summary>Apple Pay</summary>
Create
```bash
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_wcCEnIpNCiH8uz9vhjaLpojPpZLQAo0ScLnQ1VPuSFGWa5x1vbKtBGqwd2wII9HM' \
--data-raw '{
"amount": 1000,
"currency": "USD",
"confirm": false,
"business_country": "US",
"business_label": "default",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "StripeCustomer",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
```
```json
{
"payment_id": "pay_nKWxEfg6kk2sBUFGFMeR",
"merchant_id": "postman_merchant_GHAction_1759750181",
"status": "requires_payment_method",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_nKWxEfg6kk2sBUFGFMeR_secret_89GK0HlI7M74crmy87AS",
"created": "2025-10-06T11:32:52.402Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": null,
"payment_method_data": null,
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": null,
"connector_label": null,
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "StripeCustomer",
"created_at": 1759750372,
"expires": 1759753972,
"secret": "epk_5cf9e0984e984eadb290d4d6f68e1070"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_HwXSI9BzQBCoG4QkGRlw",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-10-06T11:47:52.402Z",
"fingerprint": null,
"browser_info": null,
"payment_channel": null,
"payment_method_id": null,
"network_transaction_id": null,
"payment_method_status": null,
"updated": "2025-10-06T11:32:52.431Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"request_extended_authorization": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null,
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null,
"is_iframe_redirection_enabled": null,
"whole_connector_response": null,
"enable_partial_authorization": null,
"enable_overcapture": null,
"is_overcapture_enabled": null,
"network_details": null,
"is_stored_credential": null,
"mit_category": null
}
```
Session
```bash
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_7d80afd0f4b841e2a0b0e1a460f6039c' \
--data '{
"payment_id": "pay_nKWxEfg6kk2sBUFGFMeR",
"wallets": [],
"client_secret": "pay_nKWxEfg6kk2sBUFGFMeR_secret_89GK0HlI7M74crmy87AS"
}'
```
```json
{
"payment_id": "pay_nKWxEfg6kk2sBUFGFMeR",
"client_secret": "pay_nKWxEfg6kk2sBUFGFMeR_secret_89GK0HlI7M74crmy87AS",
"session_token": [
{
"wallet_name": "apple_pay",
"session_token_data": {
"epoch_timestamp": 1759750383162,
"expires_at": 1759753983162,
"merchant_session_identifier": "SS..C3",
"nonce": "08ed5fa4",
"merchant_identifier": "8C..C4",
"domain_name": "hyperswitch.app",
"display_name": "apple pay",
"signature": "30..00",
"operational_analytics_identifier": "apple pay:8C...C4",
"retries": 0,
"psp_id": "8C...C4"
},
"payment_request_data": {
"country_code": "US",
"currency_code": "USD",
"total": {
"label": "applepay",
"type": "final",
"amount": "10.00"
},
"merchant_capabilities": [
"supports3DS"
],
"supported_networks": [
"visa",
"masterCard",
"amex",
"discover"
],
"merchant_identifier": "merchant.lol"
},
"connector": "paysafe",
"delayed_session_token": false,
"sdk_next_action": {
"next_action": "confirm"
},
"connector_reference_id": null,
"connector_sdk_public_key": null,
"connector_merchant_id": null
}
]
}
```
Confirm
```bash
curl --location 'http://localhost:8080/payments/pay_nKWxEfg6kk2sBUFGFMeR/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_7hcskEypRcDWscoO2H26tDR7GKLF3kT0ypXEF1YMCoLPKAm7fglmqZ4zBTaiLlid' \
--data '{
"confirm": true,
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"payment_method_data": {
"wallet": {
"apple_pay": {
"payment_data": {
"application_primary_account_number": "5204245253050839",
"application_expiration_month": "01",
"application_expiration_year": "30",
"payment_data": {
"online_payment_cryptogram": "A/FwSJkAlul/sRItXYorMAACAAA=",
"eci_indicator": "1"
}
},
"payment_method": {
"display_name": "Visa 4228",
"network": "Mastercard",
"type": "debit"
},
"transaction_identifier": "a0...4a"
}
},
"billing": null
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "John",
"last_name": "Doe"
}
}
}'
```
```json
{
"payment_id": "pay_nKWxEfg6kk2sBUFGFMeR",
"merchant_id": "postman_merchant_GHAction_1759750181",
"status": "succeeded",
"amount": 1000,
"net_amount": 1000,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1000,
"connector": "paysafe",
"client_secret": "pay_nKWxEfg6kk2sBUFGFMeR_secret_89GK0HlI7M74crmy87AS",
"created": "2025-10-06T11:34:26.900Z",
"currency": "USD",
"customer_id": "StripeCustomer",
"customer": {
"id": "StripeCustomer",
"name": "John Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {
"apple_pay": {
"last4": "4228",
"card_network": "Mastercard",
"type": "debit"
}
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe",
"origin_zip": null
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "John",
"last_name": "Doe",
"origin_zip": null
},
"phone": null,
"email": null
},
"order_details": null,
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"return_url": "https://duck.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "apple_pay",
"connector_label": "paysafe_US_default",
"business_country": "US",
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": "f115ce9c-fd30-49dc-94f1-81e3cb868154",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": null,
"feature_metadata": {
"redirect_response": null,
"search_tags": null,
"apple_pay_recurring_details": null,
"gateway_system": "direct"
},
"reference_id": null,
"payment_link": null,
"profile_id": "pro_3ChHsAtYFOz9hH9VMtnw",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_4L5eJPYlmGaJigFIaTZl",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-10-06T11:49:26.900Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"referer": null,
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"os_version": null,
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"color_depth": 24,
"device_model": null,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"accept_language": "en",
"java_script_enabled": true
},
"payment_channel": null,
"payment_method_id": null,
"network_transaction_id": null,
"payment_method_status": null,
"updated": "2025-10-06T11:34:32.130Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"request_extended_authorization": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null,
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null,
"is_iframe_redirection_enabled": null,
"whole_connector_response": null,
"enable_partial_authorization": null,
"enable_overcapture": null,
"is_overcapture_enabled": null,
"network_details": null,
"is_stored_credential": null,
"mit_category": null
}
```
</details>
<details>
<summary>Skrill</summary>
```bash
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_wcCEnIpNCiH8uz9vhjaLpojPpZLQAo0ScLnQ1VPuSFGWa5x1vbKtBGqwd2wII9HM' \
--data-raw '{
"amount": 1500,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "aaaa",
"authentication_type": "three_ds",
"payment_method": "wallet",
"payment_method_type": "skrill",
"payment_method_data": {
"wallet": {
"skrill": {}
}
},
"billing": {
"address": {
"line1": "Singapore Changi Airport. 2nd flr",
"line2": "",
"line3": "",
"city": "Downtown Core",
"state": "Central Indiana America",
"zip": "039393",
"country": "SG",
"first_name": "박성준",
"last_name": "박성준"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
}
}'
```
```json
{
"payment_id": "pay_ZR36mAH59ofEyHCuMfNr",
"merchant_id": "postman_merchant_GHAction_1759750181",
"status": "requires_customer_action",
"amount": 1500,
"net_amount": 1500,
"shipping_cost": null,
"amount_capturable": 1500,
"amount_received": null,
"connector": "paysafe",
"client_secret": "pay_ZR36mAH59ofEyHCuMfNr_secret_fHOQqa4f7kuV026Br3Sx",
"created": "2025-10-06T11:29:48.570Z",
"currency": "USD",
"customer_id": "aaaa",
"customer": {
"id": "aaaa",
"name": null,
"email": null,
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "Downtown Core",
"country": "SG",
"line1": "Singapore Changi Airport. 2nd flr",
"line2": "",
"line3": "",
"zip": "039393",
"state": "Central Indiana America",
"first_name": "박성준",
"last_name": "박성준",
"origin_zip": null
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_ZR36mAH59ofEyHCuMfNr/postman_merchant_GHAction_1759750181/pay_ZR36mAH59ofEyHCuMfNr_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "skrill",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "aaaa",
"created_at": 1759750188,
"expires": 1759753788,
"secret": "epk_5802f16446f44f4286501593b0a0efe0"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": {
"redirect_response": null,
"search_tags": null,
"apple_pay_recurring_details": null,
"gateway_system": "direct"
},
"reference_id": null,
"payment_link": null,
"profile_id": "pro_HwXSI9BzQBCoG4QkGRlw",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_akveLwRd2jjVRaaaPyl5",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-10-06T11:44:48.570Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_channel": null,
"payment_method_id": null,
"network_transaction_id": null,
"payment_method_status": null,
"updated": "2025-10-06T11:29:49.759Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"request_extended_authorization": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null,
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null,
"is_iframe_redirection_enabled": null,
"whole_connector_response": null,
"enable_partial_authorization": null,
"enable_overcapture": null,
"is_overcapture_enabled": null,
"network_details": null,
"is_stored_credential": null,
"mit_category": null
}
```
<img width="1650" height="837" alt="image" src="https://github.com/user-attachments/assets/d02971d2-e598-49dd-a854-a17829cb3d59" />
<img width="543" height="49" alt="image" src="https://github.com/user-attachments/assets/95eac0ff-f57d-4594-9d4a-1dc06b1d1d57" />
Retrieve
```bash
curl --location 'https://base_url/payments/pay_N9z0Jg00H5Dynb7CSKQ0?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_zrrGPfKKd8sxgS7BmJrkv4vpl2murNtShyPc8o9YlGzuaonmYJwMMyQOdbCfCXcu'
```
```json
{
"payment_id": "pay_N9z0Jg00H5Dynb7CSKQ0",
"merchant_id": "postman_merchant_GHAction_1759750928",
"status": "succeeded",
"amount": 1500,
"net_amount": 1500,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 1500,
"connector": "paysafe",
"client_secret": "pay_N9z0Jg00H5Dynb7CSKQ0_secret_uzp2n3oQPqD0tIjdNPVU",
"created": "2025-10-06T12:22:47.738Z",
"currency": "USD",
"customer_id": "aaaa",
"customer": {
"id": "aaaa",
"name": null,
"email": null,
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "wallet",
"payment_method_data": {
"wallet": {},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "Downtown Core",
"country": "SG",
"line1": "Singapore Changi Airport. 2nd flr",
"line2": "",
"line3": "",
"zip": "039393",
"state": "Central Indiana America",
"first_name": "박성준",
"last_name": "박성준",
"origin_zip": null
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "skrill",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": "9abc1eaf-af0f-49b9-834c-afb2b12291f4",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": {
"redirect_response": null,
"search_tags": null,
"apple_pay_recurring_details": null,
"gateway_system": "direct"
},
"reference_id": null,
"payment_link": null,
"profile_id": "pro_gb3FQWk8hJtjW6FP5c6K",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_AkDHUgxUaV8R6UP65h8v",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-10-06T12:37:47.738Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_channel": null,
"payment_method_id": null,
"network_transaction_id": null,
"payment_method_status": null,
"updated": "2025-10-06T12:23:02.068Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"request_extended_authorization": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null,
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null,
"is_iframe_redirection_enabled": null,
"whole_connector_response": null,
"enable_partial_authorization": null,
"enable_overcapture": null,
"is_overcapture_enabled": null,
"network_details": null,
"is_stored_credential": null,
"mit_category": null
}
```
</details>
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `just clippy && just clippy_v2`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
v1.117.0
|
cc4eaed5702dbcaa6c54a32714b52f479dfbe85b
|
cc4eaed5702dbcaa6c54a32714b52f479dfbe85b
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9711
|
Bug: [FEATURE] loonio webhooks
### Feature Description
Implement webhook support for loonio
### Possible Implementation
Implement Webhook - Payment
### Have you spent some time checking if this feature request has been raised before?
- [x] I checked and didn't find a similar issue
### Have you read the Contributing Guidelines?
- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)
### Are you willing to submit a PR?
None
|
diff --git a/crates/hyperswitch_connectors/src/connectors/loonio.rs b/crates/hyperswitch_connectors/src/connectors/loonio.rs
index 96ee717b862..1de6f4236d4 100644
--- a/crates/hyperswitch_connectors/src/connectors/loonio.rs
+++ b/crates/hyperswitch_connectors/src/connectors/loonio.rs
@@ -2,12 +2,13 @@ pub mod transformers;
use common_enums::enums;
use common_utils::{
+ crypto::Encryptable,
errors::CustomResult,
- ext_traits::BytesExt,
+ ext_traits::{ByteSliceExt, BytesExt},
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
-use error_stack::{report, ResultExt};
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
@@ -42,7 +43,7 @@ use hyperswitch_interfaces::{
webhooks,
};
use lazy_static::lazy_static;
-use masking::{ExposeInterface, Mask};
+use masking::{ExposeInterface, Mask, Secret};
use transformers as loonio;
use crate::{constants::headers, types::ResponseRouterData, utils};
@@ -334,9 +335,9 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Loo
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
- let response: loonio::LoonioTransactionSyncResponse = res
+ let response: loonio::LoonioPaymentResponseData = res
.response
- .parse_struct("loonio LoonioTransactionSyncResponse")
+ .parse_struct("loonio LoonioPaymentResponseData")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
@@ -588,25 +589,56 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Loonio {
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Loonio {
- fn get_webhook_object_reference_id(
+ async fn verify_webhook_source(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _merchant_id: &common_utils::id_type::MerchantId,
+ _connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
+ _connector_account_details: Encryptable<Secret<serde_json::Value>>,
+ _connector_name: &str,
+ ) -> CustomResult<bool, errors::ConnectorError> {
+ Ok(false)
+ }
+
+ fn get_webhook_object_reference_id(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let webhook_body: loonio::LoonioWebhookBody = request
+ .body
+ .parse_struct("LoonioWebhookBody")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ api_models::payments::PaymentIdType::ConnectorTransactionId(
+ webhook_body.api_transaction_id,
+ ),
+ ))
}
fn get_webhook_event_type(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let webhook_body: loonio::LoonioWebhookBody = request
+ .body
+ .parse_struct("LoonioWebhookBody")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ Ok((&webhook_body.event_code).into())
}
fn get_webhook_resource_object(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let webhook_body: loonio::LoonioWebhookBody = request
+ .body
+ .parse_struct("LoonioWebhookBody")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+
+ let resource = loonio::LoonioPaymentResponseData::Webhook(webhook_body);
+
+ Ok(Box::new(resource))
}
}
@@ -614,8 +646,8 @@ lazy_static! {
static ref LOONIO_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
let supported_capture_methods = vec![enums::CaptureMethod::Automatic];
- let mut gigadat_supported_payment_methods = SupportedPaymentMethods::new();
- gigadat_supported_payment_methods.add(
+ let mut loonio_supported_payment_methods = SupportedPaymentMethods::new();
+ loonio_supported_payment_methods.add(
enums::PaymentMethod::BankRedirect,
enums::PaymentMethodType::Interac,
PaymentMethodDetails {
@@ -626,7 +658,7 @@ lazy_static! {
},
);
- gigadat_supported_payment_methods
+ loonio_supported_payment_methods
};
static ref LOONIO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
display_name: "Loonio",
@@ -634,7 +666,9 @@ lazy_static! {
connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
integration_status: enums::ConnectorIntegrationStatus::Sandbox,
};
- static ref LOONIO_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
+ static ref LOONIO_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = vec![
+ enums::EventClass::Payments,
+ ];
}
impl ConnectorSpecifications for Loonio {
diff --git a/crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs b/crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs
index 7efc1a895dc..f1c594145b6 100644
--- a/crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs
@@ -1,5 +1,6 @@
use std::collections::HashMap;
+use api_models::webhooks;
use common_enums::{enums, Currency};
use common_utils::{id_type, pii::Email, request::Method, types::FloatMajorUnit};
use hyperswitch_domain_models::{
@@ -18,7 +19,6 @@ use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{self, PaymentsAuthorizeRequestData, RouterData as _},
};
-
pub struct LoonioRouterData<T> {
pub amount: FloatMajorUnit,
pub router_data: T,
@@ -62,6 +62,8 @@ pub struct LoonioPaymentRequest {
pub payment_method_type: InteracPaymentMethodType,
#[serde(skip_serializing_if = "Option::is_none")]
pub redirect_url: Option<LoonioRedirectUrl>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub webhook_url: Option<String>,
}
#[derive(Debug, Serialize)]
@@ -102,7 +104,6 @@ impl TryFrom<&LoonioRouterData<&PaymentsAuthorizeRouterData>> for LoonioPaymentR
success_url: item.router_data.request.get_router_return_url()?,
failed_url: item.router_data.request.get_router_return_url()?,
};
-
Ok(Self {
currency_code: item.router_data.request.currency,
customer_profile,
@@ -111,6 +112,7 @@ impl TryFrom<&LoonioRouterData<&PaymentsAuthorizeRouterData>> for LoonioPaymentR
transaction_id,
payment_method_type: InteracPaymentMethodType::InteracEtransfer,
redirect_url: Some(redirect_url),
+ webhook_url: Some(item.router_data.request.get_webhook_url()?),
})
}
PaymentMethodData::BankRedirect(_) => Err(errors::ConnectorError::NotImplemented(
@@ -140,7 +142,9 @@ impl<F, T> TryFrom<ResponseRouterData<F, LoonioPaymentsResponse, T, PaymentsResp
Ok(Self {
status: enums::AttemptStatus::AuthenticationPending,
response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.payment_form.clone()),
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.data.connector_request_reference_id.clone(),
+ ),
redirection_data: Box::new(Some(RedirectForm::Form {
endpoint: item.response.payment_form,
method: Method::Get,
@@ -211,29 +215,48 @@ impl<F> TryFrom<&LoonioRouterData<&RefundsRouterData<F>>> for LoonioRefundReques
}
}
-impl<F, T> TryFrom<ResponseRouterData<F, LoonioTransactionSyncResponse, T, PaymentsResponseData>>
+impl<F, T> TryFrom<ResponseRouterData<F, LoonioPaymentResponseData, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: ResponseRouterData<F, LoonioTransactionSyncResponse, T, PaymentsResponseData>,
+ item: ResponseRouterData<F, LoonioPaymentResponseData, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- status: enums::AttemptStatus::from(item.response.state),
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(
- item.response.transaction_id.clone(),
- ),
- redirection_data: Box::new(None),
- mandate_reference: Box::new(None),
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- charges: None,
+ match item.response {
+ LoonioPaymentResponseData::Sync(sync_response) => Ok(Self {
+ status: enums::AttemptStatus::from(sync_response.state),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(sync_response.transaction_id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
}),
- ..item.data
- })
+ LoonioPaymentResponseData::Webhook(webhook_body) => {
+ let payment_status = enums::AttemptStatus::from(&webhook_body.event_code);
+ Ok(Self {
+ status: payment_status,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ webhook_body.api_transaction_id,
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+ }
}
}
@@ -303,3 +326,94 @@ pub struct LoonioErrorResponse {
pub error_code: Option<String>,
pub message: String,
}
+
+// Webhook related structs
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum LoonioWebhookEventCode {
+ TransactionPrepared,
+ TransactionPending,
+ TransactionAvailable,
+ TransactionSettled,
+ TransactionFailed,
+ TransactionRejected,
+ #[serde(rename = "TRANSACTION_WAITING_STATUS_FILE")]
+ TransactionWaitingStatusFile,
+ #[serde(rename = "TRANSACTION_STATUS_FILE_RECEIVED")]
+ TransactionStatusFileReceived,
+ #[serde(rename = "TRANSACTION_STATUS_FILE_FAILED")]
+ TransactionStatusFileFailed,
+ #[serde(rename = "TRANSACTION_RETURNED")]
+ TransactionReturned,
+ #[serde(rename = "TRANSACTION_WRONG_DESTINATION")]
+ TransactionWrongDestination,
+ #[serde(rename = "TRANSACTION_NSF")]
+ TransactionNsf,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum LoonioWebhookTransactionType {
+ Incoming,
+ OutgoingVerified,
+ OutgoingNotVerified,
+ OutgoingCustomerDefined,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct LoonioWebhookBody {
+ pub amount: FloatMajorUnit,
+ pub api_transaction_id: String,
+ pub signature: Option<String>,
+ pub event_code: LoonioWebhookEventCode,
+ pub id: i32,
+ #[serde(rename = "type")]
+ pub transaction_type: LoonioWebhookTransactionType,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum LoonioPaymentResponseData {
+ Sync(LoonioTransactionSyncResponse),
+ Webhook(LoonioWebhookBody),
+}
+impl From<&LoonioWebhookEventCode> for webhooks::IncomingWebhookEvent {
+ fn from(event_code: &LoonioWebhookEventCode) -> Self {
+ match event_code {
+ LoonioWebhookEventCode::TransactionSettled
+ | LoonioWebhookEventCode::TransactionAvailable => Self::PaymentIntentSuccess,
+ LoonioWebhookEventCode::TransactionPending
+ | LoonioWebhookEventCode::TransactionPrepared => Self::PaymentIntentProcessing,
+ LoonioWebhookEventCode::TransactionFailed
+ // deprecated
+ | LoonioWebhookEventCode::TransactionRejected
+ | LoonioWebhookEventCode::TransactionStatusFileFailed
+ | LoonioWebhookEventCode::TransactionReturned
+ | LoonioWebhookEventCode::TransactionWrongDestination
+ | LoonioWebhookEventCode::TransactionNsf => Self::PaymentIntentFailure,
+ _ => Self::EventNotSupported,
+ }
+ }
+}
+
+impl From<&LoonioWebhookEventCode> for enums::AttemptStatus {
+ fn from(event_code: &LoonioWebhookEventCode) -> Self {
+ match event_code {
+ LoonioWebhookEventCode::TransactionSettled
+ | LoonioWebhookEventCode::TransactionAvailable => Self::Charged,
+
+ LoonioWebhookEventCode::TransactionPending
+ | LoonioWebhookEventCode::TransactionPrepared => Self::Pending,
+
+ LoonioWebhookEventCode::TransactionFailed
+ | LoonioWebhookEventCode::TransactionRejected
+ | LoonioWebhookEventCode::TransactionStatusFileFailed
+ | LoonioWebhookEventCode::TransactionReturned
+ | LoonioWebhookEventCode::TransactionWrongDestination
+ | LoonioWebhookEventCode::TransactionNsf => Self::Failure,
+
+ _ => Self::Pending,
+ }
+ }
+}
|
2025-10-07T09:18:54Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
Loomio webhooks for payments
## payment request
```json
{
"amount": 1500,
"currency": "CAD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "aaaa",
"authentication_type": "three_ds",
"payment_method": "bank_redirect",
"payment_method_type": "interac",
"payment_method_data": {
"bank_redirect": {
"interac": {}
}
},
"billing": {
"address": {
"line1": "Singapore Changi Airport. 2nd flr",
"line2": "",
"line3": "",
"city": "Downtown Core",
"state": "Central Indiana America",
"zip": "039393",
"country": "SG",
"first_name": "Swangi",
"last_name": "Kumari"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
}
}
```
## response
```json
{
"payment_id": "pay_J3xaVGqCX1QbnGKyQoCQ",
"merchant_id": "merchant_1759821555",
"status": "requires_customer_action",
"amount": 1500,
"net_amount": 1500,
"shipping_cost": null,
"amount_capturable": 1500,
"amount_received": null,
"connector": "loonio",
"client_secret": "pay_J3xaVGqCX1QbnGKyQoCQ_secret_IfvZo54PdakCzmi10muX",
"created": "2025-10-07T09:15:47.349Z",
"currency": "CAD",
"customer_id": "aaaa",
"customer": {
"id": "aaaa",
"name": null,
"email": null,
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "bank_redirect",
"payment_method_data": {
"bank_redirect": {
"type": "BankRedirectResponse",
"bank_name": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "Downtown Core",
"country": "SG",
"line1": "Singapore Changi Airport. 2nd flr",
"line2": "",
"line3": "",
"zip": "039393",
"state": "Central Indiana America",
"first_name": "Swangi",
"last_name": "Kumari",
"origin_zip": null
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_J3xaVGqCX1QbnGKyQoCQ/merchant_1759821555/pay_J3xaVGqCX1QbnGKyQoCQ_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "interac",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "aaaa",
"created_at": 1759828547,
"expires": 1759832147,
"secret": "epk_dfb1c2f173f34c4da48ee0a98d48051f"
},
"manual_retry_allowed": null,
"connector_transaction_id": "pay_J3xaVGqCX1QbnGKyQoCQ_1",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": {
"redirect_response": null,
"search_tags": null,
"apple_pay_recurring_details": null,
"gateway_system": "direct"
},
"reference_id": null,
"payment_link": null,
"profile_id": "pro_MLEtbytGk3haqiqlaheV",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_UKE4wkdWmZVIs8oRKgbo",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-10-07T09:30:47.349Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "127.0.0.1",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_channel": null,
"payment_method_id": null,
"network_transaction_id": null,
"payment_method_status": null,
"updated": "2025-10-07T09:15:48.782Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"request_extended_authorization": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null,
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null,
"is_iframe_redirection_enabled": null,
"whole_connector_response": null,
"enable_partial_authorization": null,
"enable_overcapture": null,
"is_overcapture_enabled": null,
"network_details": null,
"is_stored_credential": null,
"mit_category": null
}
```
## make redirect
<img width="1708" height="1115" alt="Screenshot 2025-10-07 at 2 47 11 PM" src="https://github.com/user-attachments/assets/35ea68fa-8b86-48ef-9600-64916ebdaf2b" />
## the status will change when webhook reaches without force psync
<img width="1178" height="678" alt="Screenshot 2025-10-07 at 2 47 43 PM" src="https://github.com/user-attachments/assets/254d2a5f-eab1-4b15-988a-a353338d1536" />
## webhook source verificaiton = false
<img width="1085" height="311" alt="Screenshot 2025-10-07 at 6 15 09 PM" src="https://github.com/user-attachments/assets/0f21632f-0927-47ac-95b4-4593dcbb1633" />
<img width="648" height="246" alt="Screenshot 2025-10-07 at 6 15 21 PM" src="https://github.com/user-attachments/assets/1871af58-ce58-4c78-97d3-7c1502ab77ba" />
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
v1.117.0
|
b3beda7d7172396452e34858cb6bd701962f75ab
|
b3beda7d7172396452e34858cb6bd701962f75ab
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9693
|
Bug: Add support to update card exp in update payment methods api
1. Need support to update card expiry in payments method data of payment methods table using batch pm update API.
2. Need support to pass multiple mca ids for updating payment methods entries.
|
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 591932c5deb..cfb45ef045c 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -294,6 +294,7 @@ pub struct PaymentMethodRecordUpdateResponse {
pub status: common_enums::PaymentMethodStatus,
pub network_transaction_id: Option<String>,
pub connector_mandate_details: Option<pii::SecretSerdeValue>,
+ pub updated_payment_method_data: Option<bool>,
}
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
@@ -2689,7 +2690,9 @@ pub struct UpdatePaymentMethodRecord {
pub network_transaction_id: Option<String>,
pub line_number: Option<i64>,
pub payment_instrument_id: Option<masking::Secret<String>>,
- pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
+ pub merchant_connector_ids: Option<String>,
+ pub card_expiry_month: Option<masking::Secret<String>>,
+ pub card_expiry_year: Option<masking::Secret<String>>,
}
#[derive(Debug, serde::Serialize)]
@@ -2701,6 +2704,7 @@ pub struct PaymentMethodUpdateResponse {
pub update_status: UpdateStatus,
#[serde(skip_serializing_if = "Option::is_none")]
pub update_error: Option<String>,
+ pub updated_payment_method_data: Option<bool>,
pub line_number: Option<i64>,
}
@@ -2841,6 +2845,7 @@ impl From<PaymentMethodUpdateResponseType> for PaymentMethodUpdateResponse {
status: Some(res.status),
network_transaction_id: res.network_transaction_id,
connector_mandate_details: res.connector_mandate_details,
+ updated_payment_method_data: res.updated_payment_method_data,
update_status: UpdateStatus::Success,
update_error: None,
line_number: record.line_number,
@@ -2850,6 +2855,7 @@ impl From<PaymentMethodUpdateResponseType> for PaymentMethodUpdateResponse {
status: record.status,
network_transaction_id: record.network_transaction_id,
connector_mandate_details: None,
+ updated_payment_method_data: None,
update_status: UpdateStatus::Failed,
update_error: Some(e),
line_number: record.line_number,
diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rs
index 747c6fdbd39..edadeea7990 100644
--- a/crates/diesel_models/src/payment_method.rs
+++ b/crates/diesel_models/src/payment_method.rs
@@ -251,10 +251,11 @@ pub enum PaymentMethodUpdate {
connector_mandate_details: Option<pii::SecretSerdeValue>,
network_transaction_id: Option<Secret<String>>,
},
- ConnectorNetworkTransactionIdStatusAndMandateDetailsUpdate {
+ PaymentMethodBatchUpdate {
connector_mandate_details: Option<pii::SecretSerdeValue>,
network_transaction_id: Option<String>,
status: Option<storage_enums::PaymentMethodStatus>,
+ payment_method_data: Option<Encryption>,
},
}
@@ -687,13 +688,13 @@ impl From<PaymentMethodUpdate> for PaymentMethodUpdateInternal {
network_token_payment_method_data: None,
scheme: None,
},
- PaymentMethodUpdate::ConnectorNetworkTransactionIdStatusAndMandateDetailsUpdate {
+ PaymentMethodUpdate::PaymentMethodBatchUpdate {
connector_mandate_details,
network_transaction_id,
status,
+ payment_method_data,
} => Self {
metadata: None,
- payment_method_data: None,
last_used_at: None,
status,
locker_id: None,
@@ -709,6 +710,7 @@ impl From<PaymentMethodUpdate> for PaymentMethodUpdateInternal {
network_token_locker_id: None,
network_token_payment_method_data: None,
scheme: None,
+ payment_method_data,
},
}
}
diff --git a/crates/payment_methods/src/core/migration.rs b/crates/payment_methods/src/core/migration.rs
index ea9b6db1036..c077ddb2cfa 100644
--- a/crates/payment_methods/src/core/migration.rs
+++ b/crates/payment_methods/src/core/migration.rs
@@ -77,10 +77,10 @@ pub struct PaymentMethodsMigrateForm {
pub merchant_connector_ids: Option<text::Text<String>>,
}
-struct MerchantConnectorValidator;
+pub struct MerchantConnectorValidator;
impl MerchantConnectorValidator {
- fn parse_comma_separated_ids(
+ pub fn parse_comma_separated_ids(
ids_string: &str,
) -> Result<Vec<common_utils::id_type::MerchantConnectorAccountId>, errors::ApiErrorResponse>
{
diff --git a/crates/router/src/core/payment_methods/migration.rs b/crates/router/src/core/payment_methods/migration.rs
index d802e432ec1..26a2d1737cb 100644
--- a/crates/router/src/core/payment_methods/migration.rs
+++ b/crates/router/src/core/payment_methods/migration.rs
@@ -7,12 +7,15 @@ use hyperswitch_domain_models::{
api::ApplicationResponse, errors::api_error_response as errors, merchant_context,
payment_methods::PaymentMethodUpdate,
};
-use masking::PeekInterface;
+use masking::{ExposeInterface, PeekInterface};
+use payment_methods::core::migration::MerchantConnectorValidator;
use rdkafka::message::ToBytes;
use router_env::logger;
-use crate::{core::errors::StorageErrorExt, routes::SessionState};
-
+use crate::{
+ core::{errors::StorageErrorExt, payment_methods::cards::create_encrypted_data},
+ routes::SessionState,
+};
type PmMigrationResult<T> = CustomResult<ApplicationResponse<T>, errors::ApiErrorResponse>;
#[cfg(feature = "v1")]
@@ -62,6 +65,8 @@ pub async fn update_payment_method_record(
let payment_method_id = req.payment_method_id.clone();
let network_transaction_id = req.network_transaction_id.clone();
let status = req.status;
+ let key_manager_state = state.into();
+ let mut updated_card_expiry = false;
let payment_method = db
.find_payment_method(
@@ -79,94 +84,143 @@ pub async fn update_payment_method_record(
}.into());
}
- // Process mandate details when both payment_instrument_id and merchant_connector_id are present
- let pm_update = match (&req.payment_instrument_id, &req.merchant_connector_id) {
- (Some(payment_instrument_id), Some(merchant_connector_id)) => {
+ let updated_payment_method_data = match payment_method.payment_method_data.as_ref() {
+ Some(data) => {
+ match serde_json::from_value::<pm_api::PaymentMethodsData>(
+ data.clone().into_inner().expose(),
+ ) {
+ Ok(pm_api::PaymentMethodsData::Card(mut card_data)) => {
+ if let Some(new_month) = &req.card_expiry_month {
+ card_data.expiry_month = Some(new_month.clone());
+ updated_card_expiry = true;
+ }
+
+ if let Some(new_year) = &req.card_expiry_year {
+ card_data.expiry_year = Some(new_year.clone());
+ updated_card_expiry = true;
+ }
+
+ if updated_card_expiry {
+ Some(
+ create_encrypted_data(
+ &key_manager_state,
+ merchant_context.get_merchant_key_store(),
+ pm_api::PaymentMethodsData::Card(card_data),
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to encrypt payment method data")
+ .map(Into::into),
+ )
+ } else {
+ None
+ }
+ }
+ _ => None,
+ }
+ }
+ None => None,
+ }
+ .transpose()?;
+
+ // Process mandate details when both payment_instrument_id and merchant_connector_ids are present
+ let pm_update = match (
+ &req.payment_instrument_id,
+ &req.merchant_connector_ids.clone(),
+ ) {
+ (Some(payment_instrument_id), Some(merchant_connector_ids)) => {
+ let parsed_mca_ids =
+ MerchantConnectorValidator::parse_comma_separated_ids(merchant_connector_ids)?;
let mandate_details = payment_method
.get_common_mandate_reference()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to deserialize to Payment Mandate Reference ")?;
- let mca = db
- .find_by_merchant_connector_account_merchant_id_merchant_connector_id(
- &state.into(),
- merchant_context.get_merchant_account().get_id(),
- merchant_connector_id,
- merchant_context.get_merchant_key_store(),
- )
- .await
- .to_not_found_response(
- errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id.get_string_repr().to_string(),
- },
- )?;
+ let mut existing_payments_mandate = mandate_details
+ .payments
+ .clone()
+ .unwrap_or(PaymentsMandateReference(HashMap::new()));
+ let mut existing_payouts_mandate = mandate_details
+ .payouts
+ .clone()
+ .unwrap_or(PayoutsMandateReference(HashMap::new()));
- let updated_connector_mandate_details = match mca.connector_type {
- enums::ConnectorType::PayoutProcessor => {
- // Handle PayoutsMandateReference
- let mut existing_payouts_mandate = mandate_details
- .payouts
- .unwrap_or_else(|| PayoutsMandateReference(HashMap::new()));
+ for merchant_connector_id in parsed_mca_ids {
+ let mca = db
+ .find_by_merchant_connector_account_merchant_id_merchant_connector_id(
+ &state.into(),
+ merchant_context.get_merchant_account().get_id(),
+ &merchant_connector_id,
+ merchant_context.get_merchant_key_store(),
+ )
+ .await
+ .to_not_found_response(
+ errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+ id: merchant_connector_id.get_string_repr().to_string(),
+ },
+ )?;
- // Create new payout mandate record
- let new_payout_record = PayoutsMandateReferenceRecord {
- transfer_method_id: Some(payment_instrument_id.peek().to_string()),
- };
+ match mca.connector_type {
+ enums::ConnectorType::PayoutProcessor => {
+ // Handle PayoutsMandateReference
+ let new_payout_record = PayoutsMandateReferenceRecord {
+ transfer_method_id: Some(payment_instrument_id.peek().to_string()),
+ };
- // Check if record exists for this merchant_connector_id
- if let Some(existing_record) =
- existing_payouts_mandate.0.get_mut(merchant_connector_id)
- {
- if let Some(transfer_method_id) = &new_payout_record.transfer_method_id {
- existing_record.transfer_method_id = Some(transfer_method_id.clone());
+ // Check if record exists for this merchant_connector_id
+ if let Some(existing_record) =
+ existing_payouts_mandate.0.get_mut(&merchant_connector_id)
+ {
+ if let Some(transfer_method_id) = &new_payout_record.transfer_method_id
+ {
+ existing_record.transfer_method_id =
+ Some(transfer_method_id.clone());
+ }
+ } else {
+ // Insert new record in connector_mandate_details
+ existing_payouts_mandate
+ .0
+ .insert(merchant_connector_id.clone(), new_payout_record);
}
- } else {
- // Insert new record in connector_mandate_details
- existing_payouts_mandate
- .0
- .insert(merchant_connector_id.clone(), new_payout_record);
}
-
- // Create updated CommonMandateReference preserving payments section
- CommonMandateReference {
- payments: mandate_details.payments,
- payouts: Some(existing_payouts_mandate),
+ _ => {
+ // Handle PaymentsMandateReference
+ // Check if record exists for this merchant_connector_id
+ if let Some(existing_record) =
+ existing_payments_mandate.0.get_mut(&merchant_connector_id)
+ {
+ existing_record.connector_mandate_id =
+ payment_instrument_id.peek().to_string();
+ } else {
+ // Insert new record in connector_mandate_details
+ existing_payments_mandate.0.insert(
+ merchant_connector_id.clone(),
+ PaymentsMandateReferenceRecord {
+ connector_mandate_id: payment_instrument_id.peek().to_string(),
+ payment_method_type: None,
+ original_payment_authorized_amount: None,
+ original_payment_authorized_currency: None,
+ mandate_metadata: None,
+ connector_mandate_status: None,
+ connector_mandate_request_reference_id: None,
+ },
+ );
+ }
}
}
- _ => {
- // Handle PaymentsMandateReference
- let mut existing_payments_mandate = mandate_details
- .payments
- .unwrap_or_else(|| PaymentsMandateReference(HashMap::new()));
-
- // Check if record exists for this merchant_connector_id
- if let Some(existing_record) =
- existing_payments_mandate.0.get_mut(merchant_connector_id)
- {
- existing_record.connector_mandate_id =
- payment_instrument_id.peek().to_string();
- } else {
- // Insert new record in connector_mandate_details
- existing_payments_mandate.0.insert(
- merchant_connector_id.clone(),
- PaymentsMandateReferenceRecord {
- connector_mandate_id: payment_instrument_id.peek().to_string(),
- payment_method_type: None,
- original_payment_authorized_amount: None,
- original_payment_authorized_currency: None,
- mandate_metadata: None,
- connector_mandate_status: None,
- connector_mandate_request_reference_id: None,
- },
- );
- }
+ }
- // Create updated CommonMandateReference preserving payouts section
- CommonMandateReference {
- payments: Some(existing_payments_mandate),
- payouts: mandate_details.payouts,
- }
- }
+ let updated_connector_mandate_details = CommonMandateReference {
+ payments: if !existing_payments_mandate.0.is_empty() {
+ Some(existing_payments_mandate)
+ } else {
+ mandate_details.payments
+ },
+ payouts: if !existing_payouts_mandate.0.is_empty() {
+ Some(existing_payouts_mandate)
+ } else {
+ mandate_details.payouts
+ },
};
let connector_mandate_details_value = updated_connector_mandate_details
@@ -176,19 +230,25 @@ pub async fn update_payment_method_record(
errors::ApiErrorResponse::MandateUpdateFailed
})?;
- PaymentMethodUpdate::ConnectorNetworkTransactionIdStatusAndMandateDetailsUpdate {
+ PaymentMethodUpdate::PaymentMethodBatchUpdate {
connector_mandate_details: Some(pii::SecretSerdeValue::new(
connector_mandate_details_value,
)),
network_transaction_id,
status,
+ payment_method_data: updated_payment_method_data.clone(),
}
}
_ => {
- // Update only network_transaction_id and status
- PaymentMethodUpdate::NetworkTransactionIdAndStatusUpdate {
- network_transaction_id,
- status,
+ if updated_payment_method_data.is_some() {
+ PaymentMethodUpdate::PaymentMethodDataUpdate {
+ payment_method_data: updated_payment_method_data,
+ }
+ } else {
+ PaymentMethodUpdate::NetworkTransactionIdAndStatusUpdate {
+ network_transaction_id,
+ status,
+ }
}
}
};
@@ -217,6 +277,7 @@ pub async fn update_payment_method_record(
connector_mandate_details: response
.connector_mandate_details
.map(pii::SecretSerdeValue::new),
+ updated_payment_method_data: Some(updated_card_expiry),
},
))
}
|
2025-10-06T12:49:07Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
We can update card expiry in payments method data of payment methods table using batch pm update API>
Added support to pass multiple mca ids for updating payment methods entry.
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Curls:
```
curl --location 'http://localhost:8080/payment_methods/update-batch' \
--header 'api-key: test_admin' \
--form 'file=@"/Users/mrudul.vajpayee/Downloads/update_check.csv"' \
--form 'merchant_id="merchant_1759727351"'
```
Response:
```
[{"payment_method_id":"pm_lGbP1ZvFLblFT3DafY5L","status":"active","network_transaction_id":null,"connector_mandate_details":{"payouts":{"mca_5hGHfrn1BYGHjse3VT6f":{"transfer_method_id":"yPNWMjhW4h5LmWJYYY"}},"mca_pwD3i1oyHLxzcu9cq1xR":{"mandate_metadata":null,"payment_method_type":"credit","connector_mandate_id":"yPNWMjhW4h5LmWJYYY","connector_mandate_status":"active","original_payment_authorized_amount":3545,"original_payment_authorized_currency":"EUR","connector_mandate_request_reference_id":"LtkxiLx5mDw1p8uLmD"}},"update_status":"Success","updated_payment_method_data":true,"line_number":1}]
```
File used for above:
[update_check.csv](https://github.com/user-attachments/files/22723044/update_check.csv)
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
v1.117.0
|
c172f03c31e9b29b69490c7c5dfb3b4c78206f79
|
c172f03c31e9b29b69490c7c5dfb3b4c78206f79
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9631
|
Bug: [FEATURE]: [Nuvei] add payout flows
Add Cards Payout through Nuvei
Add Webhook support for Payouts in Nuvei
Propagate error from failure response in payouts
Create webhook_url in PayoutsData Request to pass to Psp's
|
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 6ac0ad192b1..42443a3cf40 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -26605,6 +26605,7 @@
"cybersource",
"ebanx",
"nomupay",
+ "nuvei",
"payone",
"paypal",
"stripe",
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 523732de9e5..3c04e9af7e7 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -20717,6 +20717,7 @@
"cybersource",
"ebanx",
"nomupay",
+ "nuvei",
"payone",
"paypal",
"stripe",
diff --git a/config/config.example.toml b/config/config.example.toml
index 56da591f1fc..b3c5de5f5e0 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -742,6 +742,10 @@ apple_pay = { country = "AU,AT,BY,BE,BR,BG,CA,CN,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,G
google_pay = { country = "AF,AX,AL,DZ,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,KH,CM,CA,CV,KY,CF,TD,CL,CN,TW,CX,CC,CO,KM,CG,CK,CR,CI,HR,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VI,VC,WS,SM,ST,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,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,XOF,YER,ZAR" }
+
[pm_filters.stax]
credit = { country = "US", currency = "USD" }
debit = { country = "US", currency = "USD" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 02ee0124bae..f853f7578f8 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -561,6 +561,10 @@ apple_pay = { country = "AU,AT,BY,BE,BR,BG,CA,CN,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,G
google_pay = { country = "AF,AX,AL,DZ,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,KH,CM,CA,CV,KY,CF,TD,CL,CN,TW,CX,CC,CO,KM,CG,CK,CR,CI,HR,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VI,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SK,SI,SB,SO,ZA,GS,KR,ES,LK,SR,SJ,SZ,SE,CH,TW,TJ,TZ,TH,TL,TG,TK,TO,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,USD,UYU,UZS,VND,XAF,XOF,YER,ZAR" }
+
[pm_filters.nexixpay]
credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU,AU,BR,US", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU,AU,BR,US", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 998986b3829..c5b5fe4baef 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -478,6 +478,9 @@ apple_pay = { country = "AU,AT,BY,BE,BR,BG,CA,CN,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,G
google_pay = { country = "AF,AX,AL,DZ,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,KH,CM,CA,CV,KY,CF,TD,CL,CN,TW,CX,CC,CO,KM,CG,CK,CR,CI,HR,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER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ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US",currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,XOF,YER,ZAR" }
[pm_filters.nexixpay]
credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU,AU,BR,US", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 3f16af80c6f..61df894c384 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -541,6 +541,10 @@ apple_pay = { country = "AU,AT,BY,BE,BR,BG,CA,CN,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,G
google_pay = { country = "AF,AX,AL,DZ,AD,AO,AI,AQ,AG,AR,A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ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US",currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,XOF,YER,ZAR" }
+
[pm_filters.globepay]
ali_pay = { country = "GB",currency = "GBP,CNY" }
we_chat_pay = { country = "GB",currency = "CNY" }
diff --git a/config/development.toml b/config/development.toml
index c15532805db..32ef78e0ded 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -662,6 +662,9 @@ apple_pay = { country = "AU,AT,BY,BE,BR,BG,CA,CN,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,G
google_pay = { country = "AF,AX,AL,DZ,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,KH,CM,CA,CV,KY,CF,TD,CL,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,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 0b4d53c1857..edc6bf78759 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -49,6 +49,7 @@ pub enum PayoutConnectors {
Cybersource,
Ebanx,
Nomupay,
+ Nuvei,
Payone,
Paypal,
Stripe,
@@ -75,6 +76,7 @@ impl From<PayoutConnectors> for RoutableConnectors {
PayoutConnectors::Cybersource => Self::Cybersource,
PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Nomupay => Self::Nomupay,
+ PayoutConnectors::Nuvei => Self::Nuvei,
PayoutConnectors::Payone => Self::Payone,
PayoutConnectors::Paypal => Self::Paypal,
PayoutConnectors::Stripe => Self::Stripe,
@@ -92,6 +94,7 @@ impl From<PayoutConnectors> for Connector {
PayoutConnectors::Cybersource => Self::Cybersource,
PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Nomupay => Self::Nomupay,
+ PayoutConnectors::Nuvei => Self::Nuvei,
PayoutConnectors::Payone => Self::Payone,
PayoutConnectors::Paypal => Self::Paypal,
PayoutConnectors::Stripe => Self::Stripe,
@@ -109,6 +112,7 @@ impl TryFrom<Connector> for PayoutConnectors {
Connector::Adyenplatform => Ok(Self::Adyenplatform),
Connector::Cybersource => Ok(Self::Cybersource),
Connector::Ebanx => Ok(Self::Ebanx),
+ Connector::Nuvei => Ok(Self::Nuvei),
Connector::Nomupay => Ok(Self::Nomupay),
Connector::Payone => Ok(Self::Payone),
Connector::Paypal => Ok(Self::Paypal),
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index aed9dbf70de..d35ddc09b25 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -308,6 +308,7 @@ pub struct ConnectorConfig {
pub noon: Option<ConnectorTomlConfig>,
pub nordea: Option<ConnectorTomlConfig>,
pub novalnet: Option<ConnectorTomlConfig>,
+ pub nuvei_payout: Option<ConnectorTomlConfig>,
pub nuvei: Option<ConnectorTomlConfig>,
pub paybox: Option<ConnectorTomlConfig>,
pub payload: Option<ConnectorTomlConfig>,
@@ -398,6 +399,7 @@ impl ConnectorConfig {
PayoutConnectors::Cybersource => Ok(connector_data.cybersource_payout),
PayoutConnectors::Ebanx => Ok(connector_data.ebanx_payout),
PayoutConnectors::Nomupay => Ok(connector_data.nomupay_payout),
+ PayoutConnectors::Nuvei => Ok(connector_data.nuvei_payout),
PayoutConnectors::Payone => Ok(connector_data.payone_payout),
PayoutConnectors::Paypal => Ok(connector_data.paypal_payout),
PayoutConnectors::Stripe => Ok(connector_data.stripe_payout),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 4b4bbc6ec83..2c79270cb16 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -3781,7 +3781,49 @@ required=true
type="MultiSelect"
options=["PAN_ONLY", "CRYPTOGRAM_3DS"]
-
+[nuvei_payout]
+[[nuvei_payout.credit]]
+ payment_method_type = "Mastercard"
+[[nuvei_payout.credit]]
+ payment_method_type = "Visa"
+[[nuvei_payout.credit]]
+ payment_method_type = "Interac"
+[[nuvei_payout.credit]]
+ payment_method_type = "AmericanExpress"
+[[nuvei_payout.credit]]
+ payment_method_type = "JCB"
+[[nuvei_payout.credit]]
+ payment_method_type = "DinersClub"
+[[nuvei_payout.credit]]
+ payment_method_type = "Discover"
+[[nuvei_payout.credit]]
+ payment_method_type = "CartesBancaires"
+[[nuvei_payout.credit]]
+ payment_method_type = "UnionPay"
+[[nuvei_payout.debit]]
+ payment_method_type = "Mastercard"
+[[nuvei_payout.debit]]
+ payment_method_type = "Visa"
+[[nuvei_payout.debit]]
+ payment_method_type = "Interac"
+[[nuvei_payout.debit]]
+ payment_method_type = "AmericanExpress"
+[[nuvei_payout.debit]]
+ payment_method_type = "JCB"
+[[nuvei_payout.debit]]
+ payment_method_type = "DinersClub"
+[[nuvei_payout.debit]]
+ payment_method_type = "Discover"
+[[nuvei_payout.debit]]
+ payment_method_type = "CartesBancaires"
+[[nuvei_payout.debit]]
+ payment_method_type = "UnionPay"
+[nuvei_payout.connector_auth.SignatureKey]
+api_key="Merchant ID"
+key1="Merchant Site ID"
+api_secret="Merchant Secret"
+[nuvei_payout.connector_webhook_details]
+merchant_secret="Source verification key"
[opennode]
[[opennode.crypto]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 86eea4d3534..d65208a74b7 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -2908,6 +2908,49 @@ required = true
type = "Radio"
options = ["Connector","Hyperswitch"]
+[nuvei_payout]
+[[nuvei_payout.credit]]
+ payment_method_type = "Mastercard"
+[[nuvei_payout.credit]]
+ payment_method_type = "Visa"
+[[nuvei_payout.credit]]
+ payment_method_type = "Interac"
+[[nuvei_payout.credit]]
+ payment_method_type = "AmericanExpress"
+[[nuvei_payout.credit]]
+ payment_method_type = "JCB"
+[[nuvei_payout.credit]]
+ payment_method_type = "DinersClub"
+[[nuvei_payout.credit]]
+ payment_method_type = "Discover"
+[[nuvei_payout.credit]]
+ payment_method_type = "CartesBancaires"
+[[nuvei_payout.credit]]
+ payment_method_type = "UnionPay"
+[[nuvei_payout.debit]]
+ payment_method_type = "Mastercard"
+[[nuvei_payout.debit]]
+ payment_method_type = "Visa"
+[[nuvei_payout.debit]]
+ payment_method_type = "Interac"
+[[nuvei_payout.debit]]
+ payment_method_type = "AmericanExpress"
+[[nuvei_payout.debit]]
+ payment_method_type = "JCB"
+[[nuvei_payout.debit]]
+ payment_method_type = "DinersClub"
+[[nuvei_payout.debit]]
+ payment_method_type = "Discover"
+[[nuvei_payout.debit]]
+ payment_method_type = "CartesBancaires"
+[[nuvei_payout.debit]]
+ payment_method_type = "UnionPay"
+[nuvei_payout.connector_auth.SignatureKey]
+api_key="Merchant ID"
+key1="Merchant Site ID"
+api_secret="Merchant Secret"
+[nuvei_payout.connector_webhook_details]
+merchant_secret="Source verification key"
[opennode]
[[opennode.crypto]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 08ae831a52e..e99620c8892 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -3754,6 +3754,49 @@ required = true
type = "MultiSelect"
options = ["PAN_ONLY", "CRYPTOGRAM_3DS"]
+[nuvei_payout]
+[[nuvei_payout.credit]]
+ payment_method_type = "Mastercard"
+[[nuvei_payout.credit]]
+ payment_method_type = "Visa"
+[[nuvei_payout.credit]]
+ payment_method_type = "Interac"
+[[nuvei_payout.credit]]
+ payment_method_type = "AmericanExpress"
+[[nuvei_payout.credit]]
+ payment_method_type = "JCB"
+[[nuvei_payout.credit]]
+ payment_method_type = "DinersClub"
+[[nuvei_payout.credit]]
+ payment_method_type = "Discover"
+[[nuvei_payout.credit]]
+ payment_method_type = "CartesBancaires"
+[[nuvei_payout.credit]]
+ payment_method_type = "UnionPay"
+[[nuvei_payout.debit]]
+ payment_method_type = "Mastercard"
+[[nuvei_payout.debit]]
+ payment_method_type = "Visa"
+[[nuvei_payout.debit]]
+ payment_method_type = "Interac"
+[[nuvei_payout.debit]]
+ payment_method_type = "AmericanExpress"
+[[nuvei_payout.debit]]
+ payment_method_type = "JCB"
+[[nuvei_payout.debit]]
+ payment_method_type = "DinersClub"
+[[nuvei_payout.debit]]
+ payment_method_type = "Discover"
+[[nuvei_payout.debit]]
+ payment_method_type = "CartesBancaires"
+[[nuvei_payout.debit]]
+ payment_method_type = "UnionPay"
+[nuvei_payout.connector_auth.SignatureKey]
+api_key="Merchant ID"
+key1="Merchant Site ID"
+api_secret="Merchant Secret"
+[nuvei_payout.connector_webhook_details]
+merchant_secret="Source verification key"
[opennode]
[[opennode.crypto]]
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
index 4dd8973bd63..d6a0e677cf3 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
@@ -1,6 +1,8 @@
pub mod transformers;
use std::sync::LazyLock;
+#[cfg(feature = "payouts")]
+use api_models::webhooks::PayoutIdType;
use api_models::{
payments::PaymentIdType,
webhooks::{IncomingWebhookEvent, RefundIdType},
@@ -44,6 +46,11 @@ use hyperswitch_domain_models::{
PaymentsSyncRouterData, RefundsRouterData,
},
};
+#[cfg(feature = "payouts")]
+use hyperswitch_domain_models::{
+ router_flow_types::payouts::PoFulfill, router_request_types::PayoutsData,
+ router_response_types::PayoutsResponseData, types::PayoutsRouterData,
+};
use hyperswitch_interfaces::{
api::{
self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,
@@ -164,6 +171,87 @@ impl api::ConnectorAccessToken for Nuvei {}
impl api::PaymentsPreProcessing for Nuvei {}
impl api::PaymentPostCaptureVoid for Nuvei {}
+impl api::Payouts for Nuvei {}
+#[cfg(feature = "payouts")]
+impl api::PayoutFulfill for Nuvei {}
+
+#[async_trait::async_trait]
+#[cfg(feature = "payouts")]
+impl ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> for Nuvei {
+ fn get_url(
+ &self,
+ _req: &PayoutsRouterData<PoFulfill>,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!(
+ "{}ppp/api/v1/payout.do",
+ ConnectorCommon::base_url(self, connectors)
+ ))
+ }
+
+ fn get_headers(
+ &self,
+ req: &PayoutsRouterData<PoFulfill>,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PayoutsRouterData<PoFulfill>,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = nuvei::NuveiPayoutRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PayoutsRouterData<PoFulfill>,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ let request = RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PayoutFulfillType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PayoutFulfillType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PayoutFulfillType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PayoutsRouterData<PoFulfill>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PayoutsRouterData<PoFulfill>, errors::ConnectorError> {
+ let response: nuvei::NuveiPayoutResponse =
+ res.response.parse_struct("NuveiPayoutResponse").switch()?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Nuvei {
fn get_headers(
&self,
@@ -1025,6 +1113,15 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Nuvei {
}
}
+fn has_payout_prefix(id_option: &Option<String>) -> bool {
+ // - Default value returns false if the Option is `None`.
+ // - The argument is a closure that runs if the Option is `Some`.
+ // It takes the contained value (`s`) and its result is returned.
+ id_option
+ .as_deref()
+ .is_some_and(|s| s.starts_with("payout_"))
+}
+
#[async_trait::async_trait]
impl IncomingWebhook for Nuvei {
fn get_webhook_source_verification_algorithm(
@@ -1106,34 +1203,54 @@ impl IncomingWebhook for Nuvei {
let webhook = get_webhook_object_from_body(request.body)?;
// Extract transaction ID from the webhook
match &webhook {
- nuvei::NuveiWebhook::PaymentDmn(notification) => match notification.transaction_type {
- Some(nuvei::NuveiTransactionType::Auth)
- | Some(nuvei::NuveiTransactionType::Sale)
- | Some(nuvei::NuveiTransactionType::Settle)
- | Some(nuvei::NuveiTransactionType::Void)
- | Some(nuvei::NuveiTransactionType::Auth3D)
- | Some(nuvei::NuveiTransactionType::InitAuth3D) => {
- Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
- PaymentIdType::ConnectorTransactionId(
- notification
- .transaction_id
- .clone()
- .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
- ),
- ))
- }
- Some(nuvei::NuveiTransactionType::Credit) => {
- Ok(api_models::webhooks::ObjectReferenceId::RefundId(
- RefundIdType::ConnectorRefundId(
- notification
- .transaction_id
- .clone()
- .ok_or(errors::ConnectorError::MissingConnectorRefundID)?,
- ),
- ))
+ nuvei::NuveiWebhook::PaymentDmn(notification) => {
+ // if prefix contains 'payout_' then it is a payout related webhook
+ if has_payout_prefix(¬ification.client_request_id) {
+ #[cfg(feature = "payouts")]
+ {
+ Ok(api_models::webhooks::ObjectReferenceId::PayoutId(
+ PayoutIdType::PayoutAttemptId(
+ notification
+ .client_request_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
+ ),
+ ))
+ }
+ #[cfg(not(feature = "payouts"))]
+ {
+ Err(errors::ConnectorError::WebhookEventTypeNotFound.into())
+ }
+ } else {
+ match notification.transaction_type {
+ Some(nuvei::NuveiTransactionType::Auth)
+ | Some(nuvei::NuveiTransactionType::Sale)
+ | Some(nuvei::NuveiTransactionType::Settle)
+ | Some(nuvei::NuveiTransactionType::Void)
+ | Some(nuvei::NuveiTransactionType::Auth3D)
+ | Some(nuvei::NuveiTransactionType::InitAuth3D) => {
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ PaymentIdType::ConnectorTransactionId(
+ notification.transaction_id.clone().ok_or(
+ errors::ConnectorError::MissingConnectorTransactionID,
+ )?,
+ ),
+ ))
+ }
+ Some(nuvei::NuveiTransactionType::Credit) => {
+ Ok(api_models::webhooks::ObjectReferenceId::RefundId(
+ RefundIdType::ConnectorRefundId(
+ notification
+ .transaction_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingConnectorRefundID)?,
+ ),
+ ))
+ }
+ None => Err(errors::ConnectorError::WebhookEventTypeNotFound.into()),
+ }
}
- None => Err(errors::ConnectorError::WebhookEventTypeNotFound.into()),
- },
+ }
nuvei::NuveiWebhook::Chargeback(notification) => {
Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
PaymentIdType::ConnectorTransactionId(
@@ -1154,7 +1271,22 @@ impl IncomingWebhook for Nuvei {
// Map webhook type to event type
match webhook {
nuvei::NuveiWebhook::PaymentDmn(notification) => {
- if let Some((status, transaction_type)) =
+ if has_payout_prefix(¬ification.client_request_id) {
+ #[cfg(feature = "payouts")]
+ {
+ if let Some((status, transaction_type)) =
+ notification.status.zip(notification.transaction_type)
+ {
+ nuvei::map_notification_to_event_for_payout(status, transaction_type)
+ } else {
+ Err(errors::ConnectorError::WebhookEventTypeNotFound.into())
+ }
+ }
+ #[cfg(not(feature = "payouts"))]
+ {
+ Err(errors::ConnectorError::WebhookEventTypeNotFound.into())
+ }
+ } else if let Some((status, transaction_type)) =
notification.status.zip(notification.transaction_type)
{
nuvei::map_notification_to_event(status, transaction_type)
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 39776916056..4cf5c2d9807 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -36,6 +36,10 @@ use hyperswitch_domain_models::{
},
types,
};
+#[cfg(feature = "payouts")]
+use hyperswitch_domain_models::{
+ router_flow_types::payouts::PoFulfill, router_response_types::PayoutsResponseData,
+};
use hyperswitch_interfaces::{
consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},
errors::{self},
@@ -44,6 +48,8 @@ use masking::{ExposeInterface, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use url::Url;
+#[cfg(feature = "payouts")]
+use crate::{types::PayoutsResponseRouterData, utils::PayoutsData as _};
use crate::{
types::{
PaymentsPreprocessingResponseRouterData, RefundsResponseRouterData, ResponseRouterData,
@@ -2320,6 +2326,192 @@ impl TryFrom<&ConnectorAuthType> for NuveiAuthType {
}
}
+#[cfg(feature = "payouts")]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiPayoutRequest {
+ pub merchant_id: Secret<String>,
+ pub merchant_site_id: Secret<String>,
+ pub client_request_id: String,
+ pub client_unique_id: String,
+ pub amount: StringMajorUnit,
+ pub currency: String,
+ pub user_token_id: CustomerId,
+ pub time_stamp: String,
+ pub checksum: Secret<String>,
+ pub card_data: NuveiPayoutCardData,
+ pub url_details: NuveiPayoutUrlDetails,
+}
+
+#[cfg(feature = "payouts")]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiPayoutUrlDetails {
+ pub notification_url: String,
+}
+
+#[cfg(feature = "payouts")]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiPayoutCardData {
+ pub card_number: cards::CardNumber,
+ pub card_holder_name: Secret<String>,
+ pub expiration_month: Secret<String>,
+ pub expiration_year: Secret<String>,
+}
+
+#[cfg(feature = "payouts")]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum NuveiPayoutResponse {
+ NuveiPayoutSuccessResponse(NuveiPayoutSuccessResponse),
+ NuveiPayoutErrorResponse(NuveiPayoutErrorResponse),
+}
+
+#[cfg(feature = "payouts")]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiPayoutSuccessResponse {
+ pub transaction_id: String,
+ pub user_token_id: CustomerId,
+ pub transaction_status: NuveiTransactionStatus,
+ pub client_unique_id: String,
+}
+
+#[cfg(feature = "payouts")]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NuveiPayoutErrorResponse {
+ pub status: NuveiPaymentStatus,
+ pub err_code: i64,
+ pub reason: Option<String>,
+}
+
+#[cfg(feature = "payouts")]
+impl TryFrom<api_models::payouts::PayoutMethodData> for NuveiPayoutCardData {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ payout_method_data: api_models::payouts::PayoutMethodData,
+ ) -> Result<Self, Self::Error> {
+ match payout_method_data {
+ api_models::payouts::PayoutMethodData::Card(card_data) => Ok(Self {
+ card_number: card_data.card_number,
+ card_holder_name: card_data.card_holder_name.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "customer_id",
+ },
+ )?,
+ expiration_month: card_data.expiry_month,
+ expiration_year: card_data.expiry_year,
+ }),
+ api_models::payouts::PayoutMethodData::Bank(_)
+ | api_models::payouts::PayoutMethodData::Wallet(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ "Selected Payout Method is not implemented for Nuvei".to_string(),
+ )
+ .into())
+ }
+ }
+ }
+}
+
+#[cfg(feature = "payouts")]
+impl<F> TryFrom<&types::PayoutsRouterData<F>> for NuveiPayoutRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &types::PayoutsRouterData<F>) -> Result<Self, Self::Error> {
+ let connector_auth: NuveiAuthType = NuveiAuthType::try_from(&item.connector_auth_type)?;
+
+ let amount = convert_amount(
+ NUVEI_AMOUNT_CONVERTOR,
+ item.request.minor_amount,
+ item.request.destination_currency,
+ )?;
+
+ let time_stamp =
+ date_time::format_date(date_time::now(), date_time::DateFormat::YYYYMMDDHHmmss)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
+ let checksum = encode_payload(&[
+ connector_auth.merchant_id.peek(),
+ connector_auth.merchant_site_id.peek(),
+ &item.connector_request_reference_id,
+ &amount.get_amount_as_string(),
+ &item.request.destination_currency.to_string(),
+ &time_stamp,
+ connector_auth.merchant_secret.peek(),
+ ])?;
+
+ let payout_method_data = item.get_payout_method_data()?;
+
+ let card_data = NuveiPayoutCardData::try_from(payout_method_data)?;
+
+ let customer_details = item.request.get_customer_details()?;
+
+ let url_details = NuveiPayoutUrlDetails {
+ notification_url: item.request.get_webhook_url()?,
+ };
+
+ Ok(Self {
+ merchant_id: connector_auth.merchant_id,
+ merchant_site_id: connector_auth.merchant_site_id,
+ client_request_id: item.connector_request_reference_id.clone(),
+ client_unique_id: item.connector_request_reference_id.clone(),
+ amount,
+ currency: item.request.destination_currency.to_string(),
+ user_token_id: customer_details.customer_id.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "customer_id",
+ },
+ )?,
+ time_stamp,
+ checksum: Secret::new(checksum),
+ card_data,
+ url_details,
+ })
+ }
+}
+
+#[cfg(feature = "payouts")]
+impl TryFrom<PayoutsResponseRouterData<PoFulfill, NuveiPayoutResponse>>
+ for types::PayoutsRouterData<PoFulfill>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: PayoutsResponseRouterData<PoFulfill, NuveiPayoutResponse>,
+ ) -> Result<Self, Self::Error> {
+ let response = &item.response;
+
+ match response {
+ NuveiPayoutResponse::NuveiPayoutSuccessResponse(response_data) => Ok(Self {
+ response: Ok(PayoutsResponseData {
+ status: Some(enums::PayoutStatus::from(
+ response_data.transaction_status.clone(),
+ )),
+ connector_payout_id: Some(response_data.transaction_id.clone()),
+ payout_eligible: None,
+ should_add_next_step_to_process_tracker: false,
+ error_code: None,
+ error_message: None,
+ }),
+ ..item.data
+ }),
+ NuveiPayoutResponse::NuveiPayoutErrorResponse(error_response_data) => Ok(Self {
+ response: Ok(PayoutsResponseData {
+ status: Some(enums::PayoutStatus::from(
+ error_response_data.status.clone(),
+ )),
+ connector_payout_id: None,
+ payout_eligible: None,
+ should_add_next_step_to_process_tracker: false,
+ error_code: Some(error_response_data.err_code.to_string()),
+ error_message: error_response_data.reason.clone(),
+ }),
+ ..item.data
+ }),
+ }
+ }
+}
+
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "UPPERCASE")]
pub enum NuveiPaymentStatus {
@@ -2358,6 +2550,29 @@ impl From<NuveiTransactionStatus> for enums::AttemptStatus {
}
}
+#[cfg(feature = "payouts")]
+impl From<NuveiTransactionStatus> for enums::PayoutStatus {
+ fn from(item: NuveiTransactionStatus) -> Self {
+ match item {
+ NuveiTransactionStatus::Approved => Self::Success,
+ NuveiTransactionStatus::Declined | NuveiTransactionStatus::Error => Self::Failed,
+ NuveiTransactionStatus::Processing | NuveiTransactionStatus::Pending => Self::Pending,
+ NuveiTransactionStatus::Redirect => Self::Ineligible,
+ }
+ }
+}
+
+#[cfg(feature = "payouts")]
+impl From<NuveiPaymentStatus> for enums::PayoutStatus {
+ fn from(item: NuveiPaymentStatus) -> Self {
+ match item {
+ NuveiPaymentStatus::Success => Self::Success,
+ NuveiPaymentStatus::Failed | NuveiPaymentStatus::Error => Self::Failed,
+ NuveiPaymentStatus::Processing => Self::Pending,
+ }
+ }
+}
+
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NuveiPartialApproval {
@@ -3854,6 +4069,24 @@ pub fn map_notification_to_event(
}
}
+#[cfg(feature = "payouts")]
+pub fn map_notification_to_event_for_payout(
+ status: DmnStatus,
+ transaction_type: NuveiTransactionType,
+) -> Result<api_models::webhooks::IncomingWebhookEvent, error_stack::Report<errors::ConnectorError>>
+{
+ match (status, transaction_type) {
+ (DmnStatus::Success | DmnStatus::Approved, NuveiTransactionType::Credit) => {
+ Ok(api_models::webhooks::IncomingWebhookEvent::PayoutSuccess)
+ }
+ (DmnStatus::Pending, _) => Ok(api_models::webhooks::IncomingWebhookEvent::PayoutProcessing),
+ (DmnStatus::Declined | DmnStatus::Error, _) => {
+ Ok(api_models::webhooks::IncomingWebhookEvent::PayoutFailure)
+ }
+ _ => Err(errors::ConnectorError::WebhookEventTypeNotFound.into()),
+ }
+}
+
pub fn map_dispute_notification_to_event(
dispute_code: DisputeUnifiedStatusCode,
) -> Result<api_models::webhooks::IncomingWebhookEvent, error_stack::Report<errors::ConnectorError>>
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index f742437f400..ffd4254840f 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -3855,7 +3855,6 @@ default_imp_for_payouts!(
connectors::Nmi,
connectors::Noon,
connectors::Novalnet,
- connectors::Nuvei,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
@@ -4430,7 +4429,6 @@ default_imp_for_payouts_fulfill!(
connectors::Opayo,
connectors::Opennode,
connectors::Nmi,
- connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 85051693105..f137807a208 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -6397,8 +6397,8 @@ pub trait PayoutsData {
&self,
) -> Result<hyperswitch_domain_models::router_request_types::CustomerDetails, Error>;
fn get_vendor_details(&self) -> Result<PayoutVendorAccountDetails, Error>;
- #[cfg(feature = "payouts")]
fn get_payout_type(&self) -> Result<enums::PayoutType, Error>;
+ fn get_webhook_url(&self) -> Result<String, Error>;
}
#[cfg(feature = "payouts")]
@@ -6420,12 +6420,16 @@ impl PayoutsData for hyperswitch_domain_models::router_request_types::PayoutsDat
.clone()
.ok_or_else(missing_field_err("vendor_details"))
}
- #[cfg(feature = "payouts")]
fn get_payout_type(&self) -> Result<enums::PayoutType, Error> {
self.payout_type
.to_owned()
.ok_or_else(missing_field_err("payout_type"))
}
+ fn get_webhook_url(&self) -> Result<String, Error> {
+ self.webhook_url
+ .to_owned()
+ .ok_or_else(missing_field_err("webhook_url"))
+ }
}
pub trait RevokeMandateRequestData {
fn get_connector_mandate_id(&self) -> Result<String, Error>;
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 3f9d4f333c2..ac79b5177e7 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -1308,6 +1308,7 @@ pub struct PayoutsData {
pub minor_amount: MinorUnit,
pub priority: Option<storage_enums::PayoutSendPriority>,
pub connector_transfer_method_id: Option<String>,
+ pub webhook_url: Option<String>,
}
#[derive(Debug, Default, Clone)]
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 86d9e2c1e64..c132ec8d128 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -1474,8 +1474,8 @@ pub async fn check_payout_eligibility(
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
connector_payout_id: payout_response_data.connector_payout_id,
status,
- error_code: None,
- error_message: None,
+ error_code: payout_response_data.error_code,
+ error_message: payout_response_data.error_message,
is_eligible: payout_response_data.payout_eligible,
unified_code: None,
unified_message: None,
@@ -1689,8 +1689,8 @@ pub async fn create_payout(
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
connector_payout_id: payout_response_data.connector_payout_id,
status,
- error_code: None,
- error_message: None,
+ error_code: payout_response_data.error_code,
+ error_message: payout_response_data.error_message,
is_eligible: payout_response_data.payout_eligible,
unified_code: None,
unified_message: None,
@@ -2076,8 +2076,8 @@ pub async fn create_recipient_disburse_account(
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
connector_payout_id: payout_response_data.connector_payout_id.clone(),
status,
- error_code: None,
- error_message: None,
+ error_code: payout_response_data.error_code,
+ error_message: payout_response_data.error_message,
is_eligible: payout_response_data.payout_eligible,
unified_code: None,
unified_message: None,
@@ -2413,8 +2413,8 @@ pub async fn fulfill_payout(
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
connector_payout_id: payout_response_data.connector_payout_id,
status,
- error_code: None,
- error_message: None,
+ error_code: payout_response_data.error_code,
+ error_message: payout_response_data.error_message,
is_eligible: payout_response_data.payout_eligible,
unified_code: None,
unified_message: None,
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index df548fe6401..30bc466063b 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -140,6 +140,15 @@ pub async fn construct_payout_router_data<'a, F>(
_ => None,
};
+ let webhook_url = helpers::create_webhook_url(
+ &state.base_url,
+ &merchant_context.get_merchant_account().get_id().to_owned(),
+ merchant_connector_account
+ .get_mca_id()
+ .get_required_value("merchant_connector_id")?
+ .get_string_repr(),
+ );
+
let connector_transfer_method_id =
payout_helpers::should_create_connector_transfer_method(&*payout_data, connector_data)?;
@@ -187,6 +196,7 @@ pub async fn construct_payout_router_data<'a, F>(
tax_registration_id: c.tax_registration_id.map(Encryptable::into_inner),
}),
connector_transfer_method_id,
+ webhook_url: Some(webhook_url),
},
response: Ok(types::PayoutsResponseData::default()),
access_token: None,
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index b2582d7e3fe..8f1c6c128c2 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -477,6 +477,7 @@ pub trait ConnectorActions: Connector {
vendor_details: None,
priority: None,
connector_transfer_method_id: None,
+ webhook_url: None,
},
payment_info,
)
|
2025-09-30T08:17:44Z
|
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
## Description
<!-- Describe your changes in detail -->
- Add Cards Payout through Nuvei
- Add Webhook support for Payouts in Nuvei
- Propagate error from failure response in payouts
- Create webhook_url in PayoutsData Request to pass to Psp's
### Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
<!--
Provide links to the files with corresponding changes.
Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->
## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Tested through Postman:
Create an MCA (Nuvei):
Creata a Card Payouts:
```
curl --location '{{baseUrl}}/payouts/create' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:{{api_key}}' \
--data-raw '{
"amount": 10,
"currency": "EUR",
"customer_id": "payout_customer",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payout request",
"payout_type": "card",
"payout_method_data": {
"card": {
"card_number": "4000027891380961",
"expiry_month": "12",
"expiry_year": "2025",
"card_holder_name": "CL-BRW1"
}
},
"entity_type": "Individual",
"recurring": true,
"metadata": {
"ref": "123"
},
"auto_fulfill": true,
"confirm": true
}'
```
The response should be succeeded and you should receive an webhook
```
{
"payout_id": "payout_NOakA22TBihvGMX3h2Qb",
"merchant_id": "merchant_1759235409",
"merchant_order_reference_id": null,
"amount": 10,
"currency": "EUR",
"connector": "nuvei",
"payout_type": "card",
"payout_method_data": {
"card": {
"card_issuer": null,
"card_network": null,
"card_type": null,
"card_issuing_country": null,
"bank_code": null,
"last4": "0961",
"card_isin": "400002",
"card_extended_bin": null,
"card_exp_month": "12",
"card_exp_year": "2025",
"card_holder_name": "CL-BRW1"
}
},
"billing": null,
"auto_fulfill": true,
"customer_id": "payout_customer",
"customer": {
"id": "payout_customer",
"name": "John Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"client_secret": "payout_payout_NOakA22TBihvGMX3h2Qb_secret_jCqeQBT3uVeU77Oth6Pl",
"return_url": null,
"business_country": null,
"business_label": null,
"description": "Its my first payout request",
"entity_type": "Individual",
"recurring": true,
"metadata": {
"ref": "123"
},
"merchant_connector_id": "mca_cDe3Fa7sUarn7ryqAMOk",
"status": "success",
"error_message": null,
"error_code": null,
"profile_id": "pro_9bk44BClwKvHHsVHiRIV",
"created": "2025-09-30T12:40:14.361Z",
"connector_transaction_id": "7110000000017707955",
"priority": null,
"payout_link": null,
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"unified_code": null,
"unified_message": null,
"payout_method_id": "pm_WkPPJd9Tr9Mnmw73fkG5"
}
```
Payout success event should be received and webhook should be source verified
<img width="1053" height="181" alt="image" src="https://github.com/user-attachments/assets/d1faab18-43ad-4d1b-92cc-1e1a60617d73" />
<img width="1048" height="155" alt="image" src="https://github.com/user-attachments/assets/108502c2-630c-40b7-a1ee-4d794ce53f71" />
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
|
v1.117.0
|
efab34f0ef0bd032b049778f18f3cb688faa7fa7
|
efab34f0ef0bd032b049778f18f3cb688faa7fa7
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9634
| "Bug: Nexixpay MIT & order_id fix\n\n\n\n1. We should use same order id of max length 18 among multi(...TRUNCATED) | "diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hypersw(...TRUNCATED) |
2025-10-01T11:07:43Z
| "## Type of Change\r\n<!-- Put an `x` in the boxes that apply -->\r\n\r\n- [x] Bugfix\r\n- [ ] New f(...TRUNCATED) |
v1.117.0
|
9312cfa3c85e350c12bd64306037a72753b532bd
|
9312cfa3c85e350c12bd64306037a72753b532bd
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9642
| "Bug: [FEAT]: [Customer] Add search support to Customer API by Customer_ID\n\n\n\n### Feature Descri(...TRUNCATED) | "diff --git a/crates/api_models/src/customers.rs b/crates/api_models/src/customers.rs\nindex 19016e2(...TRUNCATED) |
2025-09-30T08:46:02Z
| "## Type of Change\r\n<!-- Put an `x` in the boxes that apply -->\r\n\r\n- [ ] Bugfix\r\n- [x] New f(...TRUNCATED) |
v1.117.0
|
2d580b3afbca861028e010853dc33c75818c9288
|
2d580b3afbca861028e010853dc33c75818c9288
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9621
| "Bug: [FEATURE] : [Loonio] Implement interac Bank Redirect Payment Method\n\n\n\nImplement interac B(...TRUNCATED) | "diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json\nindex 4(...TRUNCATED) |
2025-09-30T09:22:34Z
| "## Type of Change\r\n<!-- Put an `x` in the boxes that apply -->\r\n\r\n- [ ] Bugfix\r\n- [ ] New f(...TRUNCATED) |
v1.117.0
|
efab34f0ef0bd032b049778f18f3cb688faa7fa7
|
efab34f0ef0bd032b049778f18f3cb688faa7fa7
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9623
| "Bug: [ENHANCEMENT] payout updates\n\n\n\nCreating this ticket for\n\n1. Adding currency as a rule f(...TRUNCATED) | "diff --git a/crates/euclid/src/frontend/dir.rs b/crates/euclid/src/frontend/dir.rs\nindex 7df086fdb(...TRUNCATED) |
2025-09-30T10:54:01Z
| "## Type of Change\r\n<!-- Put an `x` in the boxes that apply -->\r\n\r\n- [x] Bugfix\r\n- [ ] New f(...TRUNCATED) |
v1.117.0
|
efab34f0ef0bd032b049778f18f3cb688faa7fa7
|
efab34f0ef0bd032b049778f18f3cb688faa7fa7
|
|
juspay/hyperswitch
|
juspay__hyperswitch-9638
| "Bug: [FEATURE] add cypress tests for void payment in v2\n\n\n\n### Feature Description\n\nThis impl(...TRUNCATED) | "diff --git a/cypress-tests-v2/cypress/e2e/configs/Payment/Commons.js b/cypress-tests-v2/cypress/e2e(...TRUNCATED) |
2025-10-01T11:34:49Z
| "## Type of Change\r\n<!-- Put an `x` in the boxes that apply -->\r\n\r\n- [ ] Bugfix\r\n- [X] New f(...TRUNCATED) |
v1.117.0
|
90c7cffcd5b555bb5f18e320f723fce265781e9e
|
90c7cffcd5b555bb5f18e320f723fce265781e9e
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 66