Skip to content

Commit

Permalink
Merge branch 'main' into refactor-mollie-match
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkurilla committed May 7, 2024
2 parents 805ba6e + 59e79ff commit d1ecf7b
Show file tree
Hide file tree
Showing 297 changed files with 4,356 additions and 2,353 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 2024.05.07.0

### Features

- **clickhouse:** Init Clickhouse container on startup ([#4365](https://github.com/juspay/hyperswitch/pull/4365)) ([`89e5884`](https://github.com/juspay/hyperswitch/commit/89e5884f9eb341026b09a0d1ab8b836de5ba0c19))
- **constraint_graph:** Make the constraint graph framework generic and move it into a separate crate ([#3071](https://github.com/juspay/hyperswitch/pull/3071)) ([`a23a365`](https://github.com/juspay/hyperswitch/commit/a23a365cdf3fc2a24f4e2a08996a5683dc4da89a))
- **payment_methods:** Filter payment methods based on pm client secret ([#4249](https://github.com/juspay/hyperswitch/pull/4249)) ([`575fac6`](https://github.com/juspay/hyperswitch/commit/575fac6f3ef94ef1856a77d778f822c0e97b0e9c))
- Add decision starter API for email flows ([#4533](https://github.com/juspay/hyperswitch/pull/4533)) ([`1335554`](https://github.com/juspay/hyperswitch/commit/1335554f5193f05ba512d75a8eb9bb8047a65466))

### Refactors

- **paylater:** Use payment_method_data.billing fields instead of payment_method_data ([#4333](https://github.com/juspay/hyperswitch/pull/4333)) ([`b878677`](https://github.com/juspay/hyperswitch/commit/b878677f1572dceb9cd1983c2fd0b3b05ed8a573))

### Miscellaneous Tasks

- **postman:** Update Postman collection files ([`25cd685`](https://github.com/juspay/hyperswitch/commit/25cd6854f9d9162915e56213b6989eeb1d178b49))

### Build System / Dependencies

- **docker:** Add web client and control center services to docker compose setup ([#4197](https://github.com/juspay/hyperswitch/pull/4197)) ([`b1cfef2`](https://github.com/juspay/hyperswitch/commit/b1cfef257a54b3ebe4f48e56a48a932e2c758dc7))

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

- - -

## 2024.05.06.0

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

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

9 changes: 7 additions & 2 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
mollie.secondary_base_url = "https://api.cc.mollie.com/v1/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
Expand Down Expand Up @@ -259,7 +260,8 @@ 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", "braintree", "applepay"]
wallets = ["klarna",
"mifinity", "braintree", "applepay"]
rewards = ["cashtocode", "zen"]
cards = [
"adyen",
Expand Down Expand Up @@ -345,6 +347,9 @@ active_email_client = "SES" # The currently active email client
email_role_arn = "" # The amazon resource name ( arn ) of the role which has permission to send emails
sts_role_session_name = "" # An identifier for the assumed role session, used to uniquely identify a session.

[user]
password_validity_in_days = 90 # Number of days after which password should be updated

#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
Expand Down Expand Up @@ -615,4 +620,4 @@ refunds = "hyperswitch-refund-events"
disputes = "hyperswitch-dispute-events"

[saved_payment_methods]
sdk_eligible_payment_methods = ["card"]
sdk_eligible_payment_methods = "card"
6 changes: 5 additions & 1 deletion config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
mollie.secondary_base_url = "https://api.cc.mollie.com/v1/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
Expand Down Expand Up @@ -108,6 +109,9 @@ refund_tolerance = 100 # Fake d
refund_ttl = 172800 # Time to live for dummy connector refund in redis
slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" # Slack invite url for hyperswitch

[user]
password_validity_in_days = 90

[frm]
enabled = true

Expand Down Expand Up @@ -321,4 +325,4 @@ connectors_with_webhook_source_verification_call = "paypal" # List of co
keys = "user-agent"

[saved_payment_methods]
sdk_eligible_payment_methods = ["card"]
sdk_eligible_payment_methods = "card"
6 changes: 5 additions & 1 deletion config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ gocardless.base_url = "https://api.gocardless.com"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
mifinity.base_url = "https://secure.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
mollie.secondary_base_url = "https://api.cc.mollie.com/v1/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
Expand Down Expand Up @@ -115,6 +116,9 @@ refund_tolerance = 100 # Fake d
refund_ttl = 172800 # Time to live for dummy connector refund in redis
slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" # Slack invite url for hyperswitch

[user]
password_validity_in_days = 90

[frm]
enabled = false

Expand Down Expand Up @@ -332,4 +336,4 @@ connectors_with_webhook_source_verification_call = "paypal" # List of connec
keys = "user-agent"

[saved_payment_methods]
sdk_eligible_payment_methods = ["card"]
sdk_eligible_payment_methods = "card"
6 changes: 5 additions & 1 deletion config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
mollie.secondary_base_url = "https://api.cc.mollie.com/v1/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
Expand Down Expand Up @@ -115,6 +116,9 @@ refund_tolerance = 100 # Fake d
refund_ttl = 172800 # Time to live for dummy connector refund in redis
slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" # Slack invite url for hyperswitch

[user]
password_validity_in_days = 90

[frm]
enabled = true

Expand Down Expand Up @@ -336,4 +340,4 @@ connectors_with_webhook_source_verification_call = "paypal" # List of con
keys = "user-agent"

[saved_payment_methods]
sdk_eligible_payment_methods = ["card"]
sdk_eligible_payment_methods = "card"
9 changes: 7 additions & 2 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ vault_private_key = ""
tunnel_private_key = ""

[connectors.supported]
wallets = ["klarna", "braintree", "applepay", "adyen"]
wallets = ["klarna",
"mifinity", "braintree", "applepay", "adyen"]
rewards = ["cashtocode", "zen"]
cards = [
"aci",
Expand Down Expand Up @@ -193,6 +194,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
mollie.secondary_base_url = "https://api.cc.mollie.com/v1/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
Expand Down Expand Up @@ -261,6 +263,9 @@ active_email_client = "SES"
email_role_arn = ""
sts_role_session_name = ""

[user]
password_validity_in_days = 90

[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" }
adyen = { banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_tirol_bank_ag,posojilnica_bank_e_gen,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag" }
Expand Down Expand Up @@ -617,4 +622,4 @@ refunds = "hyperswitch-refund-events"
disputes = "hyperswitch-dispute-events"

[saved_payment_methods]
sdk_eligible_payment_methods = ["card"]
sdk_eligible_payment_methods = "card"
9 changes: 7 additions & 2 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jwt_secret = "secret"
master_enc_key = "73ad7bbbbc640c845a150f67d058b279849370cd2c1f3c67c4dd6c869213e13a"
recon_admin_api_key = "recon_test_admin"

[user]
password_validity_in_days = 90

[locker]
host = ""
host_rs = ""
Expand Down Expand Up @@ -128,6 +131,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
mollie.secondary_base_url = "https://api.cc.mollie.com/v1/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
Expand Down Expand Up @@ -172,7 +176,8 @@ 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", "braintree", "applepay"]
wallets = ["klarna",
"mifinity", "braintree", "applepay"]
rewards = ["cashtocode", "zen"]
cards = [
"aci",
Expand Down Expand Up @@ -476,4 +481,4 @@ refunds = "hyperswitch-refund-events"
disputes = "hyperswitch-dispute-events"

[saved_payment_methods]
sdk_eligible_payment_methods = ["card"]
sdk_eligible_payment_methods = "card"
4 changes: 2 additions & 2 deletions crates/analytics/src/clickhouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ where
|(order_column, order)| format!(
" order by {} {}",
order_column.to_owned(),
order.to_string()
order
)
),
alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias))
Expand All @@ -476,7 +476,7 @@ where
|(order_column, order)| format!(
" order by {} {}",
order_column.to_owned(),
order.to_string()
order
)
),
alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias))
Expand Down
10 changes: 6 additions & 4 deletions crates/analytics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,16 @@ impl Default for AnalyticsProvider {
}
}

impl ToString for AnalyticsProvider {
fn to_string(&self) -> String {
String::from(match self {
impl std::fmt::Display for AnalyticsProvider {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let analytics_provider = match self {
Self::Clickhouse(_) => "Clickhouse",
Self::Sqlx(_) => "Sqlx",
Self::CombinedCkh(_, _) => "CombinedCkh",
Self::CombinedSqlx(_, _) => "CombinedSqlx",
})
};

write!(f, "{}", analytics_provider)
}
}

Expand Down
10 changes: 2 additions & 8 deletions crates/analytics/src/payments/accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ impl PaymentMetricAccumulator for SumAccumulator {
fn add_metrics_bucket(&mut self, metrics: &PaymentMetricRow) {
self.total = match (
self.total,
metrics
.total
.as_ref()
.and_then(bigdecimal::ToPrimitive::to_i64),
metrics.total.as_ref().and_then(ToPrimitive::to_i64),
) {
(None, None) => None,
(None, i @ Some(_)) | (i @ Some(_), None) => i,
Expand All @@ -173,10 +170,7 @@ impl PaymentMetricAccumulator for AverageAccumulator {
type MetricOutput = Option<f64>;

fn add_metrics_bucket(&mut self, metrics: &PaymentMetricRow) {
let total = metrics
.total
.as_ref()
.and_then(bigdecimal::ToPrimitive::to_u32);
let total = metrics.total.as_ref().and_then(ToPrimitive::to_u32);
let count = metrics.count.and_then(|total| u32::try_from(total).ok());

match (total, count) {
Expand Down
16 changes: 8 additions & 8 deletions crates/analytics/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ pub enum Order {
Descending,
}

impl ToString for Order {
fn to_string(&self) -> String {
String::from(match self {
Self::Ascending => "asc",
Self::Descending => "desc",
})
impl std::fmt::Display for Order {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Ascending => write!(f, "asc"),
Self::Descending => write!(f, "desc"),
}
}
}

Expand Down Expand Up @@ -709,12 +709,12 @@ where
Ok(query)
}

pub async fn execute_query<R, P: AnalyticsDataSource>(
pub async fn execute_query<R, P>(
&mut self,
store: &P,
) -> CustomResult<CustomResult<Vec<R>, QueryExecutionError>, QueryBuildingError>
where
P: LoadRow<R>,
P: LoadRow<R> + AnalyticsDataSource,
Aggregate<&'static str>: ToSql<T>,
Window<&'static str>: ToSql<T>,
{
Expand Down
1 change: 0 additions & 1 deletion crates/analytics/src/refunds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ pub mod metrics;
pub mod types;
pub use accumulator::{RefundMetricAccumulator, RefundMetricsAccumulator};

pub trait RefundAnalytics: metrics::RefundMetricAnalytics {}
pub use self::core::{get_filters, get_metrics};
5 changes: 0 additions & 5 deletions crates/analytics/src/sdk_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@ pub mod filters;
pub mod metrics;
pub mod types;
pub use accumulator::{SdkEventMetricAccumulator, SdkEventMetricsAccumulator};
pub trait SDKEventAnalytics: events::SdkEventsFilterAnalytics {}
pub trait SdkEventAnalytics:
metrics::SdkEventMetricAnalytics + filters::SdkEventFilterAnalytics
{
}

pub use self::core::{get_filters, get_metrics, sdk_events_core};
4 changes: 2 additions & 2 deletions crates/analytics/src/sqlx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ where
|(order_column, order)| format!(
" order by {} {}",
order_column.to_owned(),
order.to_string()
order
)
),
alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias))
Expand All @@ -616,7 +616,7 @@ where
|(order_column, order)| format!(
" order by {} {}",
order_column.to_owned(),
order.to_string()
order
)
),
alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias))
Expand Down
5 changes: 0 additions & 5 deletions crates/analytics/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ where
}
}

// Analytics Framework

pub trait RefundAnalytics {}
pub trait SdkEventAnalytics {}

#[async_trait::async_trait]
pub trait AnalyticsDataSource
where
Expand Down

0 comments on commit d1ecf7b

Please sign in to comment.