Skip to content

Commit cbf0929

Browse files
Aishwariyaa AnandAishwariyaa Anand
authored andcommitted
Merge main and resolve conflicts
2 parents b663e83 + c5c0e67 commit cbf0929

File tree

26 files changed

+1047
-488
lines changed

26 files changed

+1047
-488
lines changed

crates/api_models/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ olap = []
1717
openapi = ["common_enums/openapi", "olap", "recon", "dummy_connector", "olap"]
1818
recon = []
1919
v1 = ["common_utils/v1"]
20-
v2 = ["common_types/v2", "common_utils/v2", "refunds_v2", "tokenization_v2", "dep:reqwest"]
21-
refunds_v2 = []
20+
v2 = ["common_types/v2", "common_utils/v2", "tokenization_v2", "dep:reqwest"]
2221
dynamic_routing = []
2322
control_center_theme = ["dep:actix-web", "dep:actix-multipart"]
2423
revenue_recovery = []

crates/api_models/src/refunds.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use super::payments::AmountFilter;
1313
use crate::admin;
1414
use crate::{admin::MerchantConnectorInfo, enums};
1515

16-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
16+
#[cfg(feature = "v1")]
1717
#[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)]
1818
#[serde(deny_unknown_fields)]
1919
pub struct RefundRequest {
@@ -63,7 +63,7 @@ pub struct RefundRequest {
6363
pub split_refunds: Option<common_types::refunds::SplitRefund>,
6464
}
6565

66-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
66+
#[cfg(feature = "v2")]
6767
#[derive(Debug, ToSchema, Clone, Deserialize, Serialize)]
6868
#[serde(deny_unknown_fields)]
6969
pub struct RefundsCreateRequest {
@@ -109,19 +109,19 @@ pub struct RefundsCreateRequest {
109109
pub merchant_connector_details: Option<MerchantConnectorAuthDetails>,
110110
}
111111

112-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
112+
#[cfg(feature = "v1")]
113113
#[derive(Default, Debug, Clone, Deserialize)]
114114
pub struct RefundsRetrieveBody {
115115
pub force_sync: Option<bool>,
116116
}
117117

118-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
118+
#[cfg(feature = "v2")]
119119
#[derive(Default, Debug, Clone, Deserialize)]
120120
pub struct RefundsRetrieveBody {
121121
pub force_sync: Option<bool>,
122122
}
123123

124-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
124+
#[cfg(feature = "v2")]
125125
#[derive(Default, Debug, Clone, Deserialize)]
126126
pub struct RefundsRetrievePayload {
127127
/// `force_sync` with the connector to get refund details
@@ -131,7 +131,7 @@ pub struct RefundsRetrievePayload {
131131
pub merchant_connector_details: Option<MerchantConnectorAuthDetails>,
132132
}
133133

134-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
134+
#[cfg(feature = "v1")]
135135
#[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)]
136136
pub struct RefundsRetrieveRequest {
137137
/// Unique Identifier for the Refund. This is to ensure idempotency for multiple partial refund initiated against the same payment. If the identifiers is not defined by the merchant, this filed shall be auto generated and provide in the API response. It is recommended to generate uuid(v4) as the refund_id.
@@ -150,7 +150,7 @@ pub struct RefundsRetrieveRequest {
150150
pub merchant_connector_details: Option<admin::MerchantConnectorDetailsWrap>,
151151
}
152152

153-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
153+
#[cfg(feature = "v2")]
154154
#[derive(Debug, ToSchema, Clone, Deserialize, Serialize)]
155155
pub struct RefundsRetrieveRequest {
156156
/// Unique Identifier for the Refund. This is to ensure idempotency for multiple partial refund initiated against the same payment. If the identifiers is not defined by the merchant, this filed shall be auto generated and provide in the API response. It is recommended to generate uuid(v4) as the refund_id.
@@ -183,7 +183,7 @@ pub struct RefundUpdateRequest {
183183
pub metadata: Option<pii::SecretSerdeValue>,
184184
}
185185

186-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
186+
#[cfg(feature = "v2")]
187187
#[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)]
188188
#[serde(deny_unknown_fields)]
189189
pub struct RefundMetadataUpdateRequest {

crates/diesel_models/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ default = ["kv_store"]
1212
kv_store = []
1313
v1 = ["common_utils/v1", "common_types/v1"]
1414
v2 = ["common_utils/v2", "common_types/v2"]
15-
refunds_v2 = []
1615
tokenization_v2 = []
1716

1817
[dependencies]

crates/diesel_models/src/kv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ impl DBOperation {
133133
)
134134
.await?,
135135
)),
136-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
136+
#[cfg(feature = "v1")]
137137
Updateable::RefundUpdate(a) => {
138138
DBResult::Refund(Box::new(a.orig.update(conn, a.update_data).await?))
139139
}
140-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
140+
#[cfg(feature = "v2")]
141141
Updateable::RefundUpdate(a) => {
142142
DBResult::Refund(Box::new(a.orig.update_with_id(conn, a.update_data).await?))
143143
}

crates/diesel_models/src/query/refund.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
22

33
use super::generics;
4+
#[cfg(feature = "v1")]
5+
use crate::schema::refund::dsl;
6+
#[cfg(feature = "v2")]
7+
use crate::schema_v2::refund::dsl;
48
use crate::{
59
errors,
6-
refund::{RefundUpdate, RefundUpdateInternal},
10+
refund::{Refund, RefundNew, RefundUpdate, RefundUpdateInternal},
711
PgPooledConn, StorageResult,
812
};
9-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
10-
use crate::{
11-
refund::{Refund, RefundNew},
12-
schema::refund::dsl,
13-
};
14-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
15-
use crate::{
16-
refund::{Refund, RefundNew},
17-
schema_v2::refund::dsl,
18-
};
1913

2014
impl RefundNew {
2115
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Refund> {
2216
generics::generic_insert(conn, self).await
2317
}
2418
}
2519

26-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
20+
#[cfg(feature = "v1")]
2721
impl Refund {
2822
pub async fn update(self, conn: &PgPooledConn, refund: RefundUpdate) -> StorageResult<Self> {
2923
match generics::generic_update_with_unique_predicate_get_result::<
@@ -138,7 +132,7 @@ impl Refund {
138132
}
139133
}
140134

141-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
135+
#[cfg(feature = "v2")]
142136
impl Refund {
143137
pub async fn update_with_id(
144138
self,

crates/diesel_models/src/refund.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use serde::{Deserialize, Serialize};
77
use time::PrimitiveDateTime;
88

99
use crate::enums as storage_enums;
10-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
10+
#[cfg(feature = "v1")]
1111
use crate::schema::refund;
12-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
12+
#[cfg(feature = "v2")]
1313
use crate::schema_v2::refund;
14-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
14+
#[cfg(feature = "v1")]
1515
#[derive(
1616
Clone,
1717
Debug,
@@ -68,7 +68,7 @@ pub struct Refund {
6868
pub issuer_error_message: Option<String>,
6969
}
7070

71-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
71+
#[cfg(feature = "v2")]
7272
#[derive(
7373
Clone,
7474
Debug,
@@ -119,7 +119,7 @@ pub struct Refund {
119119
pub connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
120120
}
121121

122-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
122+
#[cfg(feature = "v1")]
123123
#[derive(
124124
Clone,
125125
Debug,
@@ -166,7 +166,7 @@ pub struct RefundNew {
166166
pub processor_transaction_data: Option<String>,
167167
}
168168

169-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
169+
#[cfg(feature = "v2")]
170170
#[derive(
171171
Clone,
172172
Debug,
@@ -213,7 +213,7 @@ pub struct RefundNew {
213213
pub processor_transaction_data: Option<String>,
214214
}
215215

216-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
216+
#[cfg(feature = "v1")]
217217
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
218218
pub enum RefundUpdate {
219219
Update {
@@ -257,7 +257,7 @@ pub enum RefundUpdate {
257257
},
258258
}
259259

260-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
260+
#[cfg(feature = "v2")]
261261
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
262262
pub enum RefundUpdate {
263263
Update {
@@ -299,7 +299,7 @@ pub enum RefundUpdate {
299299
},
300300
}
301301

302-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
302+
#[cfg(feature = "v1")]
303303
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
304304
#[diesel(table_name = refund)]
305305
pub struct RefundUpdateInternal {
@@ -320,7 +320,7 @@ pub struct RefundUpdateInternal {
320320
issuer_error_message: Option<String>,
321321
}
322322

323-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
323+
#[cfg(feature = "v2")]
324324
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
325325
#[diesel(table_name = refund)]
326326
pub struct RefundUpdateInternal {
@@ -339,7 +339,7 @@ pub struct RefundUpdateInternal {
339339
unified_message: Option<String>,
340340
}
341341

342-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
342+
#[cfg(feature = "v1")]
343343
impl RefundUpdateInternal {
344344
pub fn create_refund(self, source: Refund) -> Refund {
345345
Refund {
@@ -361,7 +361,7 @@ impl RefundUpdateInternal {
361361
}
362362
}
363363

364-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
364+
#[cfg(feature = "v2")]
365365
impl RefundUpdateInternal {
366366
pub fn create_refund(self, source: Refund) -> Refund {
367367
Refund {
@@ -383,7 +383,7 @@ impl RefundUpdateInternal {
383383
}
384384
}
385385

386-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
386+
#[cfg(feature = "v1")]
387387
impl From<RefundUpdate> for RefundUpdateInternal {
388388
fn from(refund_update: RefundUpdate) -> Self {
389389
match refund_update {
@@ -510,7 +510,7 @@ impl From<RefundUpdate> for RefundUpdateInternal {
510510
}
511511
}
512512

513-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
513+
#[cfg(feature = "v2")]
514514
impl From<RefundUpdate> for RefundUpdateInternal {
515515
fn from(refund_update: RefundUpdate) -> Self {
516516
match refund_update {
@@ -625,7 +625,7 @@ impl From<RefundUpdate> for RefundUpdateInternal {
625625
}
626626
}
627627

628-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
628+
#[cfg(feature = "v1")]
629629
impl RefundUpdate {
630630
pub fn apply_changeset(self, source: Refund) -> Refund {
631631
let RefundUpdateInternal {
@@ -666,7 +666,7 @@ impl RefundUpdate {
666666
}
667667
}
668668

669-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
669+
#[cfg(feature = "v2")]
670670
impl RefundUpdate {
671671
pub fn apply_changeset(self, source: Refund) -> Refund {
672672
let RefundUpdateInternal {
@@ -777,7 +777,7 @@ impl RefundUpdate {
777777
}
778778
}
779779

780-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
780+
#[cfg(feature = "v1")]
781781
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
782782
pub struct RefundCoreWorkflow {
783783
pub refund_internal_reference_id: String,
@@ -787,7 +787,7 @@ pub struct RefundCoreWorkflow {
787787
pub processor_transaction_data: Option<String>,
788788
}
789789

790-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
790+
#[cfg(feature = "v2")]
791791
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
792792
pub struct RefundCoreWorkflow {
793793
pub refund_id: common_utils::id_type::GlobalRefundId,

crates/hyperswitch_domain_models/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ frm = ["api_models/frm"]
1616
v2 = ["api_models/v2", "diesel_models/v2", "common_utils/v2", "common_types/v2"]
1717
v1 = ["api_models/v1", "diesel_models/v1", "common_utils/v1", "common_types/v1"]
1818
tokenization_v2 = ["api_models/tokenization_v2", "diesel_models/tokenization_v2"]
19-
refunds_v2 = ["api_models/refunds_v2"]
2019
dummy_connector = []
2120
revenue_recovery= []
2221

crates/hyperswitch_domain_models/src/refunds.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
1+
#[cfg(feature = "v2")]
22
use crate::business_profile::Profile;
3-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
3+
#[cfg(feature = "v1")]
44
use crate::errors;
55

6-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
6+
#[cfg(feature = "v1")]
77
pub struct RefundListConstraints {
88
pub payment_id: Option<common_utils::id_type::PaymentId>,
99
pub refund_id: Option<String>,
@@ -18,7 +18,7 @@ pub struct RefundListConstraints {
1818
pub refund_status: Option<Vec<common_enums::RefundStatus>>,
1919
}
2020

21-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
21+
#[cfg(feature = "v2")]
2222
pub struct RefundListConstraints {
2323
pub payment_id: Option<common_utils::id_type::GlobalPaymentId>,
2424
pub refund_id: Option<common_utils::id_type::GlobalRefundId>,
@@ -33,7 +33,7 @@ pub struct RefundListConstraints {
3333
pub refund_status: Option<Vec<common_enums::RefundStatus>>,
3434
}
3535

36-
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
36+
#[cfg(feature = "v1")]
3737
impl
3838
TryFrom<(
3939
api_models::refunds::RefundListRequest,
@@ -101,7 +101,7 @@ impl
101101
}
102102
}
103103

104-
#[cfg(all(feature = "v2", feature = "refunds_v2"))]
104+
#[cfg(feature = "v2")]
105105
impl From<(api_models::refunds::RefundListRequest, Profile)> for RefundListConstraints {
106106
fn from((value, profile): (api_models::refunds::RefundListRequest, Profile)) -> Self {
107107
let api_models::refunds::RefundListRequest {

crates/openapi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ router_env = { version = "0.1.0", path = "../router_env" }
1818
euclid = { version = "0.1.0", path = "../euclid" }
1919

2020
[features]
21-
v2 = ["api_models/v2", "common_utils/v2", "api_models/refunds_v2", "api_models/tokenization_v2"]
21+
v2 = ["api_models/v2", "common_utils/v2", "api_models/tokenization_v2"]
2222
v1 = ["api_models/v1", "common_utils/v1"]
2323

2424
[lints]

crates/router/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ payouts = ["api_models/payouts", "common_enums/payouts", "hyperswitch_connectors
3333
payout_retry = ["payouts"]
3434
recon = ["email", "api_models/recon"]
3535
retry = []
36-
v2 = [ "common_default", "api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "kgraph_utils/v2", "common_utils/v2", "hyperswitch_connectors/v2", "hyperswitch_interfaces/v2", "common_types/v2", "revenue_recovery", "scheduler/v2", "refunds_v2", "euclid/v2", "payment_methods/v2", "tokenization_v2"]
36+
v2 = [ "common_default", "api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "kgraph_utils/v2", "common_utils/v2", "hyperswitch_connectors/v2", "hyperswitch_interfaces/v2", "common_types/v2", "revenue_recovery", "scheduler/v2", "euclid/v2", "payment_methods/v2", "tokenization_v2"]
3737
v1 = ["common_default", "api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "hyperswitch_interfaces/v1", "kgraph_utils/v1", "common_utils/v1", "hyperswitch_connectors/v1", "common_types/v1", "scheduler/v1", "payment_methods/v1"]
3838
dynamic_routing = ["external_services/dynamic_routing", "storage_impl/dynamic_routing", "api_models/dynamic_routing"]
3939
revenue_recovery = ["api_models/revenue_recovery", "hyperswitch_interfaces/revenue_recovery", "hyperswitch_domain_models/revenue_recovery", "hyperswitch_connectors/revenue_recovery"]
40-
refunds_v2 = ["api_models/refunds_v2", "diesel_models/refunds_v2", "storage_impl/refunds_v2", "hyperswitch_domain_models/refunds_v2"]
4140
tokenization_v2 = ["api_models/tokenization_v2", "diesel_models/tokenization_v2", "hyperswitch_domain_models/tokenization_v2", "storage_impl/tokenization_v2"]
4241

4342
# Partial Auth

0 commit comments

Comments
 (0)