Skip to content

Commit

Permalink
Merge branch 'main' of github.com:juspay/hyperswitch into business_st…
Browse files Browse the repository at this point in the history
…atus_pt

* 'main' of github.com:juspay/hyperswitch:
  chore(version): 2024.06.04.0
  fix: include client_version and client_source in retried payments (#4826)
  refactor(users): Changes for Home and Signout APIs for TOTP Redis flows (#4851)
  feat(users): Create config for TOTP Issuer (#4776)
  feat(multitenancy): add support for multitenancy and handle the same in router, producer, consumer, drainer and analytics (#4630)
  feat(connector): [AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment (#4841)
  refactor(connector): airwallex convert init payment to preprocessing (#4842)
  feat(router): send `three_ds_requestor_url` in authentication_response for external 3ds flow (#4828)
  feat(consolidated-kafka-events): add consolidated kafka payment events (#4798)
  refactor(connector): [Klarna] Add shipping Address in Klarna Session and Payment Request (#4836)
  fix(connector): make few fields optional in struct NetceteraErrorDetails (#4827)
  chore(cypress): remove logs that expose `globalState` (#4844)
  • Loading branch information
pixincreate committed Jun 4, 2024
2 parents 13d9f96 + e9be4e2 commit d121306
Show file tree
Hide file tree
Showing 246 changed files with 3,896 additions and 1,654 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 2024.06.04.0

### Features

- **connector:** [AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment ([#4841](https://github.com/juspay/hyperswitch/pull/4841)) ([`a1788b8`](https://github.com/juspay/hyperswitch/commit/a1788b8da942f0e32a80b37eac4eecece2bef77d))
- **consolidated-kafka-events:** Add consolidated kafka payment events ([#4798](https://github.com/juspay/hyperswitch/pull/4798)) ([`ccee1a9`](https://github.com/juspay/hyperswitch/commit/ccee1a9ce9e860bfa04e74329fb47fd73f010b23))
- **multitenancy:** Add support for multitenancy and handle the same in router, producer, consumer, drainer and analytics ([#4630](https://github.com/juspay/hyperswitch/pull/4630)) ([`15d6c3e`](https://github.com/juspay/hyperswitch/commit/15d6c3e846a77dec6b6a5165d86044a9b9fd52f1))
- **router:** Send `three_ds_requestor_url` in authentication_response for external 3ds flow ([#4828](https://github.com/juspay/hyperswitch/pull/4828)) ([`67f017f`](https://github.com/juspay/hyperswitch/commit/67f017f6f035b102ce7a0102b157a884ce9d4109))
- **users:** Create config for TOTP Issuer ([#4776](https://github.com/juspay/hyperswitch/pull/4776)) ([`0cbb292`](https://github.com/juspay/hyperswitch/commit/0cbb2928bd054cb8e98c3811f397a837a8887486))

### Bug Fixes

- **connector:** Make few fields optional in struct NetceteraErrorDetails ([#4827](https://github.com/juspay/hyperswitch/pull/4827)) ([`69b2f76`](https://github.com/juspay/hyperswitch/commit/69b2f76be7a2c0deba2c069a87c10a33253e2216))
- Include client_version and client_source in retried payments ([#4826](https://github.com/juspay/hyperswitch/pull/4826)) ([`fa5f5a4`](https://github.com/juspay/hyperswitch/commit/fa5f5a4eddecd072f974738d2168cd0b7c277d2e))

### Refactors

- **connector:**
- [Klarna] Add shipping Address in Klarna Session and Payment Request ([#4836](https://github.com/juspay/hyperswitch/pull/4836)) ([`8650077`](https://github.com/juspay/hyperswitch/commit/865007717c5c7e617ca1b447ea5f9bb3d274cac3))
- Airwallex convert init payment to preprocessing ([#4842](https://github.com/juspay/hyperswitch/pull/4842)) ([`e5da133`](https://github.com/juspay/hyperswitch/commit/e5da133fe00b5736dc3c55bf4ee86fa77158dbe7))
- **users:** Changes for Home and Signout APIs for TOTP Redis flows ([#4851](https://github.com/juspay/hyperswitch/pull/4851)) ([`d242850`](https://github.com/juspay/hyperswitch/commit/d242850b63173f314fb259451139464f09e0a9e9))

### Miscellaneous Tasks

- **cypress:** Remove logs that expose `globalState` ([#4844](https://github.com/juspay/hyperswitch/pull/4844)) ([`d84e624`](https://github.com/juspay/hyperswitch/commit/d84e62441f39c165af7dc1c8d893344ff85c1711))

**Full Changelog:** [`2024.05.31.1...2024.06.04.0`](https://github.com/juspay/hyperswitch/compare/2024.05.31.1...2024.06.04.0)

- - -

## 2024.05.31.1

### Features
Expand Down
29 changes: 18 additions & 11 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ stripe = { banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,ba

# This data is used to call respective connectors for wallets and cards
[connectors.supported]
wallets = ["klarna",
"mifinity", "braintree", "applepay"]
wallets = ["klarna", "mifinity", "braintree", "applepay"]
rewards = ["cashtocode", "zen"]
cards = [
"adyen",
Expand Down Expand Up @@ -354,6 +353,7 @@ sts_role_session_name = "" # An identifier for the assumed role session, used to
[user]
password_validity_in_days = 90 # Number of days after which password should be updated
two_factor_auth_expiry_in_secs = 300 # Number of seconds after which 2FA should be done again if doing update/change from inside
totp_issuer_name = "Hyperswitch" # Name of the issuer for TOTP

#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
Expand All @@ -364,7 +364,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" }
square = { long_lived_token = false, payment_method = "card" }
braintree = { long_lived_token = false, payment_method = "card" }
gocardless = { long_lived_token = true, payment_method = "bank_debit" }
billwerk = {long_lived_token = false, payment_method = "card"}
billwerk = { long_lived_token = false, payment_method = "card" }

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

[mandates.supported_payment_methods]
card.credit = { connector_list = "stripe,adyen,cybersource,bankofamerica"} # Mandate supported payment method type and connector for card
wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
card.credit = { connector_list = "stripe,adyen,cybersource,bankofamerica" } # Mandate supported payment method type and connector for card
wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" }
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" }
wallet.google_pay = { connector_list = "bankofamerica"}
wallet.google_pay = { connector_list = "bankofamerica" }
bank_redirect.giropay = { connector_list = "adyen,globalpay" }


Expand Down Expand Up @@ -589,6 +589,7 @@ outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webh
dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events
audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events
payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events
consolidated_events_topic = "topic" # Kafka topic to be used for Consolidated events

# File storage configuration
[file_storage]
Expand Down Expand Up @@ -629,3 +630,9 @@ disputes = "hyperswitch-dispute-events"

[saved_payment_methods]
sdk_eligible_payment_methods = "card"

[multitenancy]
enabled = false

[multitenancy.tenants]
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
8 changes: 7 additions & 1 deletion config/deployments/env_specific.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webh
dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events
audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events
payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events
consolidated_events_topic = "topic" # Kafka topic to be used for Consolidated events

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

# Server configuration
[server]
base_url = "https://server_base_url"
workers = 8
port = 8080
host = "127.0.0.1"
Expand All @@ -252,3 +252,9 @@ encryption_manager = "aws_kms" # Encryption manager client to be used
[encryption_management.aws_kms]
key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data.
region = "kms_region" # The AWS region used by the KMS SDK for decrypting data.

[multitenancy]
enabled = false

[multitenancy.tenants]
public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}
1 change: 1 addition & 0 deletions config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2aw
[user]
password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Integ"

[frm]
enabled = true
Expand Down
1 change: 1 addition & 0 deletions config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2aw
[user]
password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Production"

[frm]
enabled = false
Expand Down
1 change: 1 addition & 0 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2aw
[user]
password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Sandbox"

[frm]
enabled = true
Expand Down
13 changes: 10 additions & 3 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ vault_private_key = ""
tunnel_private_key = ""

[connectors.supported]
wallets = ["klarna",
"mifinity", "braintree", "applepay", "adyen"]
wallets = ["klarna", "mifinity", "braintree", "applepay", "adyen"]
rewards = ["cashtocode", "zen"]
cards = [
"aci",
Expand Down Expand Up @@ -271,6 +270,7 @@ sts_role_session_name = ""
[user]
password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Dev"

[bank_config.eps]
stripe = { banks = "arzte_und_apotheker_bank,austrian_anadi_bank_ag,bank_austria,bankhaus_carl_spangler,bankhaus_schelhammer_und_schattera_ag,bawag_psk_ag,bks_bank_ag,brull_kallmus_bank_ag,btv_vier_lander_bank,capital_bank_grawe_gruppe_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_alpeadriabank_international_ag,hypo_noe_lb_fur_niederosterreich_u_wien,hypo_oberosterreich_salzburg_steiermark,hypo_tirol_bank_ag,hypo_vorarlberg_bank_ag,hypo_bank_burgenland_aktiengesellschaft,marchfelder_bank,oberbank_ag,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag,vr_bank_braunau" }
Expand Down Expand Up @@ -559,7 +559,7 @@ redis_lock_expiry_seconds = 180 # 3 * 60 seconds
delay_between_retries_in_milliseconds = 500

[kv_config]
ttl = 900 # 15 * 60 seconds
ttl = 900 # 15 * 60 seconds
soft_kill = false

[frm]
Expand All @@ -579,6 +579,7 @@ outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events"
dispute_analytics_topic = "hyperswitch-dispute-events"
audit_events_topic = "hyperswitch-audit-events"
payout_analytics_topic = "hyperswitch-payout-events"
consolidated_events_topic = "hyperswitch-consolidated-events"

[analytics]
source = "sqlx"
Expand Down Expand Up @@ -628,3 +629,9 @@ disputes = "hyperswitch-dispute-events"

[saved_payment_methods]
sdk_eligible_payment_methods = "card"

[multitenancy]
enabled = false

[multitenancy.tenants]
public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}
17 changes: 12 additions & 5 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ recon_admin_api_key = "recon_test_admin"
[user]
password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch"

[locker]
host = ""
Expand Down Expand Up @@ -180,8 +181,7 @@ zsl.base_url = "https://api.sitoffalb.net/"
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" }

[connectors.supported]
wallets = ["klarna",
"mifinity", "braintree", "applepay"]
wallets = ["klarna", "mifinity", "braintree", "applepay"]
rewards = ["cashtocode", "zen"]
cards = [
"aci",
Expand Down Expand Up @@ -239,7 +239,7 @@ cards = [
"worldline",
"worldpay",
"zen",
"zsl"
"zsl",
]

[delayed_session_response]
Expand Down Expand Up @@ -269,7 +269,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" }
square = { long_lived_token = false, payment_method = "card" }
braintree = { long_lived_token = false, payment_method = "card" }
gocardless = { long_lived_token = true, payment_method = "bank_debit" }
billwerk = {long_lived_token = false, payment_method = "card"}
billwerk = { long_lived_token = false, payment_method = "card" }

[temp_locker_enable_config]
stripe = { payment_method = "bank_transfer" }
Expand Down Expand Up @@ -433,6 +433,7 @@ outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events"
dispute_analytics_topic = "hyperswitch-dispute-events"
audit_events_topic = "hyperswitch-audit-events"
payout_analytics_topic = "hyperswitch-payout-events"
consolidated_events_topic = "hyperswitch-consolidated-events"

[analytics]
source = "sqlx"
Expand All @@ -454,7 +455,7 @@ connection_timeout = 10
queue_strategy = "Fifo"

[kv_config]
ttl = 900 # 15 * 60 seconds
ttl = 900 # 15 * 60 seconds
soft_kill = false

[frm]
Expand Down Expand Up @@ -492,3 +493,9 @@ disputes = "hyperswitch-dispute-events"

[saved_payment_methods]
sdk_eligible_payment_methods = "card"

[multitenancy]
enabled = false

[multitenancy.tenants]
public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}
8 changes: 4 additions & 4 deletions crates/analytics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,20 +601,20 @@ impl AnalyticsProvider {
}
}

pub async fn from_conf(config: &AnalyticsConfig) -> Self {
pub async fn from_conf(config: &AnalyticsConfig, tenant: &str) -> Self {
match config {
AnalyticsConfig::Sqlx { sqlx } => Self::Sqlx(SqlxClient::from_conf(sqlx).await),
AnalyticsConfig::Sqlx { sqlx } => Self::Sqlx(SqlxClient::from_conf(sqlx, tenant).await),
AnalyticsConfig::Clickhouse { clickhouse } => Self::Clickhouse(ClickhouseClient {
config: Arc::new(clickhouse.clone()),
}),
AnalyticsConfig::CombinedCkh { sqlx, clickhouse } => Self::CombinedCkh(
SqlxClient::from_conf(sqlx).await,
SqlxClient::from_conf(sqlx, tenant).await,
ClickhouseClient {
config: Arc::new(clickhouse.clone()),
},
),
AnalyticsConfig::CombinedSqlx { sqlx, clickhouse } => Self::CombinedSqlx(
SqlxClient::from_conf(sqlx).await,
SqlxClient::from_conf(sqlx, tenant).await,
ClickhouseClient {
config: Arc::new(clickhouse.clone()),
},
Expand Down
14 changes: 6 additions & 8 deletions crates/analytics/src/sqlx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ use api_models::{
analytics::refunds::RefundType,
enums::{DisputeStage, DisputeStatus},
};
use common_utils::errors::{CustomResult, ParsingError};
use common_utils::{
errors::{CustomResult, ParsingError},
DbConnectionParams,
};
use diesel_models::enums::{
AttemptStatus, AuthenticationType, Currency, PaymentMethod, RefundStatus,
};
use error_stack::ResultExt;
use masking::PeekInterface;
use sqlx::{
postgres::{PgArgumentBuffer, PgPoolOptions, PgRow, PgTypeInfo, PgValueRef},
Decode, Encode,
Expand Down Expand Up @@ -49,12 +51,8 @@ impl Default for SqlxClient {
}

impl SqlxClient {
pub async fn from_conf(conf: &Database) -> Self {
let password = &conf.password.peek();
let database_url = format!(
"postgres://{}:{}@{}:{}/{}",
conf.username, password, conf.host, conf.port, conf.dbname
);
pub async fn from_conf(conf: &Database, schema: &str) -> Self {
let database_url = conf.get_database_url(schema);
#[allow(clippy::expect_used)]
let pool = PgPoolOptions::new()
.max_connections(conf.pool_size)
Expand Down
3 changes: 3 additions & 0 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ impl Connector {
Self::Checkout | Self::Nmi| Self::Cybersource => true,
}
}
pub fn is_pre_processing_required_before_authorize(&self) -> bool {
matches!(self, Self::Airwallex)
}
}

#[derive(
Expand Down
2 changes: 2 additions & 0 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4595,6 +4595,8 @@ pub struct PaymentsExternalAuthenticationResponse {
pub three_dsserver_trans_id: Option<String>,
/// Contains the JWS object created by the ACS for the ARes message
pub acs_signed_content: Option<String>,
/// Three DS Requestor URL
pub three_ds_requestor_url: String,
}

#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
Expand Down
3 changes: 3 additions & 0 deletions crates/api_models/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ pub struct GetUserDetailsResponse {
#[serde(skip_serializing)]
pub user_id: String,
pub org_id: String,
pub is_two_factor_auth_setup: bool,
pub recovery_codes_left: Option<usize>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct GetUserRoleDetailsRequest {
pub email: pii::Email,
Expand Down
3 changes: 3 additions & 0 deletions crates/common_utils/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ pub const DEFAULT_TTL_FOR_EXTENDED_CARD_INFO: u16 = 15 * 60;
/// Max ttl for Extended card info in redis (in seconds)
pub const MAX_TTL_FOR_EXTENDED_CARD_INFO: u16 = 60 * 60 * 2;

/// Default tenant to be used when multitenancy is disabled
pub const DEFAULT_TENANT: &str = "public";

/// Max Length for MerchantReferenceId
pub const MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH: u8 = 64;

Expand Down
Loading

0 comments on commit d121306

Please sign in to comment.