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

feat(connector): [Facilitapay] Add support for Pix Bank Transfers (#7704)

Pa1NarK639b8cba5fff
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 4539e39ec4..45f95f01da 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -6230,6 +6230,18 @@
"description": "CNPJ is a Brazilian company tax identification number",
"example": "74469027417312",
"nullable": true
+ },
+ "source_bank_account_id": {
+ "type": "string",
+ "description": "Source bank account number",
+ "example": "8b2812f0-d6c8-4073-97bb-9fa964d08bc5",
+ "nullable": true
+ },
+ "destination_bank_account_id": {
+ "type": "string",
+ "description": "Destination bank account number",
+ "example": "9b95f84e-de61-460b-a14b-f23b4e71c97b",
+ "nullable": true
}
}
}
@@ -7777,6 +7789,7 @@
"dlocal",
"ebanx",
"elavon",
+ "facilitapay",
"fiserv",
"fiservemea",
"fiuu",
@@ -10444,6 +10457,18 @@
"user_bank_account_number"
]
},
+ {
+ "type": "string",
+ "enum": [
+ "user_source_bank_account_id"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "user_destination_bank_account_id"
+ ]
+ },
{
"type": "string",
"enum": [
@@ -19429,6 +19454,18 @@
"description": "Partially masked CNPJ - CNPJ is a Brazilian company tax identification number",
"example": "**** 417312",
"nullable": true
+ },
+ "source_bank_account_id": {
+ "type": "string",
+ "description": "Partially masked source bank account number",
+ "example": "********-****-4073-****-9fa964d08bc5",
+ "nullable": true
+ },
+ "destination_bank_account_id": {
+ "type": "string",
+ "description": "Partially masked destination bank account number",
+ "example": "********-****-460b-****-f23b4e71c97b",
+ "nullable": true
}
}
},
@@ -21084,6 +21121,7 @@
"dlocal",
"ebanx",
"elavon",
+ "facilitapay",
"fiserv",
"fiservemea",
"fiuu",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 8cd7b792ae..90bbf70fd6 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -8321,6 +8321,18 @@
"description": "CNPJ is a Brazilian company tax identification number",
"example": "74469027417312",
"nullable": true
+ },
+ "source_bank_account_id": {
+ "type": "string",
+ "description": "Source bank account number",
+ "example": "8b2812f0-d6c8-4073-97bb-9fa964d08bc5",
+ "nullable": true
+ },
+ "destination_bank_account_id": {
+ "type": "string",
+ "description": "Destination bank account number",
+ "example": "9b95f84e-de61-460b-a14b-f23b4e71c97b",
+ "nullable": true
}
}
}
@@ -9827,6 +9839,7 @@
"dlocal",
"ebanx",
"elavon",
+ "facilitapay",
"fiserv",
"fiservemea",
"fiuu",
@@ -12641,6 +12654,18 @@
"user_bank_account_number"
]
},
+ {
+ "type": "string",
+ "enum": [
+ "user_source_bank_account_id"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "user_destination_bank_account_id"
+ ]
+ },
{
"type": "string",
"enum": [
@@ -23810,6 +23835,18 @@
"description": "Partially masked CNPJ - CNPJ is a Brazilian company tax identification number",
"example": "**** 417312",
"nullable": true
+ },
+ "source_bank_account_id": {
+ "type": "string",
+ "description": "Partially masked source bank account number",
+ "example": "********-****-4073-****-9fa964d08bc5",
+ "nullable": true
+ },
+ "destination_bank_account_id": {
+ "type": "string",
+ "description": "Partially masked destination bank account number",
+ "example": "********-****-460b-****-f23b4e71c97b",
+ "nullable": true
}
}
},
@@ -25575,6 +25612,7 @@
"dlocal",
"ebanx",
"elavon",
+ "facilitapay",
"fiserv",
"fiservemea",
"fiuu",
diff --git a/config/config.example.toml b/config/config.example.toml
index 15b9dd2fc4..63c7c89b03 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -331,7 +331,7 @@ cards = [
"datatrans",
"deutschebank",
"digitalvirgo",
- "facilitapay",
+ "facilitapay",
"globalpay",
"globepay",
"gocardless",
@@ -647,6 +647,9 @@ credit = { country = "FR", currency = "CAD, AUD, EUR, USD" }
[pm_filters.digitalvirgo]
direct_carrier_billing = {country = "MA, CM, ZA, EG, SN, DZ, TN, ML, GN, GH, LY, GA, CG, MG, BW, SD, NG, ID, SG, AZ, TR, FR, ES, PL, GB, PT, DE, IT, BE, IE, SK, GR, NL, CH, BR, MX, AR, CL, AE, IQ, KW, BH, SA, QA, PS, JO, OM, RU" , currency = "MAD, XOF, XAF, ZAR, EGP, DZD, TND, GNF, GHS, LYD, XAF, CDF, MGA, BWP, SDG, NGN, IDR, SGD, RUB, AZN, TRY, EUR, PLN, GBP, CHF, BRL, MXN, ARS, CLP, AED, IQD, KWD, BHD, SAR, QAR, ILS, JOD, OMR" }
+[pm_filters.facilitapay]
+pix = { country = "BR", currency = "BRL" }
+
[pm_filters.helcim]
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
@@ -745,7 +748,7 @@ credit = { country = "AD,AE,AF,AG,AI,AL,AM,AO,AQ,AR,AS,AT,AU,AW,AX,AZ,BA,BB,BD,B
debit = { country = "AD,AE,AF,AG,AI,AL,AM,AO,AQ,AR,AS,AT,AU,AW,AX,AZ,BA,BB,BD,BE,BF,BG,BH,BI,BJ,BL,BM,BN,BO,BQ,BR,BS,BT,BV,BW,BY,BZ,CA,CC,CD,CF,CG,CH,CI,CK,CL,CM,CN,CO,CR,CU,CV,CW,CX,CY,CZ,DE,DJ,DK,DM,DO,DZ,EC,EE,EG,EH,ER,ES,ET,FI,FJ,FK,FM,FO,FR,GA,GB,GD,GE,GF,GG,GH,GI,GL,GM,GN,GP,GQ,GR,GT,GU,GW,GY,HK,HM,HN,HR,HT,HU,ID,IE,IL,IM,IN,IO,IQ,IR,IS,IT,JE,JM,JO,JP,KE,KG,KH,KI,KM,KN,KP,KR,KW,KY,KZ,LA,LB,LC,LI,LK,LR,LS,LT,LU,LV,LY,MA,MC,MD,ME,MF,MG,MH,MK,ML,MM,MN,MO,MP,MQ,MR,MS,MT,MU,MV,MW,MX,MY,MZ,NA,NC,NE,NF,NG,NI,NL,NO,NP,NR,NU,NZ,OM,PA,PE,PF,PG,PH,PK,PL,PM,PN,PR,PS,PT,PW,PY,QA,RE,RO,RS,RU,RW,SA,SB,SC,SD,SE,SG,SH,SI,SJ,SK,SL,SM,SN,SO,SR,SS,ST,SV,SX,SY,SZ,TC,TD,TF,TG,TH,TJ,TL,TM,TN,TO,TR,TT,TV,TW,TZ,UA,UG,UM,US,UY,UZ,VA,VC,VE,VG,VI,VN,VU,WF,WS,YE,YT,ZA,ZM,ZW", 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,SLL,SOS,SRD,SSP,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
[connector_customer]
-connector_list = "gocardless,stax,stripe"
+connector_list = "gocardless,stax,stripe,facilitapay"
payout_connector_list = "nomupay,stripe,wise"
[bank_config.online_banking_fpx]
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 802af333f8..0b4c0967e1 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -166,7 +166,7 @@ force_cookies = true
enabled = true
[connector_customer]
-connector_list = "gocardless,stax,stripe"
+connector_list = "gocardless,stax,stripe,facilitapay"
payout_connector_list = "nomupay,stripe,wise"
[delayed_session_response]
@@ -359,6 +359,9 @@ paypal.currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,N
credit.currency = "USD"
debit.currency = "USD"
+[pm_filters.facilitapay]
+pix = { country = "BR", currency = "BRL" }
+
[pm_filters.helcim]
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 3cc5b8c0f8..563941cf9d 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -15,7 +15,7 @@ open_banking_uk.adyen.banks = "aib,bank_of_scotland,danske_bank,first_direct,fir
przelewy24.stripe.banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,banki_spbdzielcze,blik,bnp_paribas,boz,citi,credit_agricole,e_transfer_pocztowy24,getin_bank,idea_bank,inteligo,mbank_mtransfer,nest_przelew,noble_pay,pbac_z_ipko,plus_bank,santander_przelew24,toyota_bank,volkswagen_bank"
[connector_customer]
-connector_list = "stax,stripe,gocardless"
+connector_list = "stax,stripe,gocardless,facilitapay"
payout_connector_list = "nomupay,stripe,wise"
# Connector configuration, provided attributes will be used to fulfill API requests.
@@ -409,6 +409,9 @@ paypal.currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,N
credit.currency = "USD"
debit.currency = "USD"
+[pm_filters.facilitapay]
+pix = { country = "BR", currency = "BRL" }
+
[pm_filters.helcim]
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index c3555f7ea0..c861ade9aa 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -15,7 +15,7 @@ open_banking_uk.adyen.banks = "aib,bank_of_scotland,danske_bank,first_direct,fir
przelewy24.stripe.banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,banki_spbdzielcze,blik,bnp_paribas,boz,citi,credit_agricole,e_transfer_pocztowy24,getin_bank,idea_bank,inteligo,mbank_mtransfer,nest_przelew,noble_pay,pbac_z_ipko,plus_bank,santander_przelew24,toyota_bank,volkswagen_bank"
[connector_customer]
-connector_list = "stax,stripe,gocardless"
+connector_list = "stax,stripe,gocardless,facilitapay"
payout_connector_list = "nomupay,stripe,wise"
# Connector configuration, provided attributes will be used to fulfill API requests.
@@ -411,6 +411,9 @@ paypal.currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,N
credit.currency = "USD"
debit.currency = "USD"
+[pm_filters.facilitapay]
+pix = { country = "BR", currency = "BRL" }
+
[pm_filters.helcim]
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
diff --git a/config/development.toml b/config/development.toml
index 37c496efba..f271f70fca 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -574,6 +574,9 @@ paypal = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,B
[pm_filters.braintree]
paypal = { currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,NOK,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
+[pm_filters.facilitapay]
+pix = { country = "BR", currency = "BRL" }
+
[pm_filters.helcim]
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
@@ -751,7 +754,7 @@ nexixpay = { payment_method = "card" }
redsys = { payment_method = "card" }
[connector_customer]
-connector_list = "gocardless,stax,stripe"
+connector_list = "gocardless,stax,stripe,facilitapay"
payout_connector_list = "nomupay,stripe,wise"
[dummy_connector]
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 4b0214b8f1..d8f2d4bd34 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -575,6 +575,9 @@ apple_pay = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,B
google_pay = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"}
paypal = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"}
+[pm_filters.facilitapay]
+pix = { country = "BR", currency = "BRL" }
+
[pm_filters.helcim]
credit = { country = "US, CA", currency = "USD, CAD" }
debit = { country = "US, CA", currency = "USD, CAD" }
@@ -713,7 +716,7 @@ card.debit = { connector_list = "cybersource" }
connector_list = "adyen,cybersource,novalnet,stripe,worldpay"
[connector_customer]
-connector_list = "gocardless,stax,stripe"
+connector_list = "gocardless,stax,stripe,facilitapay"
payout_connector_list = "nomupay,stripe,wise"
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 6cadf9651b..ec72060e47 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -241,6 +241,8 @@ pub enum FieldType {
UserBlikCode,
UserBank,
UserBankAccountNumber,
+ UserSourceBankAccountId,
+ UserDestinationBankAccountId,
Text,
DropDown { options: Vec<String> },
UserDateOfBirth,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 011fd7e443..1f7b40de7e 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -19,6 +19,7 @@ use common_utils::{
ext_traits::{ConfigExt, Encode, ValueExt},
hashing::HashedString,
id_type,
+ new_type::MaskedBankAccount,
pii::{self, Email},
types::{MinorUnit, StringMajorUnit},
};
@@ -3413,6 +3414,14 @@ pub enum BankTransferData {
/// CNPJ is a Brazilian company tax identification number
#[schema(value_type = Option<String>, example = "74469027417312")]
cnpj: Option<Secret<String>>,
+
+ /// Source bank account number
+ #[schema(value_type = Option<String>, example = "8b2812f0-d6c8-4073-97bb-9fa964d08bc5")]
+ source_bank_account_id: Option<MaskedBankAccount>,
+
+ /// Destination bank account number
+ #[schema(value_type = Option<String>, example = "9b95f84e-de61-460b-a14b-f23b4e71c97b")]
+ destination_bank_account_id: Option<MaskedBankAccount>,
},
Pse {},
LocalBankTransfer {
diff --git a/crates/api_models/src/payments/additional_info.rs b/crates/api_models/src/payments/additional_info.rs
index 33297e2b34..371bebe598 100644
--- a/crates/api_models/src/payments/additional_info.rs
+++ b/crates/api_models/src/payments/additional_info.rs
@@ -167,6 +167,14 @@ pub struct PixBankTransferAdditionalData {
/// Partially masked CNPJ - CNPJ is a Brazilian company tax identification number
#[schema(value_type = Option<String>, example = "**** 417312")]
pub cnpj: Option<MaskedBankAccount>,
+
+ /// Partially masked source bank account number
+ #[schema(value_type = Option<String>, example = "********-****-4073-****-9fa964d08bc5")]
+ pub source_bank_account_id: Option<MaskedBankAccount>,
+
+ /// Partially masked destination bank account number
+ #[schema(value_type = Option<String>, example = "********-****-460b-****-f23b4e71c97b")]
+ pub destination_bank_account_id: Option<MaskedBankAccount>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index 803daccbd2..87bb4f0bcb 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -84,7 +84,7 @@ pub enum RoutableConnectors {
Dlocal,
Ebanx,
Elavon,
- // Facilitapay,
+ Facilitapay,
Fiserv,
Fiservemea,
Fiuu,
@@ -233,7 +233,7 @@ pub enum Connector {
Dlocal,
Ebanx,
Elavon,
- // Facilitapay,
+ Facilitapay,
Fiserv,
Fiservemea,
Fiuu,
@@ -352,6 +352,7 @@ impl Connector {
| (Self::Iatapay, _)
| (Self::Volt, _)
| (Self::Itaubank, _)
+ | (Self::Facilitapay, _)
)
}
pub fn supports_file_storage_module(self) -> bool {
@@ -397,7 +398,7 @@ impl Connector {
| Self::Dlocal
| Self::Ebanx
| Self::Elavon
- // | Self::Facilitapay
+ | Self::Facilitapay
| Self::Fiserv
| Self::Fiservemea
| Self::Fiuu
@@ -549,7 +550,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Dlocal => Self::Dlocal,
RoutableConnectors::Ebanx => Self::Ebanx,
RoutableConnectors::Elavon => Self::Elavon,
- // RoutableConnectors::Facilitapay => Self::Facilitapay,
+ RoutableConnectors::Facilitapay => Self::Facilitapay,
RoutableConnectors::Fiserv => Self::Fiserv,
RoutableConnectors::Fiservemea => Self::Fiservemea,
RoutableConnectors::Fiuu => Self::Fiuu,
@@ -660,7 +661,7 @@ impl TryFrom<Connector> for RoutableConnectors {
Connector::Dlocal => Ok(Self::Dlocal),
Connector::Ebanx => Ok(Self::Ebanx),
Connector::Elavon => Ok(Self::Elavon),
- // Connector::Facilitapay => Ok(Self::Facilitapay),
+ Connector::Facilitapay => Ok(Self::Facilitapay),
Connector::Fiserv => Ok(Self::Fiserv),
Connector::Fiservemea => Ok(Self::Fiservemea),
Connector::Fiuu => Ok(Self::Fiuu),
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 87c64747c6..48aa9eafd8 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -6607,6 +6607,66 @@ pub enum RomaniaStatesAbbreviation {
ValceaCounty,
}
+#[derive(
+ Debug, Clone, PartialEq, Eq, Serialize, Deserialize, strum::Display, strum::EnumString,
+)]
+pub enum BrazilStatesAbbreviation {
+ #[strum(serialize = "AC")]
+ Acre,
+ #[strum(serialize = "AL")]
+ Alagoas,
+ #[strum(serialize = "AP")]
+ Amapá,
+ #[strum(serialize = "AM")]
+ Amazonas,
+ #[strum(serialize = "BA")]
+ Bahia,
+ #[strum(serialize = "CE")]
+ Ceará,
+ #[strum(serialize = "DF")]
+ DistritoFederal,
+ #[strum(serialize = "ES")]
+ EspíritoSanto,
+ #[strum(serialize = "GO")]
+ Goiás,
+ #[strum(serialize = "MA")]
+ Maranhão,
+ #[strum(serialize = "MT")]
+ MatoGrosso,
+ #[strum(serialize = "MS")]
+ MatoGrossoDoSul,
+ #[strum(serialize = "MG")]
+ MinasGerais,
+ #[strum(serialize = "PA")]
+ Pará,
+ #[strum(serialize = "PB")]
+ Paraíba,
+ #[strum(serialize = "PR")]
+ Paraná,
+ #[strum(serialize = "PE")]
+ Pernambuco,
+ #[strum(serialize = "PI")]
+ Piauí,
+ #[strum(serialize = "RJ")]
+ RioDeJaneiro,
+ #[strum(serialize = "RN")]
+ RioGrandeDoNorte,
+ #[strum(serialize = "RS")]
+ RioGrandeDoSul,
+ #[strum(serialize = "RO")]
+ Rondônia,
+ #[strum(serialize = "RR")]
+ Roraima,
+ #[strum(serialize = "SC")]
+ SantaCatarina,
+ #[strum(serialize = "SP")]
+ SãoPaulo,
+ #[strum(serialize = "SE")]
+ Sergipe,
+ #[strum(serialize = "TO")]
+ Tocantins,
+}
+
#[derive(
Clone,
Copy,
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 71a6020722..5b97473ff0 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -196,7 +196,7 @@ pub struct ConnectorConfig {
pub dlocal: Option<ConnectorTomlConfig>,
pub ebanx_payout: Option<ConnectorTomlConfig>,
pub elavon: Option<ConnectorTomlConfig>,
- // pub facilitapay: Option<ConnectorTomlConfig>,
+ pub facilitapay: Option<ConnectorTomlConfig>,
pub fiserv: Option<ConnectorTomlConfig>,
pub fiservemea: Option<ConnectorTomlConfig>,
pub fiuu: Option<ConnectorTomlConfig>,
@@ -375,7 +375,7 @@ impl ConnectorConfig {
Connector::Dlocal => Ok(connector_data.dlocal),
Connector::Ebanx => Ok(connector_data.ebanx_payout),
Connector::Elavon => Ok(connector_data.elavon),
- // Connector::Facilitapay => Ok(connector_data.facilitapay),
+ Connector::Facilitapay => Ok(connector_data.facilitapay),
Connector::Fiserv => Ok(connector_data.fiserv),
Connector::Fiservemea => Ok(connector_data.fiservemea),
Connector::Fiuu => Ok(connector_data.fiuu),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 5675ad1d76..9ba3e86cac 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -5828,3 +5828,10 @@ type="Text"
api_key="Merchant ID"
key1="Terminal ID"
api_secret="Secret Key"
+
+[facilitapay]
+[[facilitapay.bank_transfer]]
+ payment_method_type = "pix"
+[facilitapay.connector_auth.Bodykey]
+ api_key="Password"
+ key1="Username"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index efc797a5a1..da0fd93f70 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -4353,3 +4353,10 @@ payment_method_type = "UnionPay"
api_key = "Merchant ID"
key1 = "Terminal ID"
api_secret = "Secret Key"
+
+[facilitapay]
+[[facilitapay.bank_transfer]]
+ payment_method_type = "pix"
+[facilitapay.connector_auth.Bodykey]
+ api_key="Password"
+ key1="Username"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 4aa34446cb..a2bdf1863b 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -5800,3 +5800,10 @@ payment_method_type = "UnionPay"
api_key = "Merchant ID"
key1 = "Terminal ID"
api_secret = "Secret Key"
+
+[facilitapay]
+[[facilitapay.bank_transfer]]
+ payment_method_type = "pix"
+[facilitapay.connector_auth.Bodykey]
+ api_key="Password"
+ key1="Username"
diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay.rs
index 7f0ed1a2f0..9b1a6486df 100644
--- a/crates/hyperswitch_connectors/src/connectors/facilitapay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/facilitapay.rs
@@ -1,28 +1,37 @@
+mod requests;
+mod responses;
pub mod transformers;
+use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+ types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector},
};
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
- router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_data::{AccessToken, ErrorResponse, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
- payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ payments::{
+ Authorize, Capture, CreateConnectorCustomer, PSync, PaymentMethodToken, Session,
+ SetupMandate, Void,
+ },
refunds::{Execute, RSync},
},
router_request_types::{
- AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
- PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
- RefundsData, SetupMandateRequestData,
+ AccessTokenRequestData, ConnectorCustomerData, PaymentMethodTokenizationData,
+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,
+ PaymentsSyncData, RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{
- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
- RefundSyncRouterData, RefundsRouterData,
+ ConnectorCustomerRouterData, PaymentsAuthorizeRouterData, PaymentsCaptureRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
},
};
use hyperswitch_interfaces::{
@@ -33,27 +42,41 @@ use hyperswitch_interfaces::{
configs::Connectors,
errors,
events::connector_api_logs::ConnectorEvent,
- types::{self, Response},
+ types::{self, RefreshTokenType, Response},
webhooks,
};
-use masking::{ExposeInterface, Mask};
-use transformers as facilitapay;
+use lazy_static::lazy_static;
+use masking::{Mask, PeekInterface};
+use requests::{
+ FacilitapayAuthRequest, FacilitapayCustomerRequest, FacilitapayPaymentsRequest,
+ FacilitapayRefundRequest, FacilitapayRouterData,
+};
+use responses::{
+ FacilitapayAuthResponse, FacilitapayCustomerResponse, FacilitapayPaymentsResponse,
+ FacilitapayRefundResponse,
+};
+use transformers::parse_facilitapay_error_response;
-use crate::{constants::headers, types::ResponseRouterData, utils};
+use crate::{
+ constants::headers,
+ types::{RefreshTokenRouterData, ResponseRouterData},
+ utils::{self, RefundsRequestData},
+};
#[derive(Clone)]
pub struct Facilitapay {
- amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMajorUnit> + Sync),
}
impl Facilitapay {
pub fn new() -> &'static Self {
&Self {
- amount_converter: &StringMinorUnitForConnector,
+ amount_converter: &StringMajorUnitForConnector,
}
}
}
+impl api::ConnectorCustomer for Facilitapay {}
impl api::Payment for Facilitapay {}
impl api::PaymentSession for Facilitapay {}
impl api::ConnectorAccessToken for Facilitapay {}
@@ -82,13 +105,23 @@ where
req: &RouterData<Flow, Request, Response>,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
- let mut header = vec![(
- headers::CONTENT_TYPE.to_string(),
- self.get_content_type().to_string().into(),
- )];
- let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
- header.append(&mut api_key);
- Ok(header)
+ let access_token = req
+ .access_token
+ .clone()
+ .ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let headers = vec![
+ (
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ ),
+ (
+ headers::AUTHORIZATION.to_string(),
+ format!("Bearer {}", access_token.token.clone().peek()).into_masked(),
+ ),
+ ];
+
+ Ok(headers)
}
}
@@ -99,9 +132,6 @@ impl ConnectorCommon for Facilitapay {
fn get_currency_unit(&self) -> api::CurrencyUnit {
api::CurrencyUnit::Base
- // TODO! Check connector documentation, on which unit they are processing the currency.
- // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor,
- // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base
}
fn common_get_content_type(&self) -> &'static str {
@@ -112,58 +142,201 @@ impl ConnectorCommon for Facilitapay {
connectors.facilitapay.base_url.as_ref()
}
- fn get_auth_header(
+ fn build_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ parse_facilitapay_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<CreateConnectorCustomer, ConnectorCustomerData, PaymentsResponseData>
+ for Facilitapay
+{
+ fn get_headers(
&self,
- auth_type: &ConnectorAuthType,
+ req: &ConnectorCustomerRouterData,
+ connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
- let auth = facilitapay::FacilitapayAuthType::try_from(auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
- Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- auth.api_key.expose().into_masked(),
- )])
+ self.build_headers(req, connectors)
}
- fn build_error_response(
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
&self,
- res: Response,
+ _req: &ConnectorCustomerRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}/subject/people", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &ConnectorCustomerRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = FacilitapayCustomerRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &ConnectorCustomerRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::ConnectorCustomerType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::ConnectorCustomerType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::ConnectorCustomerType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &ConnectorCustomerRouterData,
event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: facilitapay::FacilitapayErrorResponse = res
+ res: Response,
+ ) -> CustomResult<ConnectorCustomerRouterData, errors::ConnectorError>
+ where
+ ConnectorCustomerRouterData: Clone,
+ {
+ let response: FacilitapayCustomerResponse = res
.response
- .parse_struct("FacilitapayErrorResponse")
+ .parse_struct("FacilitapayCustomerResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
- Ok(ErrorResponse {
- status_code: res.status_code,
- code: response.code,
- message: response.message,
- reason: response.reason,
- attempt_status: None,
- connector_transaction_id: None,
- network_advice_code: None,
- network_decline_code: None,
- network_error_message: None,
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
})
}
-}
-impl ConnectorValidation for Facilitapay {
- //TODO: implement functions when support enabled
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
}
+impl ConnectorValidation for Facilitapay {}
+
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Facilitapay {
//TODO: implement sessions flow
}
-impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Facilitapay {}
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Facilitapay {
+ fn get_headers(
+ &self,
+ _req: &RefreshTokenRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ Ok(vec![(
+ headers::CONTENT_TYPE.to_string(),
+ self.common_get_content_type().to_string().into(),
+ )])
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefreshTokenRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}/sign_in", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefreshTokenRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = FacilitapayAuthRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &RefreshTokenRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .attach_default_headers()
+ .headers(RefreshTokenType::get_headers(self, req, connectors)?)
+ .url(&RefreshTokenType::get_url(self, req, connectors)?)
+ .set_body(RefreshTokenType::get_request_body(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefreshTokenRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefreshTokenRouterData, errors::ConnectorError> {
+ let response: FacilitapayAuthResponse = res
+ .response
+ .parse_struct("FacilitapayAuthResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ 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 Facilitapay
{
+ fn build_request(
+ &self,
+ _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented(
+ "Setup Mandate flow for Facilitapay".to_string(),
+ )
+ .into())
+ }
}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Facilitapay {
@@ -182,9 +355,9 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
fn get_url(
&self,
_req: &PaymentsAuthorizeRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}/transactions", self.base_url(connectors)))
}
fn get_request_body(
@@ -198,9 +371,9 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req.request.currency,
)?;
- let connector_router_data = facilitapay::FacilitapayRouterData::from((amount, req));
- let connector_req =
- facilitapay::FacilitapayPaymentsRequest::try_from(&connector_router_data)?;
+ let connector_router_data = FacilitapayRouterData::from((amount, req));
+ let connector_req = FacilitapayPaymentsRequest::try_from(&connector_router_data)?;
+
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -232,12 +405,14 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: facilitapay::FacilitapayPaymentsResponse = res
+ let response: FacilitapayPaymentsResponse = res
.response
- .parse_struct("Facilitapay PaymentsAuthorizeResponse")
+ .parse_struct("FacilitapayPaymentsAuthorizeResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
@@ -269,10 +444,19 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Fac
fn get_url(
&self,
- _req: &PaymentsSyncRouterData,
- _connectors: &Connectors,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let connector_transaction_id = req
+ .request
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
+ Ok(format!(
+ "{}/transactions/{}",
+ self.base_url(connectors),
+ connector_transaction_id
+ ))
}
fn build_request(
@@ -296,12 +480,14 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Fac
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
- let response: facilitapay::FacilitapayPaymentsResponse = res
+ let response: FacilitapayPaymentsResponse = res
.response
- .parse_struct("facilitapay PaymentsSyncResponse")
+ .parse_struct("FacilitapayPaymentsSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
@@ -373,9 +559,9 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
- let response: facilitapay::FacilitapayPaymentsResponse = res
+ let response: FacilitapayPaymentsResponse = res
.response
- .parse_struct("Facilitapay PaymentsCaptureResponse")
+ .parse_struct("FacilitapayPaymentsCaptureResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
@@ -412,10 +598,14 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Facilit
fn get_url(
&self,
- _req: &RefundsRouterData<Execute>,
- _connectors: &Connectors,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!(
+ "{}/transactions/{}/refund_received_transaction",
+ self.base_url(connectors),
+ req.request.connector_transaction_id
+ ))
}
fn get_request_body(
@@ -429,9 +619,8 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Facilit
req.request.currency,
)?;
- let connector_router_data = facilitapay::FacilitapayRouterData::from((refund_amount, req));
- let connector_req =
- facilitapay::FacilitapayRefundRequest::try_from(&connector_router_data)?;
+ let connector_router_data = FacilitapayRouterData::from((refund_amount, req));
+ let connector_req = FacilitapayRefundRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -460,9 +649,9 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Facilit
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
- let response: facilitapay::RefundResponse = res
+ let response: FacilitapayRefundResponse = res
.response
- .parse_struct("facilitapay RefundResponse")
+ .parse_struct("FacilitapayRefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
@@ -497,10 +686,16 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Facilitap
fn get_url(
&self,
- _req: &RefundSyncRouterData,
- _connectors: &Connectors,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let refund_id = req.request.get_connector_refund_id()?;
+ Ok(format!(
+ "{}/transactions/{}/refund_received_transaction/{}",
+ self.base_url(connectors),
+ req.request.connector_transaction_id,
+ refund_id
+ ))
}
fn build_request(
@@ -514,9 +709,6 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Facilitap
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundSyncType::get_headers(self, req, connectors)?)
- .set_body(types::RefundSyncType::get_request_body(
- self, req, connectors,
- )?)
.build(),
))
}
@@ -527,9 +719,9 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Facilitap
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
- let response: facilitapay::RefundResponse = res
+ let response: FacilitapayRefundResponse = res
.response
- .parse_struct("facilitapay RefundSyncResponse")
+ .parse_struct("FacilitapayRefundSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
@@ -573,4 +765,48 @@ impl webhooks::IncomingWebhook for Facilitapay {
}
}
-impl ConnectorSpecifications for Facilitapay {}
+lazy_static! {
+ static ref FACILITAPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name:
+ "Facilitapay",
+ description:
+ "FacilitaPay, the best and most reliable payment provider for your international business.",
+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,
+ };
+ static ref FACILITAPAY_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+ let facilitapay_supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let mut facilitapay_supported_payment_methods = SupportedPaymentMethods::new();
+
+ facilitapay_supported_payment_methods.add(
+ enums::PaymentMethod::BankTransfer,
+ enums::PaymentMethodType::Pix,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: facilitapay_supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ facilitapay_supported_payment_methods
+ };
+ static ref FACILITAPAY_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
+}
+
+impl ConnectorSpecifications for Facilitapay {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&*FACILITAPAY_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*FACILITAPAY_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&*FACILITAPAY_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay/requests.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay/requests.rs
new file mode 100644
index 0000000000..29c2f34f33
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/facilitapay/requests.rs
@@ -0,0 +1,150 @@
+use common_enums::CountryAlpha2;
+use common_utils::{new_type::MaskedBankAccount, pii, types::StringMajorUnit};
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+use time::PrimitiveDateTime;
+
+pub struct FacilitapayRouterData<T> {
+ pub amount: StringMajorUnit,
+ pub router_data: T,
+}
+
+#[derive(Debug, Serialize)]
+pub struct FacilitapayAuthRequest {
+ pub user: FacilitapayCredentials,
+}
+
+#[derive(Debug, Serialize)]
+pub struct FacilitapayCredentials {
+ pub username: Secret<String>, // email_id
+ pub password: Secret<String>,
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+pub struct FacilitapayCardDetails {
+ #[serde(rename = "card_number")]
+ pub number: cards::CardNumber,
+ #[serde(rename = "card_expiration_date")]
+ pub expiry_date: Secret<String>, // Format: "MM/YYYY"
+ #[serde(rename = "card_security_code")]
+ pub cvc: Secret<String>,
+ #[serde(rename = "card_brand")]
+ pub brand: String,
+ pub fullname: Secret<String>,
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+pub struct CardTransactionRequest {
+ pub currency: api_models::enums::Currency,
+ pub exchange_currency: api_models::enums::Currency,
+ pub value: StringMajorUnit,
+ pub from_credit_card: FacilitapayCardDetails,
+ pub to_bank_account_id: Secret<String>, // UUID
+ pub subject_id: String, // UUID
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+pub struct PixTransactionRequest {
+ pub subject_id: Secret<String>, // Customer ID (UUID)
+ pub from_bank_account_id: MaskedBankAccount, // UUID
+ pub to_bank_account_id: MaskedBankAccount, // UUID
+ pub currency: api_models::enums::Currency,
+ pub exchange_currency: api_models::enums::Currency,
+ pub value: StringMajorUnit,
+ pub use_dynamic_pix: bool,
+ #[serde(default, with = "common_utils::custom_serde::iso8601")]
+ pub dynamic_pix_expires_at: PrimitiveDateTime,
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+#[serde(untagged)]
+pub enum FacilitapayTransactionRequest {
+ #[allow(dead_code)]
+ Card(CardTransactionRequest),
+ Pix(PixTransactionRequest),
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+pub struct FacilitapayPaymentsRequest {
+ pub transaction: FacilitapayTransactionRequest,
+}
+
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct FacilitapayRefundRequest {
+ pub amount: StringMajorUnit,
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+#[serde(rename_all = "snake_case")]
+pub struct FacilitapayCustomerRequest {
+ pub person: FacilitapayPerson,
+}
+
+#[derive(Debug, Serialize, Clone, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "snake_case")]
+pub enum DocumentType {
+ /// CC is the Cedula de Ciudadania, is a 10-digit number, which is the national identity card for Colombian citizens.
+ /// It is used for citizen identification purposes.
+ #[serde(rename = "cc")]
+ CedulaDeCiudadania,
+ /// CNPJ stands for Cadastro Nacional da Pessoa Jurídica, is a 14-digit number,
+ /// which is the national registry of legal entities in Brazil used as a unique identifier for Brazilian companies.
+ #[serde(rename = "cnpj")]
+ CadastroNacionaldaPessoaJurídica,
+ /// CPF stands for Cadastro de Pessoas Físicas, is a 11-digit number,
+ /// which is the national registry of natural persons in Brazil used as a unique identifier for Brazilian citizens.
+ #[serde(rename = "cpf")]
+ CadastrodePessoasFísicas,
+ /// CURP stands for Clave Única de Registro de Población,is a 18-digit number used as a unique identifier for Mexican citizens.
+ /// It is used to track tax information and other identification purposes by the government.
+ #[serde(rename = "curp")]
+ ClaveÚnicadeRegistrodePoblación,
+ /// NIT is the Número de Identificación Tributaria, is a 10-digit number, which is the tax identification number in Colombia. Used for companies.
+ #[serde(rename = "nit")]
+ NúmerodeIdentificaciónTributaria,
+ /// Passport is the travel document usually issued by a country's government
+ Passport,
+ /// RFC stands for Registro Federal de Contribuyentes, is a 13-digit number used as a unique identifier for Mexican companies.
+ #[serde(rename = "rfc")]
+ RegistroFederaldeContribuyentes,
+ /// RUT stands for Rol Unico Tributario, is a 9-digit number used as a unique identifier for Chilean citizens and companies.
+ #[serde(rename = "rut")]
+ RolUnicoTributario,
+ /// A Taxpayer Identification Number is an identifying number used for tax purposes
+ TaxId,
+}
+
+#[derive(Debug, Serialize, PartialEq)]
+#[serde(rename_all = "snake_case")]
+pub struct FacilitapayPerson {
+ pub document_number: Secret<String>,
+ pub document_type: DocumentType,
+ pub social_name: Secret<String>,
+ pub fiscal_country: CountryAlpha2,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub email: Option<pii::Email>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub birth_date: Option<time::Date>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub phone_country_code: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub phone_area_code: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub phone_number: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub address_city: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub address_state: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub address_complement: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub address_country: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub address_number: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub address_postal_code: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub address_street: Option<Secret<String>>,
+ pub net_monthly_average_income: Option<StringMajorUnit>,
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs
new file mode 100644
index 0000000000..dfa01402ce
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs
@@ -0,0 +1,217 @@
+use common_utils::{pii, types::StringMajorUnit};
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use super::requests::DocumentType;
+
+// Response body for POST /sign_in
+#[derive(Debug, Deserialize, Serialize)]
+pub struct FacilitapayAuthResponse {
+ username: Secret<String>,
+ name: Secret<String>,
+ pub jwt: Secret<String>,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
+#[serde(rename_all = "snake_case")]
+pub enum SubjectKycStatus {
+ // Customer is able to send/receive money through the platform. No action is needed on your side.
+ Approved,
+
+ // Customer is required to upload documents or uploaded documents have been rejected by KYC.
+ Reproved,
+
+ // Customer has uploaded KYC documents but awaiting analysis from the backoffice. No action is needed on your side.
+ WaitingApproval,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "snake_case")]
+pub struct FacilitapaySubject {
+ pub social_name: Secret<String>,
+ pub document_type: DocumentType,
+ pub document_number: Secret<String>,
+ // In documentation, both CountryAlpha2 and String are used. We cannot rely on CountryAlpha2.
+ pub fiscal_country: String,
+ pub updated_at: Option<String>,
+ pub status: SubjectKycStatus,
+ #[serde(rename = "id")]
+ pub customer_id: Secret<String>,
+ pub birth_date: Option<time::Date>,
+ pub email: Option<pii::Email>,
+ pub phone_country_code: Option<Secret<String>>,
+ pub phone_area_code: Option<Secret<String>>,
+ pub phone_number: Option<Secret<String>>,
+ pub address_street: Option<Secret<String>>,
+ pub address_number: Option<Secret<String>>,
+ pub address_complement: Option<Secret<String>>,
+ pub address_city: Option<String>,
+ pub address_state: Option<String>,
+ pub address_postal_code: Option<Secret<String>>,
+ pub address_country: Option<String>,
+ pub address_neighborhood: Option<Secret<String>>,
+ pub net_monthly_average_income: Option<StringMajorUnit>,
+ pub clearance_level: Option<i32>,
+ pub required_clearance_level: Option<i32>,
+ pub inserted_at: Option<String>,
+ pub references: Option<Vec<serde_json::Value>>,
+ pub rfc_pf: Option<Secret<String>>, // 13-digit RFC, specific to Mexico users
+ pub documents: Option<Vec<serde_json::Value>>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "snake_case")]
+pub struct FacilitapayCustomerResponse {
+ pub data: FacilitapaySubject,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct PixInfo {
+ #[serde(rename = "type")]
+ pub key_type: String,
+ pub key: Secret<String>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct CreditCardResponseInfo {
+ pub id: String,
+ pub status: Option<String>,
+ pub document_type: String,
+ pub document_number: Secret<String>,
+ pub birthdate: Option<String>,
+ pub phone_country_code: Option<String>,
+ pub phone_area_code: Option<String>,
+ pub phone_number: Option<Secret<String>>,
+ pub inserted_at: Option<String>,
+}
+
+// PaymentsResponse
+#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "snake_case")]
+#[derive(strum::Display)]
+pub enum FacilitapayPaymentStatus {
+ /// Transaction has been created but it is waiting for an incoming TED/Wire.
+ /// This is the first recorded status in production mode.
+ #[default]
+ Pending,
+ /// Incoming TED/Wire has been identified into Facilita´s bank account.
+ /// When it is a deposit into an internal bank account and there is no
+ /// conversion involved (BRL to BRL for instance), that is the final state.
+ Identified,
+ /// The conversion rate has been closed and therefore the exchanged value
+ /// is defined - when it is a deposit into an internal bank account, that is the final state.
+ Exchanged,
+ /// The exchanged value has been wired to its destination (a real bank account) - that is also a final state.
+ Wired,
+ /// When for any reason the transaction cannot be concluded or need to be reversed, it is canceled.
+ #[serde(rename = "canceled")]
+ Cancelled,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct FacilitapayPaymentsResponse {
+ pub data: TransactionData,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct OwnerCompany {
+ pub social_name: Option<Secret<String>>,
+ #[serde(rename = "id")]
+ pub company_id: Option<String>,
+ pub document_type: DocumentType,
+ pub document_number: Secret<String>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct BankInfo {
+ pub swift: Option<Secret<String>>,
+ pub name: Option<String>,
+ #[serde(rename = "id")]
+ pub bank_id: Secret<String>,
+ pub code: Option<Secret<String>>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct BankAccountDetail {
+ pub routing_number: Option<Secret<String>>,
+ pub pix_info: Option<PixInfo>,
+ pub owner_name: Option<Secret<String>>,
+ pub owner_document_number: Option<Secret<String>>,
+ pub owner_company: Option<OwnerCompany>,
+ pub internal: Option<bool>,
+ pub intermediary_bank_account: Option<Secret<String>>,
+ pub intermediary_bank_account_id: Option<Secret<String>>,
+ #[serde(rename = "id")]
+ pub bank_account_id: Secret<String>,
+ pub iban: Option<Secret<String>>,
+ pub flow_type: Option<String>,
+ pub currency: api_models::enums::Currency,
+ pub branch_number: Option<Secret<String>>,
+ pub branch_country: Option<String>,
+ pub bank: Option<BankInfo>,
+ pub account_type: Option<String>,
+ pub account_number: Option<Secret<String>>,
+ pub aba: Option<String>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct TransactionData {
+ #[serde(rename = "id")]
+ pub transaction_id: String,
+ pub value: StringMajorUnit,
+ pub status: FacilitapayPaymentStatus,
+ pub currency: api_models::enums::Currency,
+ pub exchange_currency: api_models::enums::Currency,
+
+ // Details about the destination account (Required)
+ pub to_bank_account: BankAccountDetail,
+
+ // Details about the source - mutually exclusive
+ pub from_credit_card: Option<CreditCardResponseInfo>,
+ pub from_bank_account: Option<BankAccountDetail>, // Populated for PIX
+
+ // Subject information (customer)
+ pub subject_id: String,
+ pub subject: Option<FacilitapaySubject>,
+ pub subject_is_receiver: Option<bool>,
+
+ // Source identification (potentially redundant with subject or card/bank info)
+ pub source_name: Secret<String>,
+ pub source_document_type: DocumentType,
+ pub source_document_number: Secret<String>,
+
+ // Timestamps and flags
+ pub inserted_at: Option<String>,
+ pub for_exchange: Option<bool>,
+ pub exchange_under_request: Option<bool>,
+ pub estimated_value_until_exchange: Option<bool>,
+ pub cleared: Option<bool>,
+
+ // PIX specific field
+ pub dynamic_pix_code: Option<String>, // QR code string for PIX
+
+ // Exchange details
+ pub exchanged_value: Option<StringMajorUnit>,
+
+ // Cancelation details
+ #[serde(rename = "canceled_reason")]
+ pub cancelled_reason: Option<String>,
+ #[serde(rename = "canceled_at")]
+ pub cancelled_at: Option<String>,
+
+ // Other fields
+ pub bank_transaction: Option<Secret<serde_json::Value>>,
+ pub meta: Option<serde_json::Value>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct RefundData {
+ #[serde(rename = "id")]
+ pub refund_id: String,
+ pub status: FacilitapayPaymentStatus,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct FacilitapayRefundResponse {
+ pub data: RefundData,
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
index 81c2f752d3..a123b4796c 100644
--- a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
@@ -1,31 +1,45 @@
-use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use api_models::payments::QrCodeInformation;
+use common_enums::{enums, PaymentMethod};
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::{BytesExt, Encode},
+ types::StringMajorUnit,
+};
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
- payment_method_data::PaymentMethodData,
- router_data::{ConnectorAuthType, RouterData},
+ payment_method_data::{BankTransferData, PaymentMethodData},
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::refunds::{Execute, RSync},
router_request_types::ResponseId,
router_response_types::{PaymentsResponseData, RefundsResponseData},
- types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+ types,
+};
+use hyperswitch_interfaces::{
+ consts, errors, events::connector_api_logs::ConnectorEvent, types::Response,
};
-use hyperswitch_interfaces::errors;
-use masking::Secret;
-use serde::{Deserialize, Serialize};
+use masking::{ExposeInterface, Secret};
+use time::PrimitiveDateTime;
+use url::Url;
+use super::{
+ requests::{
+ DocumentType, FacilitapayAuthRequest, FacilitapayCredentials, FacilitapayCustomerRequest,
+ FacilitapayPaymentsRequest, FacilitapayPerson, FacilitapayRefundRequest,
+ FacilitapayRouterData, FacilitapayTransactionRequest, PixTransactionRequest,
+ },
+ responses::{
+ FacilitapayAuthResponse, FacilitapayCustomerResponse, FacilitapayPaymentStatus,
+ FacilitapayPaymentsResponse, FacilitapayRefundResponse,
+ },
+};
use crate::{
- types::{RefundsResponseRouterData, ResponseRouterData},
- utils::PaymentsAuthorizeRequestData,
+ types::{RefreshTokenRouterData, RefundsResponseRouterData, ResponseRouterData},
+ utils::{is_payment_failure, missing_field_err, QrImage, RouterData as OtherRouterData},
};
+type Error = error_stack::Report<errors::ConnectorError>;
-//TODO: Fill the struct with respective fields
-pub struct FacilitapayRouterData<T> {
- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
- pub router_data: T,
-}
-
-impl<T> From<(StringMinorUnit, T)> for FacilitapayRouterData<T> {
- fn from((amount, item): (StringMinorUnit, T)) -> Self {
- //Todo : use utils to convert the amount to the type of amount that a connector accepts
+impl<T> From<(StringMajorUnit, T)> for FacilitapayRouterData<T> {
+ fn from((amount, item): (StringMajorUnit, T)) -> Self {
Self {
amount,
router_data: item,
@@ -33,196 +47,491 @@ impl<T> From<(StringMinorUnit, T)> for FacilitapayRouterData<T> {
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, PartialEq)]
-pub struct FacilitapayPaymentsRequest {
- amount: StringMinorUnit,
- card: FacilitapayCard,
-}
-
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct FacilitapayCard {
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- cvc: Secret<String>,
- complete: bool,
-}
-
-impl TryFrom<&FacilitapayRouterData<&PaymentsAuthorizeRouterData>> for FacilitapayPaymentsRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
+impl TryFrom<&FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>>
+ for FacilitapayPaymentsRequest
+{
+ type Error = Error;
fn try_from(
- item: &FacilitapayRouterData<&PaymentsAuthorizeRouterData>,
+ item: &FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
- PaymentMethodData::Card(req_card) => {
- let card = FacilitapayCard {
- number: req_card.card_number,
- expiry_month: req_card.card_exp_month,
- expiry_year: req_card.card_exp_year,
- cvc: req_card.card_cvc,
- complete: item.router_data.request.is_auto_capture()?,
- };
- Ok(Self {
- amount: item.amount.clone(),
- card,
- })
+ PaymentMethodData::BankTransfer(bank_transfer_data) => match *bank_transfer_data {
+ BankTransferData::Pix {
+ source_bank_account_id,
+ destination_bank_account_id,
+ ..
+ } => {
+ // Set expiry time to 15 minutes from now
+ let dynamic_pix_expires_at = {
+ let now = time::OffsetDateTime::now_utc();
+ let expires_at = now + time::Duration::minutes(15);
+
+ PrimitiveDateTime::new(expires_at.date(), expires_at.time())
+ };
+
+ let transaction_data =
+ FacilitapayTransactionRequest::Pix(PixTransactionRequest {
+ // subject id must be generated by pre-process step and link with customer id
+ // might require discussions to be done
+ subject_id: item.router_data.get_connector_customer_id()?.into(),
+ from_bank_account_id: source_bank_account_id.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "source bank account id",
+ },
+ )?,
+
+ to_bank_account_id: destination_bank_account_id.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "destination bank account id",
+ },
+ )?,
+ currency: item.router_data.request.currency,
+ exchange_currency: item.router_data.request.currency,
+ value: item.amount.clone(),
+ use_dynamic_pix: true,
+ // Format: YYYY-MM-DDThh:mm:ssZ
+ dynamic_pix_expires_at,
+ });
+
+ Ok(Self {
+ transaction: transaction_data,
+ })
+ }
+ BankTransferData::AchBankTransfer {}
+ | BankTransferData::SepaBankTransfer {}
+ | BankTransferData::BacsBankTransfer {}
+ | BankTransferData::MultibancoBankTransfer {}
+ | BankTransferData::PermataBankTransfer {}
+ | BankTransferData::BcaBankTransfer {}
+ | BankTransferData::BniVaBankTransfer {}
+ | BankTransferData::BriVaBankTransfer {}
+ | BankTransferData::CimbVaBankTransfer {}
+ | BankTransferData::DanamonVaBankTransfer {}
+ | BankTransferData::MandiriVaBankTransfer {}
+ | BankTransferData::Pse {}
+ | BankTransferData::InstantBankTransfer {}
+ | BankTransferData::LocalBankTransfer { .. } => {
+ Err(errors::ConnectorError::NotImplemented(
+ "Selected payment method through Facilitapay".to_string(),
+ )
+ .into())
+ }
+ },
+ PaymentMethodData::Card(_)
+ | PaymentMethodData::CardRedirect(_)
+ | PaymentMethodData::Wallet(_)
+ | PaymentMethodData::PayLater(_)
+ | PaymentMethodData::BankRedirect(_)
+ | PaymentMethodData::BankDebit(_)
+ | PaymentMethodData::Crypto(_)
+ | PaymentMethodData::MandatePayment
+ | PaymentMethodData::Reward
+ | PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
+ | PaymentMethodData::Upi(_)
+ | PaymentMethodData::Voucher(_)
+ | PaymentMethodData::GiftCard(_)
+ | PaymentMethodData::CardToken(_)
+ | PaymentMethodData::OpenBanking(_)
+ | PaymentMethodData::NetworkToken(_)
+ | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ "Selected payment method through Facilitapay".to_string(),
+ )
+ .into())
}
- _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}
}
-//TODO: Fill the struct with respective fields
+// Helper to build the request from Hyperswitch Auth Type
+impl FacilitapayAuthRequest {
+ fn from_auth_type(auth: &FacilitapayAuthType) -> Self {
+ Self {
+ user: FacilitapayCredentials {
+ username: auth.username.clone(),
+ password: auth.password.clone(),
+ },
+ }
+ }
+}
+
// Auth Struct
+#[derive(Debug, Clone)]
pub struct FacilitapayAuthType {
- pub(super) api_key: Secret<String>,
+ pub(super) username: Secret<String>,
+ pub(super) password: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for FacilitapayAuthType {
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = Error;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
- ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
- api_key: api_key.to_owned(),
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+ username: key1.to_owned(),
+ password: api_key.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
-// PaymentsResponse
-//TODO: Append the remaining status flags
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
-pub enum FacilitapayPaymentStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
+
+impl TryFrom<&RefreshTokenRouterData> for FacilitapayAuthRequest {
+ type Error = Error;
+ fn try_from(item: &RefreshTokenRouterData) -> Result<Self, Self::Error> {
+ let auth_type = FacilitapayAuthType::try_from(&item.connector_auth_type)?;
+ Ok(Self::from_auth_type(&auth_type))
+ }
}
-impl From<FacilitapayPaymentStatus> for common_enums::AttemptStatus {
- fn from(item: FacilitapayPaymentStatus) -> Self {
- match item {
- FacilitapayPaymentStatus::Succeeded => Self::Charged,
- FacilitapayPaymentStatus::Failed => Self::Failure,
- FacilitapayPaymentStatus::Processing => Self::Authorizing,
+fn convert_to_document_type(document_type: &str) -> Result<DocumentType, errors::ConnectorError> {
+ match document_type.to_lowercase().as_str() {
+ "cc" => Ok(DocumentType::CedulaDeCiudadania),
+ "cnpj" => Ok(DocumentType::CadastroNacionaldaPessoaJurídica),
+ "cpf" => Ok(DocumentType::CadastrodePessoasFísicas),
+ "curp" => Ok(DocumentType::ClaveÚnicadeRegistrodePoblación),
+ "nit" => Ok(DocumentType::NúmerodeIdentificaciónTributaria),
+ "passport" => Ok(DocumentType::Passport),
+ "rfc" => Ok(DocumentType::RegistroFederaldeContribuyentes),
+ "rut" => Ok(DocumentType::RolUnicoTributario),
+ "tax_id" | "taxid" => Ok(DocumentType::TaxId),
+ _ => Err(errors::ConnectorError::NotSupported {
+ message: format!("Document type '{document_type}'"),
+ connector: "Facilitapay",
+ }),
+ }
+}
+
+pub fn parse_facilitapay_error_response(
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let status_code = res.status_code;
+ let response_body_bytes = res.response.clone();
+
+ let (message, raw_error) =
+ match response_body_bytes.parse_struct::<serde_json::Value>("FacilitapayErrorResponse") {
+ Ok(json_value) => {
+ event_builder.map(|i| i.set_response_body(&json_value));
+
+ let message = extract_message_from_json(&json_value);
+ (
+ message,
+ serde_json::to_string(&json_value).unwrap_or_default(),
+ )
+ }
+ Err(_) => match String::from_utf8(response_body_bytes.to_vec()) {
+ Ok(text) => {
+ event_builder.map(|i| i.set_response_body(&text));
+ (text.clone(), text)
+ }
+ Err(_) => (
+ "Invalid response format received".to_string(),
+ format!(
+ "Unable to parse response as JSON or UTF-8 string. Status code: {}",
+ status_code
+ ),
+ ),
+ },
+ };
+
+ Ok(ErrorResponse {
+ status_code,
+ code: consts::NO_ERROR_CODE.to_string(),
+ message,
+ reason: Some(raw_error),
+ attempt_status: None,
+ connector_transaction_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ })
+}
+
+// Helper function to extract a readable message from JSON error
+fn extract_message_from_json(json: &serde_json::Value) -> String {
+ if let Some(obj) = json.as_object() {
+ if let Some(error) = obj.get("error").and_then(|e| e.as_str()) {
+ return error.to_string();
+ }
+
+ if obj.contains_key("errors") {
+ return "Validation error occurred".to_string();
}
+
+ if !obj.is_empty() {
+ return obj
+ .iter()
+ .next()
+ .map(|(k, v)| format!("{}: {}", k, v))
+ .unwrap_or_else(|| "Unknown error".to_string());
+ }
+ } else if let Some(s) = json.as_str() {
+ return s.to_string();
}
+
+ "Unknown error format".to_string()
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct FacilitapayPaymentsResponse {
- status: FacilitapayPaymentStatus,
- id: String,
+impl TryFrom<&types::ConnectorCustomerRouterData> for FacilitapayCustomerRequest {
+ type Error = Error;
+ fn try_from(item: &types::ConnectorCustomerRouterData) -> Result<Self, Self::Error> {
+ let email = item.request.email.clone();
+
+ let social_name = item.get_billing_full_name()?;
+
+ let (document_type, document_number) = match item.request.payment_method_data.clone() {
+ PaymentMethodData::BankTransfer(bank_transfer_data) => match *bank_transfer_data {
+ BankTransferData::Pix { cpf, .. } => {
+ // Extract only digits from the CPF string
+ let document_number =
+ cpf.ok_or_else(missing_field_err("cpf"))?.map(|cpf_number| {
+ cpf_number
+ .chars()
+ .filter(|chars| chars.is_ascii_digit())
+ .collect::<String>()
+ });
+
+ let document_type = convert_to_document_type("cpf")?;
+ (document_type, document_number)
+ }
+ _ => {
+ return Err(errors::ConnectorError::NotImplemented(
+ "Selected payment method through Facilitapay".to_string(),
+ )
+ .into())
+ }
+ },
+ _ => {
+ return Err(errors::ConnectorError::NotImplemented(
+ "Selected payment method through Facilitapay".to_string(),
+ )
+ .into())
+ }
+ };
+
+ let fiscal_country = item.get_billing_country()?;
+
+ let person = FacilitapayPerson {
+ document_number,
+ document_type,
+ social_name,
+ fiscal_country,
+ email,
+ birth_date: None,
+ phone_country_code: None,
+ phone_area_code: None,
+ phone_number: None,
+ address_city: None,
+ address_state: None,
+ address_complement: None,
+ address_country: None,
+ address_number: None,
+ address_postal_code: None,
+ address_street: None,
+ net_monthly_average_income: None,
+ };
+
+ Ok(Self { person })
+ }
}
-impl<F, T> TryFrom<ResponseRouterData<F, FacilitapayPaymentsResponse, T, PaymentsResponseData>>
+impl<F, T> TryFrom<ResponseRouterData<F, FacilitapayCustomerResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
- type Error = error_stack::Report<errors::ConnectorError>;
+ type Error = Error;
fn try_from(
- item: ResponseRouterData<F, FacilitapayPaymentsResponse, T, PaymentsResponseData>,
+ item: ResponseRouterData<F, FacilitapayCustomerResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
Ok(Self {
- status: common_enums::AttemptStatus::from(item.response.status),
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.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,
+ response: Ok(PaymentsResponseData::ConnectorCustomerResponse {
+ connector_customer_id: item.response.data.customer_id.expose(),
}),
..item.data
})
}
}
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
-pub struct FacilitapayRefundRequest {
- pub amount: StringMinorUnit,
+impl From<FacilitapayPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: FacilitapayPaymentStatus) -> Self {
+ match item {
+ FacilitapayPaymentStatus::Pending => Self::Pending,
+ FacilitapayPaymentStatus::Identified
+ | FacilitapayPaymentStatus::Exchanged
+ | FacilitapayPaymentStatus::Wired => Self::Charged,
+ FacilitapayPaymentStatus::Cancelled => Self::Failure,
+ }
+ }
}
-impl<F> TryFrom<&FacilitapayRouterData<&RefundsRouterData<F>>> for FacilitapayRefundRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &FacilitapayRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+impl<F, T> TryFrom<ResponseRouterData<F, FacilitapayAuthResponse, T, AccessToken>>
+ for RouterData<F, T, AccessToken>
+{
+ type Error = Error;
+ fn try_from(
+ item: ResponseRouterData<F, FacilitapayAuthResponse, T, AccessToken>,
+ ) -> Result<Self, Self::Error> {
Ok(Self {
- amount: item.amount.to_owned(),
+ response: Ok(AccessToken {
+ token: item.response.jwt,
+ expires: 86400, // Facilitapay docs say 24 hours validity. 24 * 60 * 60 = 86400 seconds.
+ }),
+ ..item.data
})
}
}
-// Type definition for Refund Response
+impl<F, T> TryFrom<ResponseRouterData<F, FacilitapayPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = Error;
+ fn try_from(
+ item: ResponseRouterData<F, FacilitapayPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let status = if item.data.payment_method == PaymentMethod::BankTransfer
+ && item.response.data.status == FacilitapayPaymentStatus::Identified
+ {
+ common_enums::AttemptStatus::AuthenticationPending
+ } else {
+ common_enums::AttemptStatus::from(item.response.data.status.clone())
+ };
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
+ Ok(Self {
+ status,
+ response: if is_payment_failure(status) {
+ Err(ErrorResponse {
+ code: item.response.data.status.clone().to_string(),
+ message: item.response.data.status.clone().to_string(),
+ reason: item.response.data.cancelled_reason,
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: Some(item.response.data.transaction_id),
+ network_decline_code: None,
+ network_advice_code: None,
+ network_error_message: None,
+ })
+ } else {
+ Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.response.data.transaction_id.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: get_qr_code_data(&item.response)?,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.data.transaction_id),
+ incremental_authorization_allowed: None,
+ charges: None,
+ })
+ },
+ ..item.data
+ })
+ }
}
-impl From<RefundStatus> for enums::RefundStatus {
- fn from(item: RefundStatus) -> Self {
- match item {
- RefundStatus::Succeeded => Self::Success,
- RefundStatus::Failed => Self::Failure,
- RefundStatus::Processing => Self::Pending,
- //TODO: Review mapping
+fn get_qr_code_data(
+ response: &FacilitapayPaymentsResponse,
+) -> CustomResult<Option<serde_json::Value>, errors::ConnectorError> {
+ let expiration_time: i64 = if let Some(meta) = &response.data.meta {
+ if let Some(due_date_str) = meta
+ .get("dynamic_pix_due_date")
+ .and_then(|due_date_value| due_date_value.as_str())
+ {
+ let datetime = time::OffsetDateTime::parse(
+ due_date_str,
+ &time::format_description::well_known::Rfc3339,
+ )
+ .map_err(|_| errors::ConnectorError::ResponseHandlingFailed)?;
+
+ datetime.unix_timestamp() * 1000
+ } else {
+ // If dynamic_pix_due_date isn't present, use current time + 15 minutes
+ let now = time::OffsetDateTime::now_utc();
+ let expires_at = now + time::Duration::minutes(15);
+ expires_at.unix_timestamp() * 1000
}
+ } else {
+ // If meta is null, use current time + 15 minutes
+ let now = time::OffsetDateTime::now_utc();
+ let expires_at = now + time::Duration::minutes(15);
+ expires_at.unix_timestamp() * 1000
+ };
+
+ let dynamic_pix_code = response.data.dynamic_pix_code.as_ref().ok_or_else(|| {
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "dynamic_pix_code",
+ }
+ })?;
+
+ let image_data = QrImage::new_from_data(dynamic_pix_code.clone())
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
+
+ let image_data_url = Url::parse(image_data.data.clone().as_str())
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
+
+ let qr_code_info = QrCodeInformation::QrDataUrl {
+ image_data_url,
+ display_to_timestamp: Some(expiration_time),
+ };
+
+ Some(qr_code_info.encode_to_value())
+ .transpose()
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+}
+
+impl<F> TryFrom<&FacilitapayRouterData<&types::RefundsRouterData<F>>> for FacilitapayRefundRequest {
+ type Error = Error;
+ fn try_from(
+ item: &FacilitapayRouterData<&types::RefundsRouterData<F>>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.amount.clone(),
+ })
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct RefundResponse {
- id: String,
- status: RefundStatus,
+impl From<FacilitapayPaymentStatus> for enums::RefundStatus {
+ fn from(item: FacilitapayPaymentStatus) -> Self {
+ match item {
+ FacilitapayPaymentStatus::Identified
+ | FacilitapayPaymentStatus::Exchanged
+ | FacilitapayPaymentStatus::Wired => Self::Success,
+ FacilitapayPaymentStatus::Cancelled => Self::Failure,
+ FacilitapayPaymentStatus::Pending => Self::Pending,
+ }
+ }
}
-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
- type Error = error_stack::Report<errors::ConnectorError>;
+impl TryFrom<RefundsResponseRouterData<Execute, FacilitapayRefundResponse>>
+ for types::RefundsRouterData<Execute>
+{
+ type Error = Error;
fn try_from(
- item: RefundsResponseRouterData<Execute, RefundResponse>,
+ item: RefundsResponseRouterData<Execute, FacilitapayRefundResponse>,
) -> Result<Self, Self::Error> {
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.response.data.refund_id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.data.status),
}),
..item.data
})
}
}
-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
- type Error = error_stack::Report<errors::ConnectorError>;
+impl TryFrom<RefundsResponseRouterData<RSync, FacilitapayRefundResponse>>
+ for types::RefundsRouterData<RSync>
+{
+ type Error = Error;
fn try_from(
- item: RefundsResponseRouterData<RSync, RefundResponse>,
+ item: RefundsResponseRouterData<RSync, FacilitapayRefundResponse>,
) -> Result<Self, Self::Error> {
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.response.data.refund_id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.data.status),
}),
..item.data
})
}
}
-
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
-pub struct FacilitapayErrorResponse {
- pub status_code: u16,
- pub code: String,
- pub message: String,
- pub reason: Option<String>,
-}
diff --git a/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
index 4f6cc393fc..0ccf5518aa 100644
--- a/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
@@ -65,7 +65,9 @@ impl TryFrom<&ItaubankRouterData<&types::PaymentsAuthorizeRouterData>> for Itaub
match item.router_data.request.payment_method_data.clone() {
PaymentMethodData::BankTransfer(bank_transfer_data) => {
match *bank_transfer_data {
- BankTransferData::Pix { pix_key, cpf, cnpj } => {
+ BankTransferData::Pix {
+ pix_key, cpf, cnpj, ..
+ } => {
let nome = item.router_data.get_optional_billing_full_name();
// cpf and cnpj are mutually exclusive
let devedor = match (cnpj, cpf) {
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 35d95343ab..c15da20598 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -825,7 +825,6 @@ default_imp_for_create_customer!(
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Elavon,
- connectors::Facilitapay,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 41817d955a..97ac61d647 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -2725,6 +2725,7 @@ default_imp_for_new_connector_integration_revenue_recovery!(
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Elavon,
+ connectors::Facilitapay,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 60cb878d9a..4f0c2eb863 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -13,10 +13,10 @@ use common_enums::{
enums::{
AlbaniaStatesAbbreviation, AndorraStatesAbbreviation, AttemptStatus,
AustriaStatesAbbreviation, BelarusStatesAbbreviation, BelgiumStatesAbbreviation,
- BosniaAndHerzegovinaStatesAbbreviation, BulgariaStatesAbbreviation,
- CanadaStatesAbbreviation, CroatiaStatesAbbreviation, CzechRepublicStatesAbbreviation,
- DenmarkStatesAbbreviation, FinlandStatesAbbreviation, FranceStatesAbbreviation,
- FutureUsage, GermanyStatesAbbreviation, GreeceStatesAbbreviation,
+ BosniaAndHerzegovinaStatesAbbreviation, BrazilStatesAbbreviation,
+ BulgariaStatesAbbreviation, CanadaStatesAbbreviation, CroatiaStatesAbbreviation,
+ CzechRepublicStatesAbbreviation, DenmarkStatesAbbreviation, FinlandStatesAbbreviation,
+ FranceStatesAbbreviation, FutureUsage, GermanyStatesAbbreviation, GreeceStatesAbbreviation,
HungaryStatesAbbreviation, IcelandStatesAbbreviation, IrelandStatesAbbreviation,
ItalyStatesAbbreviation, LatviaStatesAbbreviation, LiechtensteinStatesAbbreviation,
LithuaniaStatesAbbreviation, LuxembourgStatesAbbreviation, MaltaStatesAbbreviation,
@@ -5118,6 +5118,52 @@ impl ForeignTryFrom<String> for UkraineStatesAbbreviation {
}
}
+impl ForeignTryFrom<String> for BrazilStatesAbbreviation {
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "BrazilStatesAbbreviation");
+
+ match state_abbreviation_check {
+ Ok(state_abbreviation) => Ok(state_abbreviation),
+ Err(_) => match value.as_str() {
+ "Acre" => Ok(Self::Acre),
+ "Alagoas" => Ok(Self::Alagoas),
+ "Amapá" => Ok(Self::Amapá),
+ "Amazonas" => Ok(Self::Amazonas),
+ "Bahia" => Ok(Self::Bahia),
+ "Ceará" => Ok(Self::Ceará),
+ "Distrito Federal" => Ok(Self::DistritoFederal),
+ "Espírito Santo" => Ok(Self::EspíritoSanto),
+ "Goiás" => Ok(Self::Goiás),
+ "Maranhão" => Ok(Self::Maranhão),
+ "Mato Grosso" => Ok(Self::MatoGrosso),
+ "Mato Grosso do Sul" => Ok(Self::MatoGrossoDoSul),
+ "Minas Gerais" => Ok(Self::MinasGerais),
+ "Pará" => Ok(Self::Pará),
+ "Paraíba" => Ok(Self::Paraíba),
+ "Paraná" => Ok(Self::Paraná),
+ "Pernambuco" => Ok(Self::Pernambuco),
+ "Piauí" => Ok(Self::Piauí),
+ "Rio de Janeiro" => Ok(Self::RioDeJaneiro),
+ "Rio Grande do Norte" => Ok(Self::RioGrandeDoNorte),
+ "Rio Grande do Sul" => Ok(Self::RioGrandeDoSul),
+ "Rondônia" => Ok(Self::Rondônia),
+ "Roraima" => Ok(Self::Roraima),
+ "Santa Catarina" => Ok(Self::SantaCatarina),
+ "São Paulo" => Ok(Self::SãoPaulo),
+ "Sergipe" => Ok(Self::Sergipe),
+ "Tocantins" => Ok(Self::Tocantins),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
+ }
+ .into()),
+ },
+ }
+ }
+}
+
pub trait ForeignTryFrom<F>: Sized {
type Error;
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index f69b9dc685..2d386d0f00 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -18,6 +18,7 @@ use common_utils::{
use masking::{PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use time::Date;
+
// We need to derive Serialize and Deserialize because some parts of payment method data are being
// stored in the database as serde_json::Value
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
@@ -612,6 +613,10 @@ pub enum BankTransferData {
cpf: Option<Secret<String>>,
/// CNPJ is a Brazilian company tax identification number
cnpj: Option<Secret<String>>,
+ /// Source bank account UUID
+ source_bank_account_id: Option<MaskedBankAccount>,
+ /// Destination bank account UUID.
+ destination_bank_account_id: Option<MaskedBankAccount>,
},
Pse {},
LocalBankTransfer {
@@ -1450,9 +1455,19 @@ impl From<api_models::payments::BankTransferData> for BankTransferData {
api_models::payments::BankTransferData::MandiriVaBankTransfer { .. } => {
Self::MandiriVaBankTransfer {}
}
- api_models::payments::BankTransferData::Pix { pix_key, cpf, cnpj } => {
- Self::Pix { pix_key, cpf, cnpj }
- }
+ api_models::payments::BankTransferData::Pix {
+ pix_key,
+ cpf,
+ cnpj,
+ source_bank_account_id,
+ destination_bank_account_id,
+ } => Self::Pix {
+ pix_key,
+ cpf,
+ cnpj,
+ source_bank_account_id,
+ destination_bank_account_id,
+ },
api_models::payments::BankTransferData::Pse {} => Self::Pse {},
api_models::payments::BankTransferData::LocalBankTransfer { bank_code } => {
Self::LocalBankTransfer { bank_code }
@@ -1478,11 +1493,19 @@ impl From<BankTransferData> for api_models::payments::additional_info::BankTrans
BankTransferData::CimbVaBankTransfer {} => Self::CimbVa {},
BankTransferData::DanamonVaBankTransfer {} => Self::DanamonVa {},
BankTransferData::MandiriVaBankTransfer {} => Self::MandiriVa {},
- BankTransferData::Pix { pix_key, cpf, cnpj } => Self::Pix(Box::new(
+ BankTransferData::Pix {
+ pix_key,
+ cpf,
+ cnpj,
+ source_bank_account_id,
+ destination_bank_account_id,
+ } => Self::Pix(Box::new(
api_models::payments::additional_info::PixBankTransferAdditionalData {
pix_key: pix_key.map(MaskedBankAccount::from),
cpf: cpf.map(MaskedBankAccount::from),
cnpj: cnpj.map(MaskedBankAccount::from),
+ source_bank_account_id,
+ destination_bank_account_id,
},
)),
BankTransferData::Pse {} => Self::Pse {},
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 2f4fb7a801..192d45c8fc 100644
--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs
+++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs
@@ -189,6 +189,8 @@ enum RequiredField {
PixKey,
PixCnpj,
PixCpf,
+ PixSourceBankAccountId,
+ PixDestinationBankAccountId,
GiftCardNumber,
GiftCardCvc,
DcbMsisdn,
@@ -782,6 +784,27 @@ impl RequiredField {
value: None,
},
),
+ Self::PixSourceBankAccountId => (
+ "payment_method_data.bank_transfer.pix.source_bank_account_id".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.bank_transfer.pix.source_bank_account_id"
+ .to_string(),
+ display_name: "source_bank_account_id".to_string(),
+ field_type: FieldType::UserSourceBankAccountId,
+ value: None,
+ },
+ ),
+ Self::PixDestinationBankAccountId => (
+ "payment_method_data.bank_transfer.pix.destination_bank_account_id".to_string(),
+ RequiredFieldInfo {
+ required_field:
+ "payment_method_data.bank_transfer.pix.destination_bank_account_id"
+ .to_string(),
+ display_name: "destination_bank_account_id".to_string(),
+ field_type: FieldType::UserDestinationBankAccountId,
+ value: None,
+ },
+ ),
Self::GiftCardNumber => (
"payment_method_data.gift_card.number".to_string(),
RequiredFieldInfo {
@@ -3068,6 +3091,20 @@ fn get_bank_transfer_required_fields() -> HashMap<enums::PaymentMethodType, Conn
},
),
(Connector::Adyen, fields(vec![], vec![], vec![])),
+ (
+ Connector::Facilitapay,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::from([
+ RequiredField::PixSourceBankAccountId.to_tuple(),
+ RequiredField::PixDestinationBankAccountId.to_tuple(),
+ RequiredField::BillingAddressCountries(vec!["BR"]).to_tuple(),
+ RequiredField::BillingUserFirstName.to_tuple(),
+ RequiredField::BillingUserLastName.to_tuple(),
+ ]),
+ },
+ ),
]),
),
(
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 9ec1d80961..2dfe96ee79 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1371,10 +1371,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
elavon::transformers::ElavonAuthType::try_from(self.auth_type)?;
Ok(())
}
- // api_enums::Connector::Facilitapay => {
- // facilitapay::transformers::FacilitapayAuthType::try_from(self.auth_type)?;
- // Ok(())
- // }
+ api_enums::Connector::Facilitapay => {
+ facilitapay::transformers::FacilitapayAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Fiserv => {
fiserv::transformers::FiservAuthType::try_from(self.auth_type)?;
fiserv::transformers::FiservSessionObject::try_from(self.connector_meta_data)?;
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index b4d3995e99..34a8fba476 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -40,7 +40,6 @@ use error_stack::{report, ResultExt};
use events::EventInfo;
use futures::future::join_all;
use helpers::{decrypt_paze_token, ApplePayData};
-use hyperswitch_domain_models::payments::{payment_intent::CustomerData, ClickToPayMetaData};
#[cfg(feature = "v2")]
use hyperswitch_domain_models::payments::{
PaymentCaptureData, PaymentConfirmData, PaymentIntentData, PaymentStatusData,
@@ -54,6 +53,10 @@ pub use hyperswitch_domain_models::{
router_data::{PaymentMethodToken, RouterData},
router_request_types::CustomerDetails,
};
+use hyperswitch_domain_models::{
+ payments::{payment_intent::CustomerData, ClickToPayMetaData},
+ router_data::AccessToken,
+};
use masking::{ExposeInterface, PeekInterface, Secret};
#[cfg(feature = "v2")]
use operations::ValidateStatusForOperation;
@@ -3052,16 +3055,6 @@ where
// Validating the blocklist guard and generate the fingerprint
blocklist_guard(state, merchant_account, key_store, operation, payment_data).await?;
- let updated_customer = call_create_connector_customer_if_required(
- state,
- customer,
- merchant_account,
- key_store,
- &merchant_connector_account,
- payment_data,
- )
- .await?;
-
#[cfg(feature = "v1")]
let merchant_recipient_data = if let Some(true) = payment_data
.get_payment_intent()
@@ -3114,6 +3107,22 @@ where
&call_connector_action,
);
+ let updated_customer = call_create_connector_customer_if_required(
+ state,
+ customer,
+ merchant_account,
+ key_store,
+ &merchant_connector_account,
+ payment_data,
+ router_data.access_token.as_ref(),
+ )
+ .await?;
+
+ #[cfg(feature = "v1")]
+ if let Some(connector_customer_id) = payment_data.get_connector_customer_id() {
+ router_data.connector_customer = Some(connector_customer_id);
+ }
+
router_data.payment_method_token = if let Some(decrypted_token) =
add_decrypted_payment_method_token(tokenization_action.clone(), payment_data).await?
{
@@ -4275,6 +4284,7 @@ pub async fn call_create_connector_customer_if_required<F, Req, D>(
key_store: &domain::MerchantKeyStore,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
payment_data: &mut D,
+ access_token: Option<&AccessToken>,
) -> RouterResult<Option<storage::CustomerUpdate>>
where
F: Send + Clone + Sync,
@@ -4337,7 +4347,7 @@ where
if should_call_connector {
// Create customer at connector and update the customer table to store this data
- let router_data = payment_data
+ let mut customer_router_data = payment_data
.construct_router_data(
state,
connector.connector.id(),
@@ -4350,7 +4360,9 @@ where
)
.await?;
- let connector_customer_id = router_data
+ customer_router_data.access_token = access_token.cloned();
+
+ let connector_customer_id = customer_router_data
.create_connector_customer(state, &connector)
.await?;
@@ -8056,6 +8068,9 @@ pub trait OperationSessionGetters<F> {
fn get_capture_method(&self) -> Option<enums::CaptureMethod>;
fn get_merchant_connector_id_in_attempt(&self) -> Option<id_type::MerchantConnectorAccountId>;
+ #[cfg(feature = "v1")]
+ fn get_connector_customer_id(&self) -> Option<String>;
+
#[cfg(feature = "v1")]
fn get_vault_operation(&self) -> Option<&domain_payments::VaultOperation>;
@@ -8247,6 +8262,11 @@ impl<F: Clone> OperationSessionGetters<F> for PaymentData<F> {
self.vault_operation.as_ref()
}
+ #[cfg(feature = "v1")]
+ fn get_connector_customer_id(&self) -> Option<String> {
+ self.connector_customer_id.clone()
+ }
+
// #[cfg(feature = "v2")]
// fn get_capture_method(&self) -> Option<enums::CaptureMethod> {
// Some(self.payment_intent.capture_method)
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index d0a9e458ff..56519b2647 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -400,9 +400,9 @@ impl ConnectorData {
enums::Connector::Elavon => {
Ok(ConnectorEnum::Old(Box::new(connector::Elavon::new())))
}
- // enums::Connector::Facilitapay => {
- // Ok(ConnectorEnum::Old(Box::new(connector::Facilitapay)))
- // }
+ enums::Connector::Facilitapay => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Facilitapay::new())))
+ }
enums::Connector::Fiserv => {
Ok(ConnectorEnum::Old(Box::new(connector::Fiserv::new())))
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index fbc1897bcb..187f0c864d 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -246,7 +246,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Dlocal => Self::Dlocal,
api_enums::Connector::Ebanx => Self::Ebanx,
api_enums::Connector::Elavon => Self::Elavon,
- // api_enums::Connector::Facilitapay => Self::Facilitapay,
+ api_enums::Connector::Facilitapay => Self::Facilitapay,
api_enums::Connector::Fiserv => Self::Fiserv,
api_enums::Connector::Fiservemea => Self::Fiservemea,
api_enums::Connector::Fiuu => Self::Fiuu,
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 0650e5e6a4..2675c33702 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -47,6 +47,10 @@ key1 = "key1"
api_key = "access_key"
key1 = "secret_key"
+[facilitapay]
+api_key = "password"
+key1 = "username" # email id
+
[fiserv]
api_key = "MyApiKey"
key1 = "MerchantID"
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Facilitapay.js b/cypress-tests/cypress/e2e/configs/Payment/Facilitapay.js
new file mode 100644
index 0000000000..8b8a449bed
--- /dev/null
+++ b/cypress-tests/cypress/e2e/configs/Payment/Facilitapay.js
@@ -0,0 +1,87 @@
+import { isoTimeTomorrow } from "../../../utils/RequestBodyUtils";
+import { getCustomExchange } from "./Modifiers";
+
+const billingAddress = {
+ 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: "9123456789",
+ country_code: "+91",
+ },
+};
+
+export const connectorDetails = {
+ card_pm: {
+ ZeroAuthPaymentIntent: {
+ Request: {
+ currency: "BRL",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ },
+ bank_transfer_pm: {
+ PaymentIntent: {
+ Request: {
+ currency: "BRL",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ Pix: getCustomExchange({
+ Request: {
+ payment_method: "bank_transfer",
+ payment_method_type: "pix",
+ payment_method_data: {
+ bank_transfer: {
+ pix: {
+ // since we pass the same cpf number, the connector customer id will be updated instead of new ones being created
+ cpf: "86665623580",
+ source_bank_account_id: "739d6b0a-e92a-40fd-9f58-6d4cdeb699bb",
+ destination_bank_account_id:
+ "91f5cac1-9058-44b7-80e1-80c6f4a6f0bc",
+ pix_qr_expiry: isoTimeTomorrow(), // 1 day expiration
+ },
+ },
+ },
+ billing: {
+ ...billingAddress,
+ address: {
+ ...billingAddress.address,
+ country: "BR",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ ResponseCustom: {
+ status: 200,
+ body: {
+ error_code: "Cancelled",
+ error_reason: "Unable to generate Pix QRCode",
+ },
+ },
+ }),
+ },
+};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
index bf60ec788e..bd3cf5eeeb 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
@@ -13,6 +13,7 @@ function normalize(input) {
const exceptions = {
bankofamerica: "Bank of America",
cybersource: "Cybersource",
+ facilitapay: "Facilitapay",
paybox: "Paybox",
paypal: "Paypal",
wellsfargo: "Wellsfargo",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 7f44a1e47d..8861fb3dd4 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -1,17 +1,21 @@
import { execConfig, validateConfig } from "../../../utils/featureFlags.js";
+import { updateDefaultStatusCode } from "./Modifiers.js";
+
import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";
import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js";
import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js";
import { connectorDetails as checkoutConnectorDetails } from "./Checkout.js";
import { connectorDetails as commonConnectorDetails } from "./Commons.js";
-import { updateDefaultStatusCode } from "./Modifiers.js";
import { connectorDetails as cybersourceConnectorDetails } from "./Cybersource.js";
import { connectorDetails as datatransConnectorDetails } from "./Datatrans.js";
+import { connectorDetails as deutschebankConnectorDetails } from "./Deutschebank.js";
import { connectorDetails as elavonConnectorDetails } from "./Elavon.js";
+import { connectorDetails as facilitapayConnectorDetails } from "./Facilitapay.js";
import { connectorDetails as fiservemeaConnectorDetails } from "./Fiservemea.js";
import { connectorDetails as fiuuConnectorDetails } from "./Fiuu.js";
import { connectorDetails as getnetConnectorDetails } from "./Getnet.js";
+import { connectorDetails as hipayConnectorDetails } from "./Hipay.js";
import { connectorDetails as iatapayConnectorDetails } from "./Iatapay.js";
import { connectorDetails as itaubankConnectorDetails } from "./ItauBank.js";
import { connectorDetails as jpmorganConnectorDetails } from "./Jpmorgan.js";
@@ -24,11 +28,9 @@ import { connectorDetails as payboxConnectorDetails } from "./Paybox.js";
import { connectorDetails as paypalConnectorDetails } from "./Paypal.js";
import { connectorDetails as redsysConnectorDetails } from "./Redsys.js";
import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";
-import { connectorDetails as HipayConnectorDetails } from "./Hipay.js";
import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js";
import { connectorDetails as wellsfargoConnectorDetails } from "./WellsFargo.js";
import { connectorDetails as worldpayConnectorDetails } from "./WorldPay.js";
-import { connectorDetails as deutschebankConnectorDetails } from "./Deutschebank.js";
import { connectorDetails as xenditConnectorDetails } from "./Xendit.js";
const connectorDetails = {
@@ -38,29 +40,30 @@ const connectorDetails = {
checkout: checkoutConnectorDetails,
commons: commonConnectorDetails,
cybersource: cybersourceConnectorDetails,
+ datatrans: datatransConnectorDetails,
deutschebank: deutschebankConnectorDetails,
+ elavon: elavonConnectorDetails,
+ facilitapay: facilitapayConnectorDetails,
fiservemea: fiservemeaConnectorDetails,
+ fiuu: fiuuConnectorDetails,
getnet: getnetConnectorDetails,
+ hipay: hipayConnectorDetails,
iatapay: iatapayConnectorDetails,
itaubank: itaubankConnectorDetails,
jpmorgan: jpmorganConnectorDetails,
moneris: monerisConnectorDetails,
nexixpay: nexixpayConnectorDetails,
nmi: nmiConnectorDetails,
+ noon: noonConnectorDetails,
novalnet: novalnetConnectorDetails,
paybox: payboxConnectorDetails,
- xendit: xenditConnectorDetails,
paypal: paypalConnectorDetails,
- hipay: HipayConnectorDetails,
redsys: redsysConnectorDetails,
stripe: stripeConnectorDetails,
- elavon: elavonConnectorDetails,
trustpay: trustpayConnectorDetails,
- datatrans: datatransConnectorDetails,
wellsfargo: wellsfargoConnectorDetails,
- fiuu: fiuuConnectorDetails,
worldpay: worldpayConnectorDetails,
- noon: noonConnectorDetails,
+ xendit: xenditConnectorDetails,
};
export default function getConnectorDetails(connectorId) {
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index aa73bff78b..03b5142505 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -96,6 +96,17 @@ function bankTransferRedirection(
break;
case "image_data_url":
switch (connectorId) {
+ case "facilitapay":
+ switch (paymentMethodType) {
+ case "pix":
+ fetchAndParseImageData(redirectionUrl).then((qrCodeData) => {
+ expect(qrCodeData).to.contains("FacilitaPay"); // image data contains the following value
+ });
+ break;
+ default:
+ verifyReturnUrl(redirectionUrl, expectedUrl, true);
+ }
+ break;
case "itaubank":
switch (paymentMethodType) {
case "pix":
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index fc3a777ee6..959a7a90db 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -353,6 +353,9 @@ pix = { country = "BR", currency = "BRL" }
red_compra = { country = "CL", currency = "CLP" }
red_pagos = { country = "UY", currency = "UYU" }
+[pm_filters.facilitapay]
+pix = { country = "BR", currency = "BRL" }
+
[pm_filters.globalpay]
credit = { country = "AF,AX,AL,DZ,AS,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,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,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,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,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,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
debit = { country = "AF,AX,AL,DZ,AS,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,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,SZ,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,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,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,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "AFN,DZD,ARS,AMD,AWG,AUD,AZN,BSD,BHD,THB,PAB,BBD,BYN,BZD,BMD,BOB,BRL,BND,BGN,BIF,CVE,CAD,CLP,COP,KMF,CDF,NIO,CRC,CUP,CZK,GMD,DKK,MKD,DJF,DOP,VND,XCD,EGP,SVC,ETB,EUR,FKP,FJD,HUF,GHS,GIP,HTG,PYG,GNF,GYD,HKD,UAH,ISK,INR,IRR,IQD,JMD,JOD,KES,PGK,HRK,KWD,AOA,MMK,LAK,GEL,LBP,ALL,HNL,SLL,LRD,LYD,SZL,LSL,MGA,MWK,MYR,MUR,MXN,MDL,MAD,MZN,NGN,ERN,NAD,NPR,ANG,ILS,TWD,NZD,BTN,KPW,NOK,TOP,PKR,MOP,UYU,PHP,GBP,BWP,QAR,GTQ,ZAR,OMR,KHR,RON,MVR,IDR,RUB,RWF,SHP,SAR,RSD,SCR,SGD,PEN,SBD,KGS,SOS,TJS,SSP,LKR,SDG,SRD,SEK,CHF,SYP,BDT,WST,TZS,KZT,TTD,MNT,TND,TRY,TMT,AED,UGX,USD,UZS,VUV,KRW,YER,JPY,CNY,ZMW,ZWL,PLN,CLF,STD,CUC" }
@@ -404,7 +407,7 @@ gocardless = { long_lived_token = true, payment_method = "bank_debit" }
billwerk = { long_lived_token = false, payment_method = "card" }
[connector_customer]
-connector_list = "gocardless,stax,stripe"
+connector_list = "gocardless,stax,stripe,facilitapay"
payout_connector_list = "nomupay,wise"
[dummy_connector]
@@ -529,4 +532,4 @@ paybox = { payment_method = "card" }
redsys = { payment_method = "card" }
[billing_connectors_payment_sync]
-billing_connectors_which_require_payment_sync = "stripebilling, recurly"
\ No newline at end of file
+billing_connectors_which_require_payment_sync = "stripebilling, recurly"