Skip to content

Commit

Permalink
Merge branch 'main' of github.com:juspay/hyperswitch into env_split
Browse files Browse the repository at this point in the history
* 'main' of github.com:juspay/hyperswitch:
  feat(users): Added get role from jwt api (#3385)
  feat(users): Add `preferred_merchant_id` column and update user details API (#3373)
  chore(version): 2024.01.18.1
  refactor(core): add locker config to enable or disable locker  (#3352)
  fix(connector): [Cashtocode] update amount from i64 to f64 in webhook payload (#3382)
  fix(metrics): Add TASKS_ADDED_COUNT and TASKS_RESET_COUNT metrics in router scheduler flow (#3189)
  fix(connector): Trustpay zen error mapping (#3255)
  fix(user): fetch profile_id for sample data (#3358)
  refactor(connector): [Volt] Refactor Payments and Refunds Webhooks (#3377)
  chore(version): 2024.01.18.0
  • Loading branch information
pixincreate committed Jan 18, 2024
2 parents 03bf0c4 + 7516a16 commit 31c9b4c
Show file tree
Hide file tree
Showing 58 changed files with 1,135 additions and 303 deletions.
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 2024.01.18.1

### Bug Fixes

- **connector:**
- Trustpay zen error mapping ([#3255](https://github.com/juspay/hyperswitch/pull/3255)) ([`e816ccf`](https://github.com/juspay/hyperswitch/commit/e816ccfbdd7b0e24464aa93421e399d63f23b17c))
- [Cashtocode] update amount from i64 to f64 in webhook payload ([#3382](https://github.com/juspay/hyperswitch/pull/3382)) ([`059e866`](https://github.com/juspay/hyperswitch/commit/059e86607dc271c25bb3d23f5adfc7d5f21f62fb))
- **metrics:** Add TASKS_ADDED_COUNT and TASKS_RESET_COUNT metrics in router scheduler flow ([#3189](https://github.com/juspay/hyperswitch/pull/3189)) ([`b4df40d`](https://github.com/juspay/hyperswitch/commit/b4df40db25f6ea743c7a25db47e8f1d8e0d544e3))
- **user:** Fetch profile_id for sample data ([#3358](https://github.com/juspay/hyperswitch/pull/3358)) ([`2f693ad`](https://github.com/juspay/hyperswitch/commit/2f693ad1fd857280ef30c6cc0297fb926f0e79e8))

### Refactors

- **connector:** [Volt] Refactor Payments and Refunds Webhooks ([#3377](https://github.com/juspay/hyperswitch/pull/3377)) ([`acb3296`](https://github.com/juspay/hyperswitch/commit/acb329672297cd7337d0b0239e4c662257812e8a))
- **core:** Add locker config to enable or disable locker ([#3352](https://github.com/juspay/hyperswitch/pull/3352)) ([`bd5356e`](https://github.com/juspay/hyperswitch/commit/bd5356e7e7cf61f9d07fe9b67c9c5bb38fddf9c7))

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

- - -

## 2024.01.18.0

### Features

- **connector_events:** Added api to fetch connector event logs ([#3319](https://github.com/juspay/hyperswitch/pull/3319)) ([`68a3a28`](https://github.com/juspay/hyperswitch/commit/68a3a280676c8309f9becffae545b134b5e1f2ea))
- **payment_method:** Add capability to store bank details using /payment_methods endpoint ([#3113](https://github.com/juspay/hyperswitch/pull/3113)) ([`01c2de2`](https://github.com/juspay/hyperswitch/commit/01c2de223f60595d77c06a59a40dfe041e02cfee))

### Bug Fixes

- **core:** Add validation for authtype and metadata in update payment connector ([#3305](https://github.com/juspay/hyperswitch/pull/3305)) ([`52f38d3`](https://github.com/juspay/hyperswitch/commit/52f38d3d5a7d035e8211e1f51c8f982232e2d7ab))
- **events:** Fix event generation for paymentmethods list ([#3337](https://github.com/juspay/hyperswitch/pull/3337)) ([`ac8d81b`](https://github.com/juspay/hyperswitch/commit/ac8d81b32b3d91b875113d32782a8c62e39ba2a8))

### Refactors

- **connector:** [cybersource] recurring mandate flow ([#3354](https://github.com/juspay/hyperswitch/pull/3354)) ([`387c1c4`](https://github.com/juspay/hyperswitch/commit/387c1c491bdc413ae361d04f0be25eaa58e72fa9))
- [Noon] adding new field max_amount to mandate request ([#3209](https://github.com/juspay/hyperswitch/pull/3209)) ([`eb2a61d`](https://github.com/juspay/hyperswitch/commit/eb2a61d8597995838f21b8233653c691118b2191))

### Miscellaneous Tasks

- **router:** Remove recon from default features ([#3370](https://github.com/juspay/hyperswitch/pull/3370)) ([`928beec`](https://github.com/juspay/hyperswitch/commit/928beecdd7fe9e09b38ffe750627ca4af94ffc93))

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

- - -

## 2024.01.17.0

### Features
Expand Down
11 changes: 6 additions & 5 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ kms_encrypted_recon_admin_api_key = "" # Base64-encoded (KMS encrypted) cipher
# PCI Compliant storage entity which stores payment method information
# like card details
[locker]
host = "" # Locker host
host_rs = "" # Rust Locker host
mock_locker = true # Emulate a locker locally using Postgres
basilisk_host = "" # Basilisk host
locker_signing_key_id = "1" # Key_id to sign basilisk hs locker
host = "" # Locker host
host_rs = "" # Rust Locker host
mock_locker = true # Emulate a locker locally using Postgres
basilisk_host = "" # Basilisk host
locker_signing_key_id = "1" # Key_id to sign basilisk hs locker
locker_enabled = true # Boolean to enable or disable saving cards in locker

[delayed_session_response]
connectors_with_delayed_session_response = "trustpay,payme" # List of connectors which has delayed session response
Expand Down
2 changes: 2 additions & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ host = ""
host_rs = ""
mock_locker = true
basilisk_host = ""
locker_enabled = true


[forex_api]
call_delay = 21600
Expand Down
1 change: 1 addition & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ host = ""
host_rs = ""
mock_locker = true
basilisk_host = ""
locker_enabled = true

[jwekey]
vault_encryption_key = ""
Expand Down
6 changes: 4 additions & 2 deletions crates/api_models/src/events/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use crate::user::{
AuthorizeResponse, ChangePasswordRequest, ConnectAccountRequest, CreateInternalUserRequest,
DashboardEntryResponse, ForgotPasswordRequest, GetUsersResponse, InviteUserRequest,
InviteUserResponse, ResetPasswordRequest, SendVerifyEmailRequest, SignUpRequest,
SignUpWithMerchantIdRequest, SwitchMerchantIdRequest, UserMerchantCreate, VerifyEmailRequest,
SignUpWithMerchantIdRequest, SwitchMerchantIdRequest, UpdateUserAccountDetailsRequest,
UserMerchantCreate, VerifyEmailRequest,
};

impl ApiEventMetric for DashboardEntryResponse {
Expand Down Expand Up @@ -54,7 +55,8 @@ common_utils::impl_misc_api_event_type!(
InviteUserRequest,
InviteUserResponse,
VerifyEmailRequest,
SendVerifyEmailRequest
SendVerifyEmailRequest,
UpdateUserAccountDetailsRequest
);

#[cfg(feature = "dummy_connector")]
Expand Down
11 changes: 11 additions & 0 deletions crates/api_models/src/mandates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub struct MandateResponse {
pub payment_method_id: String,
/// The payment method
pub payment_method: String,
/// The payment method type
pub payment_method_type: Option<String>,
/// The card details for mandate
pub card: Option<MandateCardDetails>,
/// Details about the customer’s acceptance
Expand Down Expand Up @@ -66,6 +68,15 @@ pub struct MandateCardDetails {
#[schema(value_type = Option<String>)]
/// A unique identifier alias to identify a particular card
pub card_fingerprint: Option<Secret<String>>,
/// The first 6 digits of card
pub card_isin: Option<String>,
/// The bank that issued the card
pub card_issuer: Option<String>,
/// The network that facilitates payment card transactions
#[schema(value_type = Option<CardNetwork>)]
pub card_network: Option<api_enums::CardNetwork>,
/// The type of the payment card
pub card_type: Option<String>,
}

#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
Expand Down
41 changes: 41 additions & 0 deletions crates/api_models/src/payment_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ pub struct CardDetail {
/// Card Holder's Nick Name
#[schema(value_type = Option<String>,example = "John Doe")]
pub nick_name: Option<masking::Secret<String>>,

/// Card Issuing Country
pub card_issuing_country: Option<String>,

/// Card's Network
#[schema(value_type = Option<CardNetwork>)]
pub card_network: Option<api_enums::CardNetwork>,

/// Issuer Bank for Card
pub card_issuer: Option<String>,

/// Card Type
pub card_type: Option<String>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
Expand Down Expand Up @@ -177,6 +190,12 @@ pub struct CardDetailsPaymentMethod {
pub expiry_year: Option<masking::Secret<String>>,
pub nick_name: Option<masking::Secret<String>>,
pub card_holder_name: Option<masking::Secret<String>>,
pub card_isin: Option<String>,
pub card_issuer: Option<String>,
pub card_network: Option<api_enums::CardNetwork>,
pub card_type: Option<String>,
#[serde(default = "saved_in_locker_default")]
pub saved_to_locker: bool,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
Expand Down Expand Up @@ -227,6 +246,18 @@ pub struct CardDetailFromLocker {

#[schema(value_type=Option<String>)]
pub nick_name: Option<masking::Secret<String>>,

#[schema(value_type = Option<CardNetwork>)]
pub card_network: Option<api_enums::CardNetwork>,

pub card_isin: Option<String>,
pub card_issuer: Option<String>,
pub card_type: Option<String>,
pub saved_to_locker: bool,
}

fn saved_in_locker_default() -> bool {
true
}

impl From<CardDetailsPaymentMethod> for CardDetailFromLocker {
Expand All @@ -242,6 +273,11 @@ impl From<CardDetailsPaymentMethod> for CardDetailFromLocker {
card_holder_name: item.card_holder_name,
card_fingerprint: None,
nick_name: item.nick_name,
card_isin: item.card_isin,
card_issuer: item.card_issuer,
card_network: item.card_network,
card_type: item.card_type,
saved_to_locker: item.saved_to_locker,
}
}
}
Expand All @@ -255,6 +291,11 @@ impl From<CardDetailFromLocker> for CardDetailsPaymentMethod {
expiry_year: item.expiry_year,
nick_name: item.nick_name,
card_holder_name: item.card_holder_name,
card_isin: item.card_isin,
card_issuer: item.card_issuer,
card_network: item.card_network,
card_type: item.card_type,
saved_to_locker: item.saved_to_locker,
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions crates/api_models/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,9 @@ pub struct VerifyTokenResponse {
pub merchant_id: String,
pub user_email: pii::Email,
}

#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct UpdateUserAccountDetailsRequest {
pub name: Option<Secret<String>>,
pub preferred_merchant_id: Option<String>,
}
2 changes: 2 additions & 0 deletions crates/api_models/src/user_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub enum Permission {
SurchargeDecisionManagerRead,
UsersRead,
UsersWrite,
MerchantAccountCreate,
}

#[derive(Debug, serde::Serialize)]
Expand All @@ -60,6 +61,7 @@ pub enum PermissionModule {
Files,
ThreeDsDecisionManager,
SurchargeDecisionManager,
AccountCreate,
}

#[derive(Debug, serde::Serialize)]
Expand Down
14 changes: 14 additions & 0 deletions crates/diesel_models/src/query/user_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ impl UserRole {
.await
}

pub async fn find_by_user_id_merchant_id(
conn: &PgPooledConn,
user_id: String,
merchant_id: String,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::user_id
.eq(user_id)
.and(dsl::merchant_id.eq(merchant_id)),
)
.await
}

pub async fn update_by_user_id_merchant_id(
conn: &PgPooledConn,
user_id: String,
Expand Down
2 changes: 2 additions & 0 deletions crates/diesel_models/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,8 @@ diesel::table! {
is_verified -> Bool,
created_at -> Timestamp,
last_modified_at -> Timestamp,
#[max_length = 64]
preferred_merchant_id -> Nullable<Varchar>,
}
}

Expand Down
7 changes: 7 additions & 0 deletions crates/diesel_models/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct User {
pub is_verified: bool,
pub created_at: PrimitiveDateTime,
pub last_modified_at: PrimitiveDateTime,
pub preferred_merchant_id: Option<String>,
}

#[derive(
Expand All @@ -33,6 +34,7 @@ pub struct UserNew {
pub is_verified: bool,
pub created_at: Option<PrimitiveDateTime>,
pub last_modified_at: Option<PrimitiveDateTime>,
pub preferred_merchant_id: Option<String>,
}

#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
Expand All @@ -42,6 +44,7 @@ pub struct UserUpdateInternal {
password: Option<Secret<String>>,
is_verified: Option<bool>,
last_modified_at: PrimitiveDateTime,
preferred_merchant_id: Option<String>,
}

#[derive(Debug)]
Expand All @@ -51,6 +54,7 @@ pub enum UserUpdate {
name: Option<String>,
password: Option<Secret<String>>,
is_verified: Option<bool>,
preferred_merchant_id: Option<String>,
},
}

Expand All @@ -63,16 +67,19 @@ impl From<UserUpdate> for UserUpdateInternal {
password: None,
is_verified: Some(true),
last_modified_at,
preferred_merchant_id: None,
},
UserUpdate::AccountUpdate {
name,
password,
is_verified,
preferred_merchant_id,
} => Self {
name,
password,
is_verified,
last_modified_at,
preferred_merchant_id,
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/router/src/configs/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ impl Default for super::settings::Locker {
mock_locker: true,
basilisk_host: "localhost".into(),
locker_signing_key_id: "1".into(),
//true or false
locker_enabled: true,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/router/src/configs/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ pub struct Locker {
pub mock_locker: bool,
pub basilisk_host: String,
pub locker_signing_key_id: String,
pub locker_enabled: bool,
}

#[derive(Debug, Deserialize, Clone)]
Expand Down
5 changes: 2 additions & 3 deletions crates/router/src/connector/cashtocode/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub struct CashtocodePaymentsResponseData {
#[serde(rename_all = "camelCase")]
pub struct CashtocodePaymentsSyncResponse {
pub transaction_id: String,
pub amount: i64,
pub amount: f64,
}

fn get_redirect_form_data(
Expand Down Expand Up @@ -314,7 +314,6 @@ impl<F, T>
connector_response_reference_id: None,
incremental_authorization_allowed: None,
}),
amount_captured: Some(item.response.amount),
..item.data
})
}
Expand All @@ -330,7 +329,7 @@ pub struct CashtocodeErrorResponse {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CashtocodeIncomingWebhook {
pub amount: i64,
pub amount: f64,
pub currency: String,
pub foreign_transaction_id: String,
#[serde(rename = "type")]
Expand Down
Loading

0 comments on commit 31c9b4c

Please sign in to comment.