Skip to content

Commit faf1ad9

Browse files
committed
Merge branch 'main' of https://github.com/juspay/hyperswitch into home-singout
2 parents 888c964 + 15d6c3e commit faf1ad9

File tree

243 files changed

+4278
-2729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+4278
-2729
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ All notable changes to HyperSwitch will be documented here.
44

55
- - -
66

7+
## 2024.05.31.1
8+
9+
### Features
10+
11+
- **cypress:** Add trustpay, adyen bank redirects and corresponding refactor ([#4766](https://github.com/juspay/hyperswitch/pull/4766)) ([`48dac12`](https://github.com/juspay/hyperswitch/commit/48dac12cedc7f11b76c6a9ef8ba4ce04ae2456bf))
12+
13+
### Refactors
14+
15+
- **core:** Reverts Inclusion of constraint graph for merchant Payment Method list ([#4839](https://github.com/juspay/hyperswitch/pull/4839)) ([`f74b9b6`](https://github.com/juspay/hyperswitch/commit/f74b9b622e5565a00bf9ee8223c64a3def37b776))
16+
- **first_name:** Check if first_name is sent as empty string ([#4832](https://github.com/juspay/hyperswitch/pull/4832)) ([`5cb84f6`](https://github.com/juspay/hyperswitch/commit/5cb84f66e4c59f6ffbd12bf4e91ab0152ac1c2c5))
17+
18+
### Miscellaneous Tasks
19+
20+
- **euclid_wasm:** Update paypal payment experience ([#4811](https://github.com/juspay/hyperswitch/pull/4811)) ([`121b611`](https://github.com/juspay/hyperswitch/commit/121b61123f31db9d94888fa708532cdabca4bbc8))
21+
- Enable `clippy::large_futures` lint ([#4822](https://github.com/juspay/hyperswitch/pull/4822)) ([`d2d317c`](https://github.com/juspay/hyperswitch/commit/d2d317ce61c0c00ca38af9774bd1b45247d30c82))
22+
23+
**Full Changelog:** [`2024.05.31.0...2024.05.31.1`](https://github.com/juspay/hyperswitch/compare/2024.05.31.0...2024.05.31.1)
24+
25+
- - -
26+
727
## 2024.05.31.0
828

929
### Features

config/config.example.toml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ stripe = { banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,ba
263263

264264
# This data is used to call respective connectors for wallets and cards
265265
[connectors.supported]
266-
wallets = ["klarna",
267-
"mifinity", "braintree", "applepay"]
266+
wallets = ["klarna", "mifinity", "braintree", "applepay"]
268267
rewards = ["cashtocode", "zen"]
269268
cards = [
270269
"adyen",
@@ -352,8 +351,8 @@ email_role_arn = "" # The amazon resource name ( arn ) of the role which
352351
sts_role_session_name = "" # An identifier for the assumed role session, used to uniquely identify a session.
353352

354353
[user]
355-
password_validity_in_days = 90 # Number of days after which password should be updated
356-
two_factor_auth_expiry_in_secs = 300 # Number of seconds after which 2FA should be done again if doing update/change from inside
354+
password_validity_in_days = 90 # Number of days after which password should be updated
355+
two_factor_auth_expiry_in_secs = 300 # Number of seconds after which 2FA should be done again if doing update/change from inside
357356

358357
#tokenization configuration which describe token lifetime and payment method for specific connector
359358
[tokenization]
@@ -364,7 +363,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" }
364363
square = { long_lived_token = false, payment_method = "card" }
365364
braintree = { long_lived_token = false, payment_method = "card" }
366365
gocardless = { long_lived_token = true, payment_method = "bank_debit" }
367-
billwerk = {long_lived_token = false, payment_method = "card"}
366+
billwerk = { long_lived_token = false, payment_method = "card" }
368367

369368
[temp_locker_enable_config]
370369
stripe = { payment_method = "bank_transfer" }
@@ -397,16 +396,16 @@ slack_invite_url = "https://www.example.com/" # Slack invite url for hyperswit
397396
discord_invite_url = "https://www.example.com/" # Discord invite url for hyperswitch
398397

399398
[mandates.supported_payment_methods]
400-
card.credit = { connector_list = "stripe,adyen,cybersource,bankofamerica"} # Mandate supported payment method type and connector for card
401-
wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
402-
pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
403-
bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
404-
bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
405-
bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
406-
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
399+
card.credit = { connector_list = "stripe,adyen,cybersource,bankofamerica" } # Mandate supported payment method type and connector for card
400+
wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
401+
pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
402+
bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
403+
bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
404+
bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
405+
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
407406
bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" }
408407
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" }
409-
wallet.google_pay = { connector_list = "bankofamerica"}
408+
wallet.google_pay = { connector_list = "bankofamerica" }
410409
bank_redirect.giropay = { connector_list = "adyen,globalpay" }
411410

412411

@@ -589,6 +588,7 @@ outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webh
589588
dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events
590589
audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events
591590
payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events
591+
consolidated_events_topic = "topic" # Kafka topic to be used for Consolidated events
592592

593593
# File storage configuration
594594
[file_storage]
@@ -629,3 +629,9 @@ disputes = "hyperswitch-dispute-events"
629629

630630
[saved_payment_methods]
631631
sdk_eligible_payment_methods = "card"
632+
633+
[multitenancy]
634+
enabled = false
635+
636+
[multitenancy.tenants]
637+
public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""} # schema -> Postgres db schema, redis_key_prefix -> redis key distinguisher, base_url -> url of the tenant

config/deployments/env_specific.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webh
8181
dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events
8282
audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events
8383
payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events
84+
consolidated_events_topic = "topic" # Kafka topic to be used for Consolidated events
8485

8586
# File storage configuration
8687
[file_storage]
@@ -229,7 +230,6 @@ recon_admin_api_key = "recon_test_admin" # recon_admin API key for recon authent
229230

230231
# Server configuration
231232
[server]
232-
base_url = "https://server_base_url"
233233
workers = 8
234234
port = 8080
235235
host = "127.0.0.1"
@@ -252,3 +252,9 @@ encryption_manager = "aws_kms" # Encryption manager client to be used
252252
[encryption_management.aws_kms]
253253
key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data.
254254
region = "kms_region" # The AWS region used by the KMS SDK for decrypting data.
255+
256+
[multitenancy]
257+
enabled = false
258+
259+
[multitenancy.tenants]
260+
public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}

config/development.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ vault_private_key = ""
8989
tunnel_private_key = ""
9090

9191
[connectors.supported]
92-
wallets = ["klarna",
93-
"mifinity", "braintree", "applepay", "adyen"]
92+
wallets = ["klarna", "mifinity", "braintree", "applepay", "adyen"]
9493
rewards = ["cashtocode", "zen"]
9594
cards = [
9695
"aci",
@@ -559,7 +558,7 @@ redis_lock_expiry_seconds = 180 # 3 * 60 seconds
559558
delay_between_retries_in_milliseconds = 500
560559

561560
[kv_config]
562-
ttl = 900 # 15 * 60 seconds
561+
ttl = 900 # 15 * 60 seconds
563562
soft_kill = false
564563

565564
[frm]
@@ -579,6 +578,7 @@ outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events"
579578
dispute_analytics_topic = "hyperswitch-dispute-events"
580579
audit_events_topic = "hyperswitch-audit-events"
581580
payout_analytics_topic = "hyperswitch-payout-events"
581+
consolidated_events_topic = "hyperswitch-consolidated-events"
582582

583583
[analytics]
584584
source = "sqlx"
@@ -628,3 +628,9 @@ disputes = "hyperswitch-dispute-events"
628628

629629
[saved_payment_methods]
630630
sdk_eligible_payment_methods = "card"
631+
632+
[multitenancy]
633+
enabled = false
634+
635+
[multitenancy.tenants]
636+
public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}

config/docker_compose.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ zsl.base_url = "https://api.sitoffalb.net/"
180180
apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US,KR,VN,MA,ZA,VA,CL,SV,GT,HN,PA", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }
181181

182182
[connectors.supported]
183-
wallets = ["klarna",
184-
"mifinity", "braintree", "applepay"]
183+
wallets = ["klarna", "mifinity", "braintree", "applepay"]
185184
rewards = ["cashtocode", "zen"]
186185
cards = [
187186
"aci",
@@ -239,7 +238,7 @@ cards = [
239238
"worldline",
240239
"worldpay",
241240
"zen",
242-
"zsl"
241+
"zsl",
243242
]
244243

245244
[delayed_session_response]
@@ -269,7 +268,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" }
269268
square = { long_lived_token = false, payment_method = "card" }
270269
braintree = { long_lived_token = false, payment_method = "card" }
271270
gocardless = { long_lived_token = true, payment_method = "bank_debit" }
272-
billwerk = {long_lived_token = false, payment_method = "card"}
271+
billwerk = { long_lived_token = false, payment_method = "card" }
273272

274273
[temp_locker_enable_config]
275274
stripe = { payment_method = "bank_transfer" }
@@ -433,6 +432,7 @@ outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events"
433432
dispute_analytics_topic = "hyperswitch-dispute-events"
434433
audit_events_topic = "hyperswitch-audit-events"
435434
payout_analytics_topic = "hyperswitch-payout-events"
435+
consolidated_events_topic = "hyperswitch-consolidated-events"
436436

437437
[analytics]
438438
source = "sqlx"
@@ -454,7 +454,7 @@ connection_timeout = 10
454454
queue_strategy = "Fifo"
455455

456456
[kv_config]
457-
ttl = 900 # 15 * 60 seconds
457+
ttl = 900 # 15 * 60 seconds
458458
soft_kill = false
459459

460460
[frm]
@@ -492,3 +492,9 @@ disputes = "hyperswitch-dispute-events"
492492

493493
[saved_payment_methods]
494494
sdk_eligible_payment_methods = "card"
495+
496+
[multitenancy]
497+
enabled = false
498+
499+
[multitenancy.tenants]
500+
public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}

crates/analytics/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,20 +601,20 @@ impl AnalyticsProvider {
601601
}
602602
}
603603

604-
pub async fn from_conf(config: &AnalyticsConfig) -> Self {
604+
pub async fn from_conf(config: &AnalyticsConfig, tenant: &str) -> Self {
605605
match config {
606-
AnalyticsConfig::Sqlx { sqlx } => Self::Sqlx(SqlxClient::from_conf(sqlx).await),
606+
AnalyticsConfig::Sqlx { sqlx } => Self::Sqlx(SqlxClient::from_conf(sqlx, tenant).await),
607607
AnalyticsConfig::Clickhouse { clickhouse } => Self::Clickhouse(ClickhouseClient {
608608
config: Arc::new(clickhouse.clone()),
609609
}),
610610
AnalyticsConfig::CombinedCkh { sqlx, clickhouse } => Self::CombinedCkh(
611-
SqlxClient::from_conf(sqlx).await,
611+
SqlxClient::from_conf(sqlx, tenant).await,
612612
ClickhouseClient {
613613
config: Arc::new(clickhouse.clone()),
614614
},
615615
),
616616
AnalyticsConfig::CombinedSqlx { sqlx, clickhouse } => Self::CombinedSqlx(
617-
SqlxClient::from_conf(sqlx).await,
617+
SqlxClient::from_conf(sqlx, tenant).await,
618618
ClickhouseClient {
619619
config: Arc::new(clickhouse.clone()),
620620
},

crates/analytics/src/sqlx.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ use api_models::{
44
analytics::refunds::RefundType,
55
enums::{DisputeStage, DisputeStatus},
66
};
7-
use common_utils::errors::{CustomResult, ParsingError};
7+
use common_utils::{
8+
errors::{CustomResult, ParsingError},
9+
DbConnectionParams,
10+
};
811
use diesel_models::enums::{
912
AttemptStatus, AuthenticationType, Currency, PaymentMethod, RefundStatus,
1013
};
1114
use error_stack::ResultExt;
12-
use masking::PeekInterface;
1315
use sqlx::{
1416
postgres::{PgArgumentBuffer, PgPoolOptions, PgRow, PgTypeInfo, PgValueRef},
1517
Decode, Encode,
@@ -49,12 +51,8 @@ impl Default for SqlxClient {
4951
}
5052

5153
impl SqlxClient {
52-
pub async fn from_conf(conf: &Database) -> Self {
53-
let password = &conf.password.peek();
54-
let database_url = format!(
55-
"postgres://{}:{}@{}:{}/{}",
56-
conf.username, password, conf.host, conf.port, conf.dbname
57-
);
54+
pub async fn from_conf(conf: &Database, schema: &str) -> Self {
55+
let database_url = conf.get_database_url(schema);
5856
#[allow(clippy::expect_used)]
5957
let pool = PgPoolOptions::new()
6058
.max_connections(conf.pool_size)

crates/api_models/src/enums.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ impl Connector {
249249
Self::Checkout | Self::Nmi| Self::Cybersource => true,
250250
}
251251
}
252+
pub fn is_pre_processing_required_before_authorize(&self) -> bool {
253+
matches!(self, Self::Airwallex)
254+
}
252255
}
253256

254257
#[derive(

crates/api_models/src/payments.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2904,7 +2904,11 @@ impl AddressDetails {
29042904

29052905
pub fn unify_address_details(self, other: Option<&Self>) -> Self {
29062906
if let Some(other) = other {
2907-
let (first_name, last_name) = if self.first_name.is_some() {
2907+
let (first_name, last_name) = if self
2908+
.first_name
2909+
.as_ref()
2910+
.is_some_and(|first_name| !first_name.is_empty_after_trim())
2911+
{
29082912
(self.first_name, self.last_name)
29092913
} else {
29102914
(other.first_name.clone(), other.last_name.clone())
@@ -4591,6 +4595,8 @@ pub struct PaymentsExternalAuthenticationResponse {
45914595
pub three_dsserver_trans_id: Option<String>,
45924596
/// Contains the JWS object created by the ACS for the ARes message
45934597
pub acs_signed_content: Option<String>,
4598+
/// Three DS Requestor URL
4599+
pub three_ds_requestor_url: String,
45944600
}
45954601

45964602
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]

crates/common_utils/src/consts.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ pub const DEFAULT_TTL_FOR_EXTENDED_CARD_INFO: u16 = 15 * 60;
8484
/// Max ttl for Extended card info in redis (in seconds)
8585
pub const MAX_TTL_FOR_EXTENDED_CARD_INFO: u16 = 60 * 60 * 2;
8686

87+
/// Default tenant to be used when multitenancy is disabled
88+
pub const DEFAULT_TENANT: &str = "public";
89+
8790
/// Max Length for MerchantReferenceId
8891
pub const MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH: u8 = 64;
8992

0 commit comments

Comments
 (0)