Skip to content

Commit

Permalink
Merge branch 'main' into force-password-non-email
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisIsMani authored Nov 6, 2024
2 parents a6c5034 + 01c5216 commit 47375fa
Show file tree
Hide file tree
Showing 51 changed files with 1,753 additions and 47 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,9 @@ result*
node_modules/

# cypress credentials
creds.json
creds.json

/.direnv

# Nix services data
/data
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,32 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 2024.11.06.0

### Features

- **config:** Update vector config ([#6365](https://github.com/juspay/hyperswitch/pull/6365)) ([`2919db8`](https://github.com/juspay/hyperswitch/commit/2919db874bd84372663228f2531ba18338e039c0))
- **connector:**
- [ELAVON] Template PR ([#6309](https://github.com/juspay/hyperswitch/pull/6309)) ([`b481e5c`](https://github.com/juspay/hyperswitch/commit/b481e5cb8ffe417591a2fb917f37ba72667f2fcd))
- [Paypal] implement vaulting for paypal wallet and cards while purchasing ([#5323](https://github.com/juspay/hyperswitch/pull/5323)) ([`22ba2db`](https://github.com/juspay/hyperswitch/commit/22ba2dbb2870471315d688147b3b53c432ce15dc))
- [JP MORGAN] Added Template code for cards integration ([#6467](https://github.com/juspay/hyperswitch/pull/6467)) ([`b048e39`](https://github.com/juspay/hyperswitch/commit/b048e39b5c4213752da7765834915cca6bf776f6))
- **db:** Implement `MerchantAccountInteraface` for `Mockdb` ([#6283](https://github.com/juspay/hyperswitch/pull/6283)) ([`5f493a5`](https://github.com/juspay/hyperswitch/commit/5f493a5166aa0a0a29f9aed538cad03def657c22))
- **nix:** Add support for running external services through services-flake ([#6377](https://github.com/juspay/hyperswitch/pull/6377)) ([`95f2e0b`](https://github.com/juspay/hyperswitch/commit/95f2e0b8c51bfe116241fc486069e10e578a5ff8))
- **users:** Add `force_two_factor_auth` environment variable ([#6466](https://github.com/juspay/hyperswitch/pull/6466)) ([`6b66ccc`](https://github.com/juspay/hyperswitch/commit/6b66cccd02c2589bb2dad38b46f4da7e1455ca0b))

### Bug Fixes

- **connector:**
- Expiration Year Incorrectly Populated as YYYY Format in Paybox Mandates ([#6474](https://github.com/juspay/hyperswitch/pull/6474)) ([`e457ccd`](https://github.com/juspay/hyperswitch/commit/e457ccd91e60d5168e0a3283dfa325097f455076))
- [Cybersource] remove newline in billing address with space ([#6478](https://github.com/juspay/hyperswitch/pull/6478)) ([`7f1d345`](https://github.com/juspay/hyperswitch/commit/7f1d34571f72f63b8bb52aff995ad093e3b6d856))
- **refunds:** Remove to schema from refund aggregate response and exclude it from open api documentation ([#6405](https://github.com/juspay/hyperswitch/pull/6405)) ([`449c9cf`](https://github.com/juspay/hyperswitch/commit/449c9cfe557b3540e4ad25e48e012b531eb232fd))
- Replace deprecated backticks with $(...) for command substitution ([#6337](https://github.com/juspay/hyperswitch/pull/6337)) ([`1c92f58`](https://github.com/juspay/hyperswitch/commit/1c92f5843009db42778f94bc9fd915b411a93f76))
- Lazy connection pools for dynamic routing service ([#6437](https://github.com/juspay/hyperswitch/pull/6437)) ([`71d9933`](https://github.com/juspay/hyperswitch/commit/71d99332204ddfbb3cf305c7d3bc8840d508bf47))

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

- - -

## 2024.11.05.0

### Features
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayment
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
Expand Down Expand Up @@ -396,6 +397,7 @@ password_validity_in_days = 90 # Number of days after which password shoul
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
base_url = "" # Base url used for user specific redirects and emails
force_two_factor_auth = false # Whether to force two factor authentication for all users

#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
Expand Down
4 changes: 3 additions & 1 deletion config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayment
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
Expand Down Expand Up @@ -139,6 +140,7 @@ password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Integ"
base_url = "https://integ.hyperswitch.io"
force_two_factor_auth = false

[frm]
enabled = true
Expand Down Expand Up @@ -395,4 +397,4 @@ connector_list = ""
card_networks = "Visa, AmericanExpress, Mastercard"

[network_tokenization_supported_connectors]
connector_list = "cybersource"
connector_list = "cybersource"
4 changes: 3 additions & 1 deletion config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayment
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://iata-pay.iata.org/api/v1"
itaubank.base_url = "https://secure.api.itau/"
jpmorgan.base_url = "https://api-ms.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.klarna.com/"
mifinity.base_url = "https://secure.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
Expand Down Expand Up @@ -146,6 +147,7 @@ password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Production"
base_url = "https://live.hyperswitch.io"
force_two_factor_auth = false

[frm]
enabled = false
Expand Down Expand Up @@ -409,4 +411,4 @@ connector_list = ""
card_networks = "Visa, AmericanExpress, Mastercard"

[network_tokenization_supported_connectors]
connector_list = "cybersource"
connector_list = "cybersource"
2 changes: 2 additions & 0 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayment
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
Expand Down Expand Up @@ -146,6 +147,7 @@ password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Sandbox"
base_url = "https://app.hyperswitch.io"
force_two_factor_auth = false

[frm]
enabled = true
Expand Down
3 changes: 3 additions & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ cards = [
"helcim",
"iatapay",
"itaubank",
"jpmorgan",
"mollie",
"multisafepay",
"netcetera",
Expand Down Expand Up @@ -231,6 +232,7 @@ gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayment
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
Expand Down Expand Up @@ -318,6 +320,7 @@ password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Dev"
base_url = "http://localhost:8080"
force_two_factor_auth = false

[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
3 changes: 3 additions & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch"
base_url = "http://localhost:8080"
force_two_factor_auth = false

[locker]
host = ""
Expand Down Expand Up @@ -149,6 +150,7 @@ gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayment
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
Expand Down Expand Up @@ -244,6 +246,7 @@ cards = [
"helcim",
"iatapay",
"itaubank",
"jpmorgan",
"mollie",
"multisafepay",
"netcetera",
Expand Down
2 changes: 2 additions & 0 deletions crates/analytics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ hyperswitch_interfaces = { version = "0.1.0", path = "../hyperswitch_interfaces"
masking = { version = "0.1.0", path = "../masking" }
router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] }
storage_impl = { version = "0.1.0", path = "../storage_impl", default-features = false }
currency_conversion = { version = "0.1.0", path = "../currency_conversion" }

#Third Party dependencies
actix-web = "4.5.1"
Expand All @@ -34,6 +35,7 @@ futures = "0.3.30"
once_cell = "1.19.0"
opensearch = { version = "2.2.0", features = ["aws-auth"] }
reqwest = { version = "0.11.27", features = ["serde_json"] }
rust_decimal = "1.35"
serde = { version = "1.0.197", features = ["derive", "rc"] }
serde_json = "1.0.115"
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio", "runtime-tokio-native-tls", "time", "bigdecimal"] }
Expand Down
8 changes: 8 additions & 0 deletions crates/analytics/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub enum AnalyticsError {
UnknownError,
#[error("Access Forbidden Analytics Error")]
AccessForbiddenError,
#[error("Failed to fetch currency exchange rate")]
ForexFetchFailed,
}

impl ErrorSwitch<ApiErrorResponse> for AnalyticsError {
Expand All @@ -32,6 +34,12 @@ impl ErrorSwitch<ApiErrorResponse> for AnalyticsError {
Self::AccessForbiddenError => {
ApiErrorResponse::Unauthorized(ApiError::new("IR", 0, "Access Forbidden", None))
}
Self::ForexFetchFailed => ApiErrorResponse::InternalServerError(ApiError::new(
"HE",
0,
"Failed to fetch currency exchange rate",
None,
)),
}
}
}
29 changes: 24 additions & 5 deletions crates/analytics/src/payment_intents/accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl PaymentIntentMetricAccumulator for CountAccumulator {
}

impl PaymentIntentMetricAccumulator for SmartRetriedAmountAccumulator {
type MetricOutput = (Option<u64>, Option<u64>);
type MetricOutput = (Option<u64>, Option<u64>, Option<u64>, Option<u64>);
#[inline]
fn add_metrics_bucket(&mut self, metrics: &PaymentIntentMetricRow) {
self.amount = match (
Expand Down Expand Up @@ -117,7 +117,7 @@ impl PaymentIntentMetricAccumulator for SmartRetriedAmountAccumulator {
.amount_without_retries
.and_then(|i| u64::try_from(i).ok())
.or(Some(0));
(with_retries, without_retries)
(with_retries, without_retries, Some(0), Some(0))
}
}

Expand Down Expand Up @@ -185,7 +185,14 @@ impl PaymentIntentMetricAccumulator for PaymentsSuccessRateAccumulator {
}

impl PaymentIntentMetricAccumulator for ProcessedAmountAccumulator {
type MetricOutput = (Option<u64>, Option<u64>, Option<u64>, Option<u64>);
type MetricOutput = (
Option<u64>,
Option<u64>,
Option<u64>,
Option<u64>,
Option<u64>,
Option<u64>,
);
#[inline]
fn add_metrics_bucket(&mut self, metrics: &PaymentIntentMetricRow) {
self.total_with_retries = match (
Expand Down Expand Up @@ -235,6 +242,8 @@ impl PaymentIntentMetricAccumulator for ProcessedAmountAccumulator {
count_with_retries,
total_without_retries,
count_without_retries,
Some(0),
Some(0),
)
}
}
Expand Down Expand Up @@ -301,13 +310,19 @@ impl PaymentIntentMetricsAccumulator {
payments_success_rate,
payments_success_rate_without_smart_retries,
) = self.payments_success_rate.collect();
let (smart_retried_amount, smart_retried_amount_without_smart_retries) =
self.smart_retried_amount.collect();
let (
smart_retried_amount,
smart_retried_amount_without_smart_retries,
smart_retried_amount_in_usd,
smart_retried_amount_without_smart_retries_in_usd,
) = self.smart_retried_amount.collect();
let (
payment_processed_amount,
payment_processed_count,
payment_processed_amount_without_smart_retries,
payment_processed_count_without_smart_retries,
payment_processed_amount_in_usd,
payment_processed_amount_without_smart_retries_in_usd,
) = self.payment_processed_amount.collect();
let (
payments_success_rate_distribution_without_smart_retries,
Expand All @@ -317,7 +332,9 @@ impl PaymentIntentMetricsAccumulator {
successful_smart_retries: self.successful_smart_retries.collect(),
total_smart_retries: self.total_smart_retries.collect(),
smart_retried_amount,
smart_retried_amount_in_usd,
smart_retried_amount_without_smart_retries,
smart_retried_amount_without_smart_retries_in_usd,
payment_intent_count: self.payment_intent_count.collect(),
successful_payments,
successful_payments_without_smart_retries,
Expand All @@ -330,6 +347,8 @@ impl PaymentIntentMetricsAccumulator {
payment_processed_count_without_smart_retries,
payments_success_rate_distribution_without_smart_retries,
payments_failure_rate_distribution_without_smart_retries,
payment_processed_amount_in_usd,
payment_processed_amount_without_smart_retries_in_usd,
}
}
}
Loading

0 comments on commit 47375fa

Please sign in to comment.