Skip to content

Commit 6a29814

Browse files
Merge branch 'profile-level-payments-aggregate' of https://github.com/juspay/hyperswitch into profile-level-payments-aggregate
2 parents 40da0ef + 54f53d9 commit 6a29814

File tree

49 files changed

+2701
-522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2701
-522
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@ All notable changes to HyperSwitch will be documented here.
44

55
- - -
66

7+
## 2024.09.11.0
8+
9+
### Features
10+
11+
- **analytics:**
12+
- Revert api_event metrics and filters back to merchant_id authentication ([#5821](https://github.com/juspay/hyperswitch/pull/5821)) ([`283154d`](https://github.com/juspay/hyperswitch/commit/283154d3f66ae26a0d9644ed50547ad1407bd924))
13+
- Add card_network as a field in payment_attempts clickhouse table ([#5807](https://github.com/juspay/hyperswitch/pull/5807)) ([`bf1797f`](https://github.com/juspay/hyperswitch/commit/bf1797fe7cf769eb6e89f75b132a35a6cd9003df))
14+
- **connector:** [THUNES] Add template code ([#5775](https://github.com/juspay/hyperswitch/pull/5775)) ([`9b508a8`](https://github.com/juspay/hyperswitch/commit/9b508a838d68d14517477d41f2fc60168703d001))
15+
- **core:** [Payouts] Add billing address to payout list ([#5004](https://github.com/juspay/hyperswitch/pull/5004)) ([`49a60bf`](https://github.com/juspay/hyperswitch/commit/49a60bf14725d67bc4f8c5814dc5ca27b7f57712))
16+
- **payment_methods_list:** Add is_tax_connector_enabled boolean value in payment_methods_list call response ([#5707](https://github.com/juspay/hyperswitch/pull/5707)) ([`3a5fb53`](https://github.com/juspay/hyperswitch/commit/3a5fb532de39e033feff7e8de126c5e5bf12eb36))
17+
- **payout:** Add dynamic fields for payout links ([#5764](https://github.com/juspay/hyperswitch/pull/5764)) ([`f4ad657`](https://github.com/juspay/hyperswitch/commit/f4ad6579cc317b32599d28dbb6164be6e20804fa))
18+
- **router:** Mask keys in `connector_account_details` for merchant_connector_response in mca retrieve flow ([#5848](https://github.com/juspay/hyperswitch/pull/5848)) ([`71b5202`](https://github.com/juspay/hyperswitch/commit/71b52024c296548156cd80950010a2f1266906fb))
19+
- **users:** New profile level roles ([#5843](https://github.com/juspay/hyperswitch/pull/5843)) ([`3cb0f24`](https://github.com/juspay/hyperswitch/commit/3cb0f2405303f9abbf15fff2b31ad617c1a6ca91))
20+
21+
### Bug Fixes
22+
23+
- **router:** [Stripe/Itau/Paypal/Bambora/Cybersource] prevent partial submission of billing address and add required fields for all payment methods ([#5752](https://github.com/juspay/hyperswitch/pull/5752)) ([`ad40ced`](https://github.com/juspay/hyperswitch/commit/ad40cedf5cf70337c0ec49e3fa6306fe25badc39))
24+
25+
### Refactors
26+
27+
- Add hgetall command to redis interface ([#5727](https://github.com/juspay/hyperswitch/pull/5727)) ([`74ec3f3`](https://github.com/juspay/hyperswitch/commit/74ec3f3df33de8c418efa859789365627c12b93d))
28+
29+
### Miscellaneous Tasks
30+
31+
- Address Rust 1.81.0 clippy lints ([#5832](https://github.com/juspay/hyperswitch/pull/5832)) ([`933cef4`](https://github.com/juspay/hyperswitch/commit/933cef425fed2e324474f4015dd728bde2612cb2))
32+
- Make kms decryption optional if partial auth not enabled ([#5779](https://github.com/juspay/hyperswitch/pull/5779)) ([`aaeb192`](https://github.com/juspay/hyperswitch/commit/aaeb1925767b08e35decb913e3867cd6415f0abd))
33+
34+
**Full Changelog:** [`2024.09.10.0...2024.09.11.0`](https://github.com/juspay/hyperswitch/compare/2024.09.10.0...2024.09.11.0)
35+
36+
- - -
37+
738
## 2024.09.10.0
839

940
### Features

api-reference-v2/openapi_spec.json

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3534,6 +3534,14 @@
35343534
{
35353535
"type": "object",
35363536
"properties": {
3537+
"form_layout": {
3538+
"allOf": [
3539+
{
3540+
"$ref": "#/components/schemas/UIWidgetFormLayout"
3541+
}
3542+
],
3543+
"nullable": true
3544+
},
35373545
"payout_test_mode": {
35383546
"type": "boolean",
35393547
"description": "Allows for removing any validations / pre-requisites which are necessary in a production environment",
@@ -6576,6 +6584,12 @@
65766584
"enum": [
65776585
"user_cnpj"
65786586
]
6587+
},
6588+
{
6589+
"type": "string",
6590+
"enum": [
6591+
"user_iban"
6592+
]
65796593
}
65806594
],
65816595
"description": "Possible field type of required fields in payment_method_data"
@@ -14509,6 +14523,14 @@
1450914523
"example": "[{\"payment_method\": \"bank_transfer\", \"payment_method_types\": [\"ach\", \"bacs\"]}]",
1451014524
"nullable": true
1451114525
},
14526+
"form_layout": {
14527+
"allOf": [
14528+
{
14529+
"$ref": "#/components/schemas/UIWidgetFormLayout"
14530+
}
14531+
],
14532+
"nullable": true
14533+
},
1451214534
"test_mode": {
1451314535
"type": "boolean",
1451414536
"description": "`test_mode` allows for opening payout links without any restrictions. This removes\n- domain name validations\n- check for making sure link is accessed within an iframe",
@@ -14812,8 +14834,11 @@
1481214834
"nullable": true
1481314835
},
1481414836
"billing": {
14815-
"type": "object",
14816-
"description": "The billing address for the payout",
14837+
"allOf": [
14838+
{
14839+
"$ref": "#/components/schemas/Address"
14840+
}
14841+
],
1481714842
"nullable": true
1481814843
},
1481914844
"auto_fulfill": {
@@ -17401,6 +17426,13 @@
1740117426
"payout"
1740217427
]
1740317428
},
17429+
"UIWidgetFormLayout": {
17430+
"type": "string",
17431+
"enum": [
17432+
"tabs",
17433+
"journey"
17434+
]
17435+
},
1740417436
"UpdateApiKeyRequest": {
1740517437
"type": "object",
1740617438
"description": "The request body for updating an API Key.",

api-reference/openapi_spec.json

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7164,6 +7164,14 @@
71647164
{
71657165
"type": "object",
71667166
"properties": {
7167+
"form_layout": {
7168+
"allOf": [
7169+
{
7170+
"$ref": "#/components/schemas/UIWidgetFormLayout"
7171+
}
7172+
],
7173+
"nullable": true
7174+
},
71677175
"payout_test_mode": {
71687176
"type": "boolean",
71697177
"description": "Allows for removing any validations / pre-requisites which are necessary in a production environment",
@@ -10195,6 +10203,12 @@
1019510203
"enum": [
1019610204
"user_cnpj"
1019710205
]
10206+
},
10207+
{
10208+
"type": "string",
10209+
"enum": [
10210+
"user_iban"
10211+
]
1019810212
}
1019910213
],
1020010214
"description": "Possible field type of required fields in payment_method_data"
@@ -18754,6 +18768,14 @@
1875418768
"example": "[{\"payment_method\": \"bank_transfer\", \"payment_method_types\": [\"ach\", \"bacs\"]}]",
1875518769
"nullable": true
1875618770
},
18771+
"form_layout": {
18772+
"allOf": [
18773+
{
18774+
"$ref": "#/components/schemas/UIWidgetFormLayout"
18775+
}
18776+
],
18777+
"nullable": true
18778+
},
1875718779
"test_mode": {
1875818780
"type": "boolean",
1875918781
"description": "`test_mode` allows for opening payout links without any restrictions. This removes\n- domain name validations\n- check for making sure link is accessed within an iframe",
@@ -18820,8 +18842,11 @@
1882018842
"nullable": true
1882118843
},
1882218844
"billing": {
18823-
"type": "object",
18824-
"description": "The billing address for the payout",
18845+
"allOf": [
18846+
{
18847+
"$ref": "#/components/schemas/Address"
18848+
}
18849+
],
1882518850
"nullable": true
1882618851
},
1882718852
"auto_fulfill": {
@@ -21850,6 +21875,13 @@
2185021875
"payout"
2185121876
]
2185221877
},
21878+
"UIWidgetFormLayout": {
21879+
"type": "string",
21880+
"enum": [
21881+
"tabs",
21882+
"journey"
21883+
]
21884+
},
2185321885
"UpdateApiKeyRequest": {
2185421886
"type": "object",
2185521887
"description": "The request body for updating an API Key.",

crates/api_models/src/admin.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,6 +2473,10 @@ pub struct BusinessPayoutLinkConfig {
24732473
#[serde(flatten)]
24742474
pub config: BusinessGenericLinkConfig,
24752475

2476+
/// Form layout of the payout link
2477+
#[schema(value_type = Option<UIWidgetFormLayout>, max_length = 255, example = "tabs")]
2478+
pub form_layout: Option<api_enums::UIWidgetFormLayout>,
2479+
24762480
/// Allows for removing any validations / pre-requisites which are necessary in a production environment
24772481
#[schema(value_type = Option<bool>, default = false)]
24782482
pub payout_test_mode: Option<bool>,

crates/api_models/src/enums.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ pub enum FieldType {
514514
UserPixKey,
515515
UserCpf,
516516
UserCnpj,
517+
UserIban,
517518
}
518519

519520
impl FieldType {

crates/api_models/src/payouts.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
use std::collections::HashMap;
2+
13
use cards::CardNumber;
24
use common_utils::{
35
consts::default_payouts_list_limit,
46
crypto, id_type, link_utils,
57
pii::{self, Email},
68
};
79
use masking::Secret;
10+
use router_derive::FlatStruct;
811
use serde::{Deserialize, Serialize};
912
use time::PrimitiveDateTime;
1013
use utoipa::ToSchema;
1114

12-
use crate::{enums as api_enums, payments};
15+
use crate::{enums as api_enums, payment_methods::RequiredFieldInfo, payments};
1316

1417
#[derive(Debug, Deserialize, Serialize, Clone, ToSchema)]
1518
pub enum PayoutRequest {
@@ -204,6 +207,10 @@ pub struct PayoutCreatePayoutLinkConfig {
204207
#[schema(value_type = Option<Vec<EnabledPaymentMethod>>, example = r#"[{"payment_method": "bank_transfer", "payment_method_types": ["ach", "bacs"]}]"#)]
205208
pub enabled_payment_methods: Option<Vec<link_utils::EnabledPaymentMethod>>,
206209

210+
/// Form layout of the payout link
211+
#[schema(value_type = Option<UIWidgetFormLayout>, max_length = 255, example = "tabs")]
212+
pub form_layout: Option<api_enums::UIWidgetFormLayout>,
213+
207214
/// `test_mode` allows for opening payout links without any restrictions. This removes
208215
/// - domain name validations
209216
/// - check for making sure link is accessed within an iframe
@@ -411,7 +418,7 @@ pub struct PayoutCreateResponse {
411418
pub payout_type: Option<api_enums::PayoutType>,
412419

413420
/// The billing address for the payout
414-
#[schema(value_type = Option<Object>, example = json!(r#"{
421+
#[schema(value_type = Option<Address>, example = json!(r#"{
415422
"address": {
416423
"line1": "1467",
417424
"line2": "Harrison Street",
@@ -778,12 +785,31 @@ pub struct PayoutLinkDetails {
778785
#[serde(flatten)]
779786
pub ui_config: link_utils::GenericLinkUiConfigFormData,
780787
pub enabled_payment_methods: Vec<link_utils::EnabledPaymentMethod>,
788+
pub enabled_payment_methods_with_required_fields: Vec<PayoutEnabledPaymentMethodsInfo>,
781789
pub amount: common_utils::types::StringMajorUnit,
782790
pub currency: common_enums::Currency,
783791
pub locale: String,
792+
pub form_layout: Option<common_enums::UIWidgetFormLayout>,
784793
pub test_mode: bool,
785794
}
786795

796+
#[derive(Clone, Debug, serde::Serialize)]
797+
pub struct PayoutEnabledPaymentMethodsInfo {
798+
pub payment_method: common_enums::PaymentMethod,
799+
pub payment_method_types_info: Vec<PaymentMethodTypeInfo>,
800+
}
801+
802+
#[derive(Clone, Debug, serde::Serialize)]
803+
pub struct PaymentMethodTypeInfo {
804+
pub payment_method_type: common_enums::PaymentMethodType,
805+
pub required_fields: Option<HashMap<String, RequiredFieldInfo>>,
806+
}
807+
808+
#[derive(Clone, Debug, serde::Serialize, FlatStruct)]
809+
pub struct RequiredFieldsOverrideRequest {
810+
pub billing: Option<payments::Address>,
811+
}
812+
787813
#[derive(Clone, Debug, serde::Serialize)]
788814
pub struct PayoutLinkStatusDetails {
789815
pub payout_link_id: String,

crates/common_enums/src/enums.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,6 +3160,27 @@ pub enum OrderFulfillmentTimeOrigin {
31603160
Confirm,
31613161
}
31623162

3163+
#[derive(
3164+
Clone,
3165+
Copy,
3166+
Debug,
3167+
Eq,
3168+
PartialEq,
3169+
serde::Deserialize,
3170+
serde::Serialize,
3171+
strum::Display,
3172+
strum::EnumString,
3173+
ToSchema,
3174+
Hash,
3175+
)]
3176+
#[router_derive::diesel_enum(storage_type = "db_enum")]
3177+
#[serde(rename_all = "snake_case")]
3178+
#[strum(serialize_all = "snake_case")]
3179+
pub enum UIWidgetFormLayout {
3180+
Tabs,
3181+
Journey,
3182+
}
3183+
31633184
#[derive(
31643185
Clone,
31653186
Copy,

crates/common_utils/src/link_utils.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::{collections::HashSet, primitive::i64};
44

5-
use common_enums::enums;
5+
use common_enums::{enums, UIWidgetFormLayout};
66
use diesel::{
77
backend::Backend,
88
deserialize,
@@ -167,6 +167,8 @@ pub struct PayoutLinkData {
167167
pub currency: enums::Currency,
168168
/// A list of allowed domains (glob patterns) where this link can be embedded / opened from
169169
pub allowed_domains: HashSet<String>,
170+
/// Form layout of the payout link
171+
pub form_layout: Option<UIWidgetFormLayout>,
170172
/// `test_mode` can be used for testing payout links without any restrictions
171173
pub test_mode: Option<bool>,
172174
}

crates/diesel_models/src/business_profile.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::collections::{HashMap, HashSet};
22

3-
use common_enums::AuthenticationConnectors;
3+
use common_enums::{AuthenticationConnectors, UIWidgetFormLayout};
44
use common_utils::{encryption::Encryption, pii};
55
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
66
use masking::Secret;
@@ -556,6 +556,7 @@ common_utils::impl_to_sql_from_sql_json!(BusinessPaymentLinkConfig);
556556
pub struct BusinessPayoutLinkConfig {
557557
#[serde(flatten)]
558558
pub config: BusinessGenericLinkConfig,
559+
pub form_layout: Option<UIWidgetFormLayout>,
559560
pub payout_test_mode: Option<bool>,
560561
}
561562

0 commit comments

Comments
 (0)