Skip to content

Commit

Permalink
Merge branch 'main' into connector_transaction_id/trustpay
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayaFoiger authored Dec 6, 2023
2 parents 97a415a + 8a995ce commit 7f69ed0
Show file tree
Hide file tree
Showing 82 changed files with 6,531 additions and 223 deletions.
54 changes: 54 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,60 @@ crates/router/src/core/routing.rs @juspay/hyperswitch-routing
crates/router/src/core/payments/routing @juspay/hyperswitch-routing
crates/router/src/core/payments/routing.rs @juspay/hyperswitch-routing

crates/api_models/src/connector_onboarding.rs @juspay/hyperswitch-dashboard
crates/api_models/src/user @juspay/hyperswitch-dashboard
crates/api_models/src/user.rs @juspay/hyperswitch-dashboard
crates/api_models/src/user_role.rs @juspay/hyperswitch-dashboard
crates/api_models/src/verify_connector.rs @juspay/hyperswitch-dashboard
crates/api_models/src/connector_onboarding.rs @juspay/hyperswitch-dashboard
crates/diesel_models/src/query/dashboard_metadata.rs @juspay/hyperswitch-dashboard
crates/diesel_models/src/query/user @juspay/hyperswitch-dashboard
crates/diesel_models/src/query/user_role.rs @juspay/hyperswitch-dashboard
crates/diesel_models/src/query/user.rs @juspay/hyperswitch-dashboard
crates/diesel_models/src/user @juspay/hyperswitch-dashboard
crates/diesel_models/src/user.rs @juspay/hyperswitch-dashboard
crates/diesel_models/src/user_role.rs @juspay/hyperswitch-dashboard
crates/router/src/consts/user.rs @juspay/hyperswitch-dashboard
crates/router/src/consts/user_role.rs @juspay/hyperswitch-dashboard
crates/router/src/core/connector_onboarding @juspay/hyperswitch-dashboard
crates/router/src/core/connector_onboarding.rs @juspay/hyperswitch-dashboard
crates/router/src/core/errors/user.rs @juspay/hyperswitch-dashboard
crates/router/src/core/errors/user @juspay/hyperswitch-dashboard
crates/router/src/core/user @juspay/hyperswitch-dashboard
crates/router/src/core/user.rs @juspay/hyperswitch-dashboard
crates/router/src/core/user_role.rs @juspay/hyperswitch-dashboard
crates/router/src/core/verify_connector.rs @juspay/hyperswitch-dashboard
crates/router/src/db/dashboard_metadata.rs @juspay/hyperswitch-dashboard
crates/router/src/db/user @juspay/hyperswitch-dashboard
crates/router/src/db/user.rs @juspay/hyperswitch-dashboard
crates/router/src/db/user_role.rs @juspay/hyperswitch-dashboard
crates/router/src/routes/connector_onboarding.rs @juspay/hyperswitch-dashboard
crates/router/src/routes/dummy_connector @juspay/hyperswitch-dashboard
crates/router/src/routes/dummy_connector.rs @juspay/hyperswitch-dashboard
crates/router/src/routes/user.rs @juspay/hyperswitch-dashboard
crates/router/src/routes/user_role.rs @juspay/hyperswitch-dashboard
crates/router/src/routes/verify_connector.rs @juspay/hyperswitch-dashboard
crates/router/src/services/authentication.rs @juspay/hyperswitch-dashboard
crates/router/src/services/authorization @juspay/hyperswitch-dashboard
crates/router/src/services/authorization.rs @juspay/hyperswitch-dashboard
crates/router/src/services/jwt.rs @juspay/hyperswitch-dashboard
crates/router/src/services/email/types.rs @juspay/hyperswitch-dashboard
crates/router/src/types/api/connector_onboarding @juspay/hyperswitch-dashboard
crates/router/src/types/api/connector_onboarding.rs @juspay/hyperswitch-dashboard
crates/router/src/types/api/verify_connector @juspay/hyperswitch-dashboard
crates/router/src/types/api/verify_connector.rs @juspay/hyperswitch-dashboard
crates/router/src/types/domain/user @juspay/hyperswitch-dashboard
crates/router/src/types/domain/user.rs @juspay/hyperswitch-dashboard
crates/router/src/types/storage/user.rs @juspay/hyperswitch-dashboard
crates/router/src/types/storage/user_role.rs @juspay/hyperswitch-dashboard
crates/router/src/types/storage/dashboard_metadata.rs @juspay/hyperswitch-dashboard
crates/router/src/utils/connector_onboarding @juspay/hyperswitch-dashboard
crates/router/src/utils/connector_onboarding.rs @juspay/hyperswitch-dashboard
crates/router/src/utils/user @juspay/hyperswitch-dashboard
crates/router/src/utils/user.rs @juspay/hyperswitch-dashboard
crates/router/src/utils/user_role.rs @juspay/hyperswitch-dashboard
crates/router/src/utils/verify_connector.rs @juspay/hyperswitch-dashboard

