Skip to content

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

fix(connectors): [Affirm] fix one time payments, manual capture , void and refunds (#11732)

Akshaya Shankar501abf489a6f
diff --git a/config/config.example.toml b/config/config.example.toml
index fc4b3ea206..b1681359e5 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -664,7 +664,7 @@ pay_easy = { country = "JP", currency = "JPY" }
boleto = { country = "BR", currency = "BRL" }
[pm_filters.affirm]
-affirm = { country = "CA,US", currency = "CAD,USD" }
+affirm = { currency = "USD" }
[pm_filters.airwallex]
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,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,SVC,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/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 5565e199b6..f14e85f1a2 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -371,7 +371,7 @@ sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR"}
paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD" }
[pm_filters.affirm]
-affirm = { country = "CA,US", currency = "CAD,USD" }
+affirm = { currency = "USD" }
swish = { country = "SE", currency = "SEK" }
touch_n_go = { country = "MY", currency = "MYR" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 025ef40df8..349f1518d5 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -394,7 +394,7 @@ walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }
we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD" }
[pm_filters.affirm]
-affirm = { country = "CA,US", currency = "CAD,USD" }
+affirm = { currency = "USD" }
[pm_filters.airwallex]
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,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,SVC,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/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index fcee458f7e..6a343fb30d 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -402,7 +402,7 @@ we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK
pix = { country = "BR", currency = "BRL" }
[pm_filters.affirm]
-affirm = { country = "CA,US", currency = "CAD,USD" }
+affirm = { currency = "USD" }
[pm_filters.airwallex]
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,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,SVC,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/config/development.toml b/config/development.toml
index c2f039a21e..ae29fc4f56 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -609,7 +609,7 @@ pix = { country = "BR", currency = "BRL" }
boleto = { country = "BR", currency = "BRL" }
[pm_filters.affirm]
-affirm = { country = "CA,US", currency = "CAD,USD" }
+affirm = { currency = "USD" }
[pm_filters.airwallex]
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,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,SVC,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/config/docker_compose.toml b/config/docker_compose.toml
index def81f620f..ce453a30b5 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -545,7 +545,7 @@ sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR"}
paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD" }
[pm_filters.affirm]
-affirm = { country = "CA,US", currency = "CAD,USD" }
+affirm = {currency = "USD" }
swish = { country = "SE", currency = "SEK" }
touch_n_go = { country = "MY", currency = "MYR" }
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 91a3924730..ca39a18e76 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -7311,8 +7311,8 @@ merchant_secret="Source verification key"
[[affirm.pay_later]]
payment_method_type = "affirm"
[affirm.connector_auth.BodyKey]
-api_key = "API Key"
-key1 = "API Secret"
+api_key = "Public Key"
+key1 = "Private Key"
[trustpayments]
[[trustpayments.credit]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 6aa1480045..8fe1df2f0f 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -6326,8 +6326,8 @@ merchant_secret="Source verification key"
[[affirm.pay_later]]
payment_method_type = "affirm"
[affirm.connector_auth.BodyKey]
-api_key = "API Key"
-key1 = "API Secret"
+api_key = "Public Key"
+key1 = "Private Key"
[trustpayments]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index fdf0869a61..9390f93b75 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -7288,8 +7288,8 @@ merchant_secret="Source verification key"
[[affirm.pay_later]]
payment_method_type = "affirm"
[affirm.connector_auth.BodyKey]
-api_key = "API Key"
-key1 = "API Secret"
+api_key = "Public Key"
+key1 = "Private Key"
[trustpayments]
diff --git a/crates/hyperswitch_connectors/src/connectors/affirm.rs b/crates/hyperswitch_connectors/src/connectors/affirm.rs
index 8c71c5cf3b..1c68d79e4e 100644
--- a/crates/hyperswitch_connectors/src/connectors/affirm.rs
+++ b/crates/hyperswitch_connectors/src/connectors/affirm.rs
@@ -40,10 +40,11 @@ use hyperswitch_domain_models::{
};
use hyperswitch_interfaces::{
api::{
- self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
- ConnectorValidation,
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,
+ ConnectorSpecifications, ConnectorValidation,
},
configs::Connectors,
+ consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
@@ -158,9 +159,9 @@ impl ConnectorCommon for Affirm {
Ok(ErrorResponse {
status_code: response.status_code,
- code: response.code,
- message: response.message,
- reason: Some(response.error_type),
+ code: response.code.unwrap_or(NO_ERROR_CODE.to_string()),
+ message: response.error_type.unwrap_or(NO_ERROR_MESSAGE.to_string()),
+ reason: response.message,
attempt_status: None,
connector_transaction_id: None,
connector_response_reference_id: None,
@@ -565,16 +566,15 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Af
) -> CustomResult<String, errors::ConnectorError> {
let endpoint = self.base_url(connectors);
let transaction_id = req.request.connector_transaction_id.clone();
-
Ok(format!("{endpoint}/v1/transactions/{transaction_id}/void"))
}
fn get_request_body(
&self,
- req: &PaymentsCancelRouterData,
+ _req: &PaymentsCancelRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_req = affirm::AffirmCancelRequest::try_from(req)?;
+ let connector_req = affirm::AffirmCancelRequest {};
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -784,6 +784,31 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Affirm {
}
}
+impl ConnectorRedirectResponse for Affirm {
+ fn get_flow_type(
+ &self,
+ _query_params: &str,
+ json_payload: Option<serde_json::Value>,
+ action: common_enums::PaymentAction,
+ ) -> CustomResult<common_enums::CallConnectorAction, errors::ConnectorError> {
+ match action {
+ common_enums::PaymentAction::PSync => match json_payload {
+ // Handle the case where the redirection is cancelled
+ None => Ok(common_enums::CallConnectorAction::StatusUpdate {
+ status: common_enums::AttemptStatus::AuthenticationFailed,
+ error_code: None,
+ error_message: Some("Redirection Cancelled".to_string()),
+ }),
+ Some(_) => Ok(common_enums::CallConnectorAction::Trigger),
+ },
+ common_enums::PaymentAction::CompleteAuthorize
+ | common_enums::PaymentAction::PaymentAuthenticateCompleteAuthorize => {
+ Ok(common_enums::CallConnectorAction::Trigger)
+ }
+ }
+ }
+}
+
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Affirm {
fn get_webhook_object_reference_id(
@@ -812,7 +837,7 @@ impl webhooks::IncomingWebhook for Affirm {
static AFFIRM_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {
let supported_capture_methods = vec![
- enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::SequentialAutomatic,
enums::CaptureMethod::Manual,
];
@@ -834,9 +859,9 @@ static AFFIRM_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = Laz
static AFFIRM_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
display_name: "Affirm",
- description: "Affirm connector is a payment gateway integration that processes Affirm’s buy now, pay later financing by managing payment authorization, capture, refunds, and transaction sync via Affirm’s API.",
+ description: "Affirm connector is a payment gateway integration that processes Affirm's buy now, pay later financing by managing payment authorization, capture, refunds, and transaction sync via Affirm’s API.",
connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
- integration_status: enums::ConnectorIntegrationStatus::Alpha,
+ integration_status: enums::ConnectorIntegrationStatus::Beta,
};
static AFFIRM_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
diff --git a/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs b/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
index 3558b47d5d..6e586c3ea6 100644
--- a/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
@@ -1,6 +1,6 @@
use common_enums::{enums, CountryAlpha2, Currency};
use common_utils::{pii, request::Method, types::MinorUnit};
-use error_stack::{report, ResultExt};
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::{PayLaterData, PaymentMethodData},
router_data::{ConnectorAuthType, RouterData},
@@ -13,16 +13,18 @@ use hyperswitch_domain_models::{
},
};
use hyperswitch_interfaces::errors;
-use hyperswitch_masking::Secret;
+use hyperswitch_masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
-use serde_json::Value;
use crate::{
types::{
PaymentsCancelResponseRouterData, PaymentsCaptureResponseRouterData,
RefundsResponseRouterData, ResponseRouterData,
},
- utils::{PaymentsAuthorizeRequestData, RouterData as OtherRouterData},
+ utils::{
+ PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData,
+ RouterData as OtherRouterData,
+ },
};
pub struct AffirmRouterData<T> {
pub amount: MinorUnit,
@@ -41,36 +43,41 @@ impl<T> From<(MinorUnit, T)> for AffirmRouterData<T> {
#[derive(Debug, Serialize)]
pub struct AffirmPaymentsRequest {
pub merchant: Merchant,
- pub items: Vec<Item>,
+ #[serde(skip_serializing_if = "Option::is_none")]
pub shipping: Option<Shipping>,
- pub billing: Option<Billing>,
+ pub billing: Billing,
pub total: MinorUnit,
- pub currency: Currency,
+ #[serde(skip_serializing_if = "Option::is_none")]
pub order_id: Option<String>,
}
#[derive(Debug, Serialize)]
pub struct AffirmCompleteAuthorizeRequest {
+ #[serde(skip_serializing_if = "Option::is_none")]
pub order_id: Option<String>,
- pub reference_id: Option<String>,
pub transaction_id: String,
+ pub currency: Currency,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct AffirmRedirectResponse {
+ pub checkout_token: String,
}
impl TryFrom<&PaymentsCompleteAuthorizeRouterData> for AffirmCompleteAuthorizeRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &PaymentsCompleteAuthorizeRouterData) -> Result<Self, Self::Error> {
- let transaction_id = item.request.connector_transaction_id.clone().ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "connector_transaction_id",
- },
- )?;
-
- let reference_id = item.reference_id.clone();
+ let payload_data = item.request.get_redirect_response_payload()?.expose();
+ let redirection_response: AffirmRedirectResponse = serde_json::from_value(payload_data)
+ .change_context(errors::ConnectorError::MissingConnectorRedirectionPayload {
+ field_name: "checkout_token",
+ })?;
+ let transaction_id = redirection_response.checkout_token;
let order_id = item.connector_request_reference_id.clone();
Ok(Self {
transaction_id,
order_id: Some(order_id),
- reference_id,
+ currency: item.request.currency,
})
}
}
@@ -80,19 +87,7 @@ pub struct Merchant {
pub public_api_key: Secret<String>,
pub user_confirmation_url: String,
pub user_cancel_url: String,
- pub user_confirmation_url_action: Option<String>,
- pub use_vcn: Option<String>,
- pub name: Option<String>,
}
-
-#[derive(Debug, Serialize)]
-pub struct Item {
- pub display_name: String,
- pub sku: String,
- pub unit_price: MinorUnit,
- pub qty: i64,
-}
-
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Shipping {
pub name: Name,
@@ -114,83 +109,57 @@ pub struct Billing {
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Name {
+ #[serde(skip_serializing_if = "Option::is_none")]
pub first: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
pub last: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
pub full: Option<Secret<String>>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Address {
+ #[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<Secret<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<Secret<String>>,
- pub city: Option<String>,
- pub state: Option<Secret<String>>,
- pub zipcode: Option<Secret<String>>,
- pub country: Option<CountryAlpha2>,
-}
-
-#[derive(Debug, Serialize)]
-pub struct Metadata {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub shipping_type: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub entity_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub platform_type: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub platform_version: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub platform_affirm: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub webhook_session_id: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub mode: Option<String>,
+ pub city: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub customer: Option<Value>,
+ pub state: Option<Secret<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub itinerary: Option<Vec<Value>>,
+ pub zipcode: Option<Secret<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub checkout_channel_type: Option<String>,
- #[serde(rename = "BOPIS", skip_serializing_if = "Option::is_none")]
- pub bopis: Option<bool>,
-}
-
-#[derive(Debug, Serialize)]
-pub struct Discount {
- pub discount_amount: MinorUnit,
- pub discount_display_name: String,
- pub discount_code: Option<String>,
+ pub country: Option<CountryAlpha2>,
}
-impl TryFrom<&AffirmRouterData<&PaymentsAuthorizeRouterData>> for AffirmPaymentsRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
-
- fn try_from(
- item: &AffirmRouterData<&PaymentsAuthorizeRouterData>,
- ) -> Result<Self, Self::Error> {
- let router_data = &item.router_data;
- let request = &router_data.request;
-
- let billing = Some(Billing {
- name: Name {
- first: item.router_data.get_optional_billing_first_name(),
- last: item.router_data.get_optional_billing_last_name(),
- full: item.router_data.get_optional_billing_full_name(),
- },
- address: Address {
- line1: item.router_data.get_optional_billing_line1(),
- line2: item.router_data.get_optional_billing_line2(),
- city: item.router_data.get_optional_billing_city(),
- state: item.router_data.get_optional_billing_state(),
- zipcode: item.router_data.get_optional_billing_zip(),
- country: item.router_data.get_optional_billing_country(),
- },
- phone_number: item.router_data.get_optional_billing_phone_number(),
- email: item.router_data.get_optional_billing_email(),
- });
-
- let shipping = Some(Shipping {
+fn build_billing(
+ item: &AffirmRouterData<&PaymentsAuthorizeRouterData>,
+) -> Result<Billing, error_stack::Report<errors::ConnectorError>> {
+ Ok(Billing {
+ name: Name {
+ first: Some(item.router_data.get_billing_first_name()?),
+ last: Some(item.router_data.get_billing_last_name()?),
+ full: item.router_data.get_optional_billing_full_name(),
+ },
+ address: Address {
+ line1: item.router_data.get_optional_billing_line1(),
+ line2: item.router_data.get_optional_billing_line2(),
+ city: item.router_data.get_optional_billing_city(),
+ state: item.router_data.get_optional_billing_state(),
+ zipcode: item.router_data.get_optional_billing_zip(),
+ country: item.router_data.get_optional_billing_country(),
+ },
+ phone_number: item.router_data.get_optional_billing_phone_number(),
+ email: item.router_data.get_optional_billing_email(),
+ })
+}
+
+fn build_shipping(item: &AffirmRouterData<&PaymentsAuthorizeRouterData>) -> Option<Shipping> {
+ item.router_data
+ .get_shipping_address_with_phone_number()
+ .ok()
+ .map(|_| Shipping {
name: Name {
first: item.router_data.get_optional_shipping_first_name(),
last: item.router_data.get_optional_shipping_last_name(),
@@ -206,27 +175,22 @@ impl TryFrom<&AffirmRouterData<&PaymentsAuthorizeRouterData>> for AffirmPayments
},
phone_number: item.router_data.get_optional_shipping_phone_number(),
email: item.router_data.get_optional_shipping_email(),
- });
+ })
+}
+
+impl TryFrom<&AffirmRouterData<&PaymentsAuthorizeRouterData>> for AffirmPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn try_from(
+ item: &AffirmRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ let router_data = &item.router_data;
+ let request = &router_data.request;
+ let billing = build_billing(item)?;
+ let shipping = build_shipping(item);
match request.payment_method_data.clone() {
PaymentMethodData::PayLater(PayLaterData::AffirmRedirect {}) => {
- let items = match request.order_details.clone() {
- Some(order_details) => order_details
- .iter()
- .map(|data| {
- Ok(Item {
- display_name: data.product_name.clone(),
- sku: data.product_id.clone().unwrap_or_default(),
- unit_price: data.amount,
- qty: data.quantity.into(),
- })
- })
- .collect::<Result<Vec<_>, _>>(),
- None => Err(report!(errors::ConnectorError::MissingRequiredField {
- field_name: "order_details",
- })),
- }?;
-
let auth_type = AffirmAuthType::try_from(&item.router_data.connector_auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let public_api_key = auth_type.public_key;
@@ -234,18 +198,13 @@ impl TryFrom<&AffirmRouterData<&PaymentsAuthorizeRouterData>> for AffirmPayments
public_api_key,
user_confirmation_url: request.get_complete_authorize_url()?,
user_cancel_url: request.get_router_return_url()?,
- user_confirmation_url_action: None,
- use_vcn: None,
- name: None,
};
Ok(Self {
merchant,
- items,
shipping,
billing,
total: item.amount,
- currency: request.currency,
order_id: Some(item.router_data.connector_request_reference_id.clone()),
})
}
@@ -275,29 +234,13 @@ impl From<AffirmTransactionStatus> for common_enums::AttemptStatus {
fn from(item: AffirmTransactionStatus) -> Self {
match item {
AffirmTransactionStatus::Authorized => Self::Authorized,
- AffirmTransactionStatus::AuthExpired => Self::Failure,
- AffirmTransactionStatus::Canceled => Self::Voided,
AffirmTransactionStatus::Captured => Self::Charged,
- AffirmTransactionStatus::ConfirmationExpired => Self::Failure,
- AffirmTransactionStatus::Confirmed => Self::Authorized,
- AffirmTransactionStatus::Created => Self::Pending,
- AffirmTransactionStatus::Declined => Self::Failure,
- AffirmTransactionStatus::Disputed => Self::Unresolved,
- AffirmTransactionStatus::DisputeRefunded => Self::Unresolved,
- AffirmTransactionStatus::ExpiredAuthorization => Self::Failure,
- AffirmTransactionStatus::ExpiredConfirmation => Self::Failure,
- AffirmTransactionStatus::PartiallyCaptured => Self::Charged,
AffirmTransactionStatus::Voided => Self::Voided,
- AffirmTransactionStatus::PartiallyVoided => Self::Voided,
- }
- }
-}
-
-impl From<AffirmRefundStatus> for common_enums::RefundStatus {
- fn from(item: AffirmRefundStatus) -> Self {
- match item {
- AffirmRefundStatus::PartiallyRefunded => Self::Success,
- AffirmRefundStatus::Refunded => Self::Success,
+ AffirmTransactionStatus::PartiallyCaptured => Self::PartialCharged,
+ AffirmTransactionStatus::Disputed
+ | AffirmTransactionStatus::DisputeRefunded
+ | AffirmTransactionStatus::PartiallyRefunded
+ | AffirmTransactionStatus::Refunded => Self::Unresolved,
}
}
}
@@ -311,91 +254,24 @@ pub struct AffirmPaymentsResponse {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct AffirmCompleteAuthorizeResponse {
- pub id: String,
+ pub provider_id: Option<i32>,
pub status: AffirmTransactionStatus,
- pub amount: MinorUnit,
- pub amount_refunded: MinorUnit,
- pub authorization_expiration: String,
- pub checkout_id: String,
- pub created: String,
- pub currency: Currency,
- pub events: Vec<TransactionEvent>,
- pub settlement_transaction_id: Option<String>,
- pub transaction_id: String,
- pub order_id: String,
- pub shipping_carrier: Option<String>,
- pub shipping_confirmation: Option<String>,
- pub shipping: Option<Shipping>,
- pub agent_alias: Option<String>,
- pub merchant_transaction_id: Option<String>,
- pub provider_id: Option<i64>,
- pub remove_tax: Option<bool>,
- pub checkout: Option<Value>,
- pub refund_expires: Option<String>,
- pub remaining_capturable_amount: Option<i64>,
- pub loan_information: Option<LoanInformation>,
- pub user_id: Option<String>,
- pub platform: Option<String>,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
-pub struct TransactionEvent {
- pub id: String,
- pub amount: MinorUnit,
- pub created: String,
- pub currency: Currency,
- pub fee: Option<i64>,
- pub fee_refunded: Option<MinorUnit>,
- pub reference_id: Option<String>,
- #[serde(rename = "type")]
- pub event_type: AffirmEventType,
- pub settlement_transaction_id: Option<String>,
- pub transaction_id: String,
- pub order_id: String,
- pub shipping_carrier: Option<String>,
- pub shipping_confirmation: Option<String>,
- pub shipping: Option<Shipping>,
- pub agent_alias: Option<String>,
- pub merchant_transaction_id: Option<String>,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
-pub struct LoanInformation {
- pub fees: Option<LoanFees>,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
-pub struct LoanFees {
pub amount: Option<MinorUnit>,
- pub description: Option<String>,
+ pub authorization_expiration: Option<String>,
+ pub checkout_id: Option<String>,
+ pub id: String,
+ pub order_id: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum AffirmTransactionStatus {
Authorized,
- AuthExpired,
- Canceled,
+ Voided,
Captured,
- ConfirmationExpired,
- Confirmed,
- Created,
- Declined,
+ PartiallyCaptured,
Disputed,
DisputeRefunded,
- ExpiredAuthorization,
- ExpiredConfirmation,
- PartiallyCaptured,
- Voided,
- PartiallyVoided,
-}
-
-#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
-pub enum AffirmRefundStatus {
PartiallyRefunded,
Refunded,
}
@@ -403,28 +279,15 @@ pub enum AffirmRefundStatus {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct AffirmPSyncResponse {
- pub amount: MinorUnit,
- pub amount_refunded: MinorUnit,
- pub authorization_expiration: Option<String>,
- pub checkout_id: String,
- pub created: String,
- pub currency: Currency,
- pub events: Vec<TransactionEvent>,
pub id: String,
- pub order_id: String,
- pub provider_id: Option<i64>,
- pub remove_tax: Option<bool>,
+ pub checkout_id: Option<String>,
+ pub provider_id: Option<i32>,
+ pub order_id: Option<String>,
pub status: AffirmTransactionStatus,
- pub checkout: Option<Value>,
- pub refund_expires: Option<String>,
- pub remaining_capturable_amount: Option<MinorUnit>,
- pub loan_information: Option<LoanInformation>,
- pub shipping_carrier: Option<String>,
- pub shipping_confirmation: Option<String>,
- pub shipping: Option<Shipping>,
- pub merchant_transaction_id: Option<String>,
- pub settlement_transaction_id: Option<String>,
- pub transaction_id: String,
+ pub amount: Option<MinorUnit>,
+ pub amount_refunded: Option<MinorUnit>,
+ pub authorization_expiration: Option<String>,
+ pub created: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -432,22 +295,8 @@ pub struct AffirmPSyncResponse {
pub struct AffirmRsyncResponse {
pub amount: MinorUnit,
pub amount_refunded: MinorUnit,
- pub authorization_expiration: String,
- pub checkout_id: String,
- pub created: String,
- pub currency: Currency,
- pub events: Vec<TransactionEvent>,
pub id: String,
pub order_id: String,
- pub status: AffirmRefundStatus,
- pub refund_expires: Option<String>,
- pub remaining_capturable_amount: Option<MinorUnit>,
- pub shipping_carrier: Option<String>,
- pub shipping_confirmation: Option<String>,
- pub shipping: Option<Shipping>,
- pub merchant_transaction_id: Option<String>,
- pub settlement_transaction_id: Option<String>,
- pub transaction_id: String,
}
#[derive(Debug, Serialize, Deserialize)]
@@ -497,7 +346,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, AffirmResponseWrapper, T, PaymentsRespo
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: None,
+ connector_response_reference_id: resp.order_id.clone(),
authentication_data: None,
charges: None,
incremental_authorization_allowed: None,
@@ -524,7 +373,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, AffirmCompleteAuthorizeResponse, T, Pay
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: None,
+ connector_response_reference_id: item.response.order_id.clone(),
incremental_authorization_allowed: None,
authentication_data: None,
charges: None,
@@ -536,32 +385,17 @@ impl<F, T> TryFrom<ResponseRouterData<F, AffirmCompleteAuthorizeResponse, T, Pay
#[derive(Default, Debug, Serialize)]
pub struct AffirmRefundRequest {
pub amount: MinorUnit,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub reference_id: Option<String>,
}
impl<F> TryFrom<&AffirmRouterData<&RefundsRouterData<F>>> for AffirmRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
-
fn try_from(item: &AffirmRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
- let reference_id = item.router_data.request.connector_transaction_id.clone();
-
Ok(Self {
amount: item.amount.to_owned(),
- reference_id: Some(reference_id),
})
}
}
-#[allow(dead_code)]
-#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
-}
-
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct AffirmRefundResponse {
@@ -570,27 +404,6 @@ pub struct AffirmRefundResponse {
pub created: String,
pub currency: Currency,
pub fee: Option<MinorUnit>,
- pub fee_refunded: Option<MinorUnit>,
- pub reference_id: Option<String>,
- #[serde(rename = "type")]
- pub event_type: AffirmEventType,
- pub settlement_transaction_id: Option<String>,
- pub transaction_id: String,
- pub order_id: String,
- pub shipping_carrier: Option<String>,
- pub shipping_confirmation: Option<String>,
- pub shipping: Option<Shipping>,
- pub agent_alias: Option<String>,
- pub merchant_transaction_id: Option<String>,
-}
-
-impl From<AffirmEventType> for enums::RefundStatus {
- fn from(event_type: AffirmEventType) -> Self {
- match event_type {
- AffirmEventType::Refund => Self::Success,
- _ => Self::Pending,
- }
- }
}
impl TryFrom<RefundsResponseRouterData<Execute, AffirmRefundResponse>>
@@ -602,8 +415,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, AffirmRefundResponse>>
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.event_type),
+ connector_refund_id: item.data.request.connector_transaction_id.to_string(),
+ refund_status: enums::RefundStatus::Success,
}),
..item.data
})
@@ -615,10 +428,11 @@ impl TryFrom<RefundsResponseRouterData<RSync, AffirmRsyncResponse>> for RefundsR
fn try_from(
item: RefundsResponseRouterData<RSync, AffirmRsyncResponse>,
) -> Result<Self, Self::Error> {
+ // Affirm refunds are synchronous
Ok(Self {
response: Ok(RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
+ connector_refund_id: item.data.request.connector_transaction_id.to_string(),
+ refund_status: enums::RefundStatus::Success,
}),
..item.data
})
@@ -628,39 +442,31 @@ impl TryFrom<RefundsResponseRouterData<RSync, AffirmRsyncResponse>> for RefundsR
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct AffirmErrorResponse {
pub status_code: u16,
- pub code: String,
- pub message: String,
+ pub code: Option<String>,
+ pub message: Option<String>,
#[serde(rename = "type")]
- pub error_type: String,
+ pub error_type: Option<String>,
}
#[derive(Debug, Serialize)]
pub struct AffirmCaptureRequest {
+ #[serde(skip_serializing_if = "Option::is_none")]
pub order_id: Option<String>,
- pub reference_id: Option<String>,
pub amount: MinorUnit,
- pub shipping_carrier: Option<String>,
- pub shipping_confirmation: Option<String>,
}
impl TryFrom<&AffirmRouterData<&PaymentsCaptureRouterData>> for AffirmCaptureRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &AffirmRouterData<&PaymentsCaptureRouterData>) -> Result<Self, Self::Error> {
- let reference_id = match item.router_data.connector_request_reference_id.clone() {
+ let order_id = match item.router_data.connector_request_reference_id.clone() {
ref_id if ref_id.is_empty() => None,
ref_id => Some(ref_id),
};
let amount = item.amount;
- Ok(Self {
- reference_id,
- amount,
- order_id: None,
- shipping_carrier: None,
- shipping_confirmation: None,
- })
+ Ok(Self { amount, order_id })
}
}
@@ -672,56 +478,6 @@ pub struct AffirmCaptureResponse {
pub created: String,
pub currency: Currency,
pub fee: Option<MinorUnit>,
- pub fee_refunded: Option<MinorUnit>,
- pub reference_id: Option<String>,
- #[serde(rename = "type")]
- pub event_type: AffirmEventType,
- pub settlement_transaction_id: Option<String>,
- pub transaction_id: String,
- pub order_id: String,
- pub shipping_carrier: Option<String>,
- pub shipping_confirmation: Option<String>,
- pub shipping: Option<Shipping>,
- pub agent_alias: Option<String>,
- pub merchant_transaction_id: Option<String>,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
-#[serde(rename_all = "snake_case")]
-pub enum AffirmEventType {
- Auth,
- AuthExpired,
- Capture,
- ChargeOff,
- Confirm,
- ConfirmationExpired,
- ExpireAuthorization,
- ExpireConfirmation,
- Refund,
- SplitCapture,
- Update,
- Void,
- PartialVoid,
- RefundVoided,
-}
-
-impl From<AffirmEventType> for enums::AttemptStatus {
- fn from(event_type: AffirmEventType) -> Self {
- match event_type {
- AffirmEventType::Auth => Self::Authorized,
- AffirmEventType::Capture | AffirmEventType::SplitCapture | AffirmEventType::Confirm => {
- Self::Charged
- }
- AffirmEventType::AuthExpired
- | AffirmEventType::ChargeOff
- | AffirmEventType::ConfirmationExpired
- | AffirmEventType::ExpireAuthorization
- | AffirmEventType::ExpireConfirmation => Self::Failure,
- AffirmEventType::Refund | AffirmEventType::RefundVoided => Self::AutoRefunded,
- AffirmEventType::Update => Self::Pending,
- AffirmEventType::Void | AffirmEventType::PartialVoid => Self::Voided,
- }
- }
}
impl TryFrom<PaymentsCaptureResponseRouterData<AffirmCaptureResponse>>
@@ -732,9 +488,10 @@ impl TryFrom<PaymentsCaptureResponseRouterData<AffirmCaptureResponse>>
item: PaymentsCaptureResponseRouterData<AffirmCaptureResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
- status: enums::AttemptStatus::from(item.response.event_type.clone()),
+ amount_captured: Some(item.response.amount.get_amount_as_i64()),
+ status: enums::AttemptStatus::Charged,
response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: ResponseId::NoResponseId,
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
@@ -748,54 +505,14 @@ impl TryFrom<PaymentsCaptureResponseRouterData<AffirmCaptureResponse>>
})
}
}
-
-impl TryFrom<&PaymentsCancelRouterData> for AffirmCancelRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &PaymentsCancelRouterData) -> Result<Self, Self::Error> {
- let request = &item.request;
-
- let reference_id = request.connector_transaction_id.clone();
- let amount = item
- .request
- .amount
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "amount",
- })?;
- Ok(Self {
- reference_id: Some(reference_id),
- amount,
- merchant_transaction_id: None,
- })
- }
-}
-
#[derive(Debug, Serialize)]
-pub struct AffirmCancelRequest {
- pub reference_id: Option<String>,
- pub amount: i64,
- pub merchant_transaction_id: Option<String>,
-}
+pub struct AffirmCancelRequest {}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct AffirmCancelResponse {
pub id: String,
- pub amount: MinorUnit,
pub created: String,
- pub currency: Currency,
- pub fee: Option<MinorUnit>,
- pub fee_refunded: Option<MinorUnit>,
- pub reference_id: Option<String>,
- #[serde(rename = "type")]
- pub event_type: AffirmEventType,
- pub settlement_transaction_id: Option<String>,
- pub transaction_id: String,
- pub order_id: String,
- pub shipping_carrier: Option<String>,
- pub shipping_confirmation: Option<String>,
- pub shipping: Option<Shipping>,
- pub agent_alias: Option<String>,
- pub merchant_transaction_id: Option<String>,
}
impl TryFrom<PaymentsCancelResponseRouterData<AffirmCancelResponse>> for PaymentsCancelRouterData {
@@ -804,9 +521,9 @@ impl TryFrom<PaymentsCancelResponseRouterData<AffirmCancelResponse>> for Payment
item: PaymentsCancelResponseRouterData<AffirmCancelResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
- status: enums::AttemptStatus::from(item.response.event_type.clone()),
+ status: enums::AttemptStatus::Voided,
response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: ResponseId::NoResponseId,
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 9b26b8f397..2867f2007c 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -2064,7 +2064,6 @@ default_imp_for_connector_redirect_response!(
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
- connectors::Affirm,
connectors::Amazonpay,
connectors::Archipel,
connectors::Authipay,
diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rs
index 2ee33c2cec..f30544a1d6 100644
--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs
+++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs
@@ -3117,6 +3117,17 @@ fn get_pay_later_required_fields() -> HashMap<enums::PaymentMethodType, Connecto
common: HashMap::new(),
},
),
+ (
+ Connector::Affirm,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::from([
+ RequiredField::BillingUserFirstName.to_tuple(),
+ RequiredField::BillingUserLastName.to_tuple(),
+ ]),
+ common: HashMap::new(),
+ },
+ ),
]),
),
(
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index d57a8b601b..852541da3d 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -471,7 +471,7 @@ klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,N
ideal = { country = "NL", currency = "EUR" }
[pm_filters.affirm]
-affirm = { country = "CA,US", currency = "CAD,USD" }
+affirm = { currency = "USD" }
[pm_filters.amazonpay]
amazon_pay = { country = "US", currency = "USD" }