crates/router/src/scheduler/ @juspay/hyperswitch-process-tracker

Dockerfile @juspay/hyperswitch-infra
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 1.96.0 (2023-12-05)

### Features

- **connector_onboarding:** Add Connector onboarding APIs ([#3050](https://github.com/juspay/hyperswitch/pull/3050)) ([`7bd6e05`](https://github.com/juspay/hyperswitch/commit/7bd6e05c0c05ebae9b82a6f410e61ca4409d088b))
- **pm_list:** Add required fields for bancontact_card for Mollie, Adyen and Stripe ([#3035](https://github.com/juspay/hyperswitch/pull/3035)) ([`792e642`](https://github.com/juspay/hyperswitch/commit/792e642ad58f90bae3ddcea5e6cbc70e948d8e28))
- **user:** Add email apis and new enums for metadata ([#3053](https://github.com/juspay/hyperswitch/pull/3053)) ([`1c3d260`](https://github.com/juspay/hyperswitch/commit/1c3d260dc3e18fbf6cbd5122122a6c73dceb39a3))
- Implement FRM flows ([#2968](https://github.com/juspay/hyperswitch/pull/2968)) ([`055d838`](https://github.com/juspay/hyperswitch/commit/055d8383671f6b466297c177bcc770618c7da96a))

### Bug Fixes

- Remove redundant call to populate_payment_data function ([#3054](https://github.com/juspay/hyperswitch/pull/3054)) ([`53df543`](https://github.com/juspay/hyperswitch/commit/53df543b7f1407a758232025b7de0fb527be8e86))

### Documentation

- **test_utils:** Update postman docs ([#3055](https://github.com/juspay/hyperswitch/pull/3055)) ([`8b7a7aa`](https://github.com/juspay/hyperswitch/commit/8b7a7aa6494ff669e1f8bcc92a5160e422d6b26e))

**Full Changelog:** [`v1.95.0...v1.96.0`](https://github.com/juspay/hyperswitch/compare/v1.95.0...v1.96.0)

- - -


## 1.95.0 (2023-12-05)

### Features
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

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

10 changes: 10 additions & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
square.base_url = "https://connect.squareupsandbox.com/"
square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
Expand Down Expand Up @@ -477,3 +478,12 @@ connection_timeout = 10 # Timeout for database connection in seconds
[kv_config]
# TTL for KV in seconds
ttl = 900

[frm]
enabled = true

[paypal_onboarding]
client_id = "paypal_client_id" # Client ID for PayPal onboarding
client_secret = "paypal_secret_key" # Secret key for PayPal onboarding
partner_id = "paypal_partner_id" # Partner ID for PayPal onboarding
enabled = true # Switch to enable or disable PayPal onboarding
12 changes: 11 additions & 1 deletion config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
square.base_url = "https://connect.squareupsandbox.com/"
square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
Expand Down Expand Up @@ -476,6 +477,9 @@ delay_between_retries_in_milliseconds = 500
[kv_config]
ttl = 900 # 15 * 60 seconds

[frm]
enabled = true

[events]
source = "logs"

Expand Down Expand Up @@ -504,4 +508,10 @@ port = 5432
dbname = "hyperswitch_db"
pool_size = 5
connection_timeout = 10
queue_strategy = "Fifo"
queue_strategy = "Fifo"

[connector_onboarding.paypal]
client_id = ""
client_secret = ""
partner_id = ""
enabled = true
9 changes: 9 additions & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
square.base_url = "https://connect.squareupsandbox.com/"
square.secondary_base_url = "https://pci-connect.squareupsandbox.com/"
stax.base_url = "https://apiprod.fattlabs.com/"
Expand Down Expand Up @@ -362,3 +363,11 @@ queue_strategy = "Fifo"

[kv_config]
ttl = 900 # 15 * 60 seconds

[frm]
enabled = true

[connector_onboarding.paypal]
client_id = ""
client_secret = ""
partner_id = ""
3 changes: 2 additions & 1 deletion crates/api_models/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "README.md"
license.workspace = true

[features]
default = ["payouts"]
default = ["payouts", "frm"]
business_profile_routing = []
connector_choice_bcompat = []
errors = ["dep:actix-web", "dep:reqwest"]
Expand All @@ -17,6 +17,7 @@ connector_choice_mca_id = ["euclid/connector_choice_mca_id"]
dummy_connector = ["euclid/dummy_connector", "common_enums/dummy_connector"]
detailed_errors = []
payouts = []
frm = []

[dependencies]
actix-web = { version = "4.3.1", optional = true }
Expand Down
54 changes: 54 additions & 0 deletions crates/api_models/src/connector_onboarding.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
use super::{admin, enums};

#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct ActionUrlRequest {
pub connector: enums::Connector,
pub connector_id: String,
pub return_url: String,
}

#[derive(serde::Serialize, Debug, Clone)]
#[serde(rename_all = "lowercase")]
pub enum ActionUrlResponse {
PayPal(PayPalActionUrlResponse),
}

#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct OnboardingSyncRequest {
pub profile_id: String,
pub connector_id: String,
pub connector: enums::Connector,
}

#[derive(serde::Serialize, Debug, Clone)]
pub struct PayPalActionUrlResponse {
pub action_url: String,
}

#[derive(serde::Serialize, Debug, Clone)]
#[serde(rename_all = "lowercase")]
pub enum OnboardingStatus {
PayPal(PayPalOnboardingStatus),
}

#[derive(serde::Serialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
pub enum PayPalOnboardingStatus {
AccountNotFound,
PaymentsNotReceivable,
PpcpCustomDenied,
MorePermissionsNeeded,
EmailNotVerified,
Success(PayPalOnboardingDone),
ConnectorIntegrated(admin::MerchantConnectorResponse),
}

#[derive(serde::Serialize, Debug, Clone)]
pub struct PayPalOnboardingDone {
pub payer_id: String,
}

#[derive(serde::Serialize, Debug, Clone)]
pub struct PayPalIntegrationDone {
pub connector_id: String,
}
30 changes: 30 additions & 0 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,36 @@ impl From<PayoutConnectors> for RoutableConnectors {
}
}

#[cfg(feature = "frm")]
#[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
PartialEq,
serde::Serialize,
serde::Deserialize,
strum::Display,
strum::EnumString,
ToSchema,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum FrmConnectors {
/// Signifyd Risk Manager. Official docs: https://docs.signifyd.com/
Signifyd,
}

#[cfg(feature = "frm")]
impl From<FrmConnectors> for RoutableConnectors {
fn from(value: FrmConnectors) -> Self {
match value {
FrmConnectors::Signifyd => Self::Signifyd,
}
}
}

#[derive(
Clone,
Copy,
Expand Down
1 change: 1 addition & 0 deletions crates/api_models/src/events.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod connector_onboarding;
pub mod customer;
pub mod gsm;
mod locker_migration;
Expand Down
12 changes: 12 additions & 0 deletions crates/api_models/src/events/connector_onboarding.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use common_utils::events::{ApiEventMetric, ApiEventsType};

use crate::connector_onboarding::{
ActionUrlRequest, ActionUrlResponse, OnboardingStatus, OnboardingSyncRequest,
};

common_utils::impl_misc_api_event_type!(
ActionUrlRequest,
ActionUrlResponse,
OnboardingSyncRequest,
OnboardingStatus
);
1 change: 1 addition & 0 deletions crates/api_models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub mod api_keys;
pub mod bank_accounts;
pub mod cards_info;
pub mod conditional_configs;
pub mod connector_onboarding;
pub mod currency;
pub mod customers;
pub mod disputes;
Expand Down
1 change: 1 addition & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ pub enum RoutableConnectors {
Prophetpay,
Rapyd,
Shift4,
Signifyd,
Square,
Stax,
Stripe,
Expand Down
1 change: 0 additions & 1 deletion crates/common_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ strum = { version = "0.24.1", features = ["derive"] }
thiserror = "1.0.40"
time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] }
tokio = { version = "1.28.2", features = ["macros", "rt-multi-thread"], optional = true }
utoipa = { version = "3.3.0", features = ["preserve_order"] }

# First party crates
common_enums = { version = "0.1.0", path = "../common_enums" }
Expand Down
1 change: 1 addition & 0 deletions crates/common_utils/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub enum ApiEventsType {
// TODO: This has to be removed once the corresponding apiEventTypes are created
Miscellaneous,
RustLocker,
FraudCheck,
}

impl ApiEventMetric for serde_json::Value {}
Expand Down
3 changes: 3 additions & 0 deletions crates/diesel_models/src/kv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ impl TypedSql {
request_id: String,
global_id: String,
) -> crate::StorageResult<Vec<(&str, String)>> {
let pushed_at = common_utils::date_time::now_unix_timestamp();

Ok(vec![
(
"typed_sql",
Expand All @@ -40,6 +42,7 @@ impl TypedSql {
),
("global_id", global_id),
("request_id", request_id),
("pushed_at", pushed_at.to_string()),
])
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/drainer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ async fn drainer(
.get("request_id")
.map_or(String::new(), Clone::clone);
let global_id = entry.1.get("global_id").map_or(String::new(), Clone::clone);
let pushed_at = entry.1.get("pushed_at");

tracing::Span::current().record("request_id", request_id);
tracing::Span::current().record("global_id", global_id);
Expand Down Expand Up @@ -261,6 +262,7 @@ async fn drainer(
value: insert_op.into(),
}],
);
utils::push_drainer_delay(pushed_at, insert_op.to_string());
}
kv::DBOperation::Update { updatable } => {
let (_, execution_time) = common_utils::date_time::time_it(|| async {
Expand Down Expand Up @@ -302,6 +304,7 @@ async fn drainer(
value: update_op.into(),
}],
);
utils::push_drainer_delay(pushed_at, update_op.to_string());
}
kv::DBOperation::Delete => {
// [#224]: Implement this
Expand Down
5 changes: 4 additions & 1 deletion crates/drainer/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub use router_env::opentelemetry::KeyValue;
use router_env::{counter_metric, global_meter, histogram_metric, metrics_context};
use router_env::{
counter_metric, global_meter, histogram_metric, histogram_metric_i64, metrics_context,
};

metrics_context!(CONTEXT);
global_meter!(DRAINER_METER, "DRAINER");
Expand All @@ -18,3 +20,4 @@ histogram_metric!(QUERY_EXECUTION_TIME, DRAINER_METER); // Time in (ms) millisec
histogram_metric!(REDIS_STREAM_READ_TIME, DRAINER_METER); // Time in (ms) milliseconds
histogram_metric!(REDIS_STREAM_TRIM_TIME, DRAINER_METER); // Time in (ms) milliseconds
histogram_metric!(CLEANUP_TIME, DRAINER_METER); // Time in (ms) milliseconds
histogram_metric_i64!(DRAINER_DELAY_SECONDS, DRAINER_METER); // Time in (s) seconds
Loading

0 comments on commit 7f69ed0

Please sign in to comment.