Skip to content

Commit 07f1aa8

Browse files
committed
Merge branch 'main' into change-password-and-update-user-info
2 parents 8290ebe + 107c3b9 commit 07f1aa8

File tree

40 files changed

+849
-190
lines changed

40 files changed

+849
-190
lines changed

CHANGELOG.md

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

55
- - -
66

7+
## 1.89.0 (2023-11-24)
8+
9+
### Features
10+
11+
- **router:** Add `connector_transaction_id` in error_response from connector flows ([#2972](https://github.com/juspay/hyperswitch/pull/2972)) ([`3322103`](https://github.com/juspay/hyperswitch/commit/3322103f5c9b7c2a5b663980246c6ca36b8dc63e))
12+
13+
### Bug Fixes
14+
15+
- **connector:** [BANKOFAMERICA] Add status VOIDED in enum Bankofameri… ([#2969](https://github.com/juspay/hyperswitch/pull/2969)) ([`203bbd7`](https://github.com/juspay/hyperswitch/commit/203bbd73751e1513206e81d7cf920ec263f83c58))
16+
- **core:** Error propagation for not supporting partial refund ([#2976](https://github.com/juspay/hyperswitch/pull/2976)) ([`97a38a7`](https://github.com/juspay/hyperswitch/commit/97a38a78e514e4fa3b5db46b6de985be6312dcc3))
17+
- **router:** Mark refund status as failure for not_implemented error from connector flows ([#2978](https://github.com/juspay/hyperswitch/pull/2978)) ([`d56d805`](https://github.com/juspay/hyperswitch/commit/d56d80557050336d5ed37282f1aa34b6c17389d1))
18+
- Return none instead of err when payment method data is not found for bank debit during listing ([#2967](https://github.com/juspay/hyperswitch/pull/2967)) ([`5cc829a`](https://github.com/juspay/hyperswitch/commit/5cc829a11f515a413fe19f657a90aa05cebb99b5))
19+
- Surcharge related status and rules fix ([#2974](https://github.com/juspay/hyperswitch/pull/2974)) ([`3db7213`](https://github.com/juspay/hyperswitch/commit/3db721388a7f0e291d7eb186661fc69a57068ea6))
20+
21+
### Documentation
22+
23+
- **README:** Updated Community Platform Mentions ([#2960](https://github.com/juspay/hyperswitch/pull/2960)) ([`e0bde43`](https://github.com/juspay/hyperswitch/commit/e0bde433282a34eb9eb28a2d9c43c2b17b5e65e5))
24+
- Add Rust locker information in architecture doc ([#2964](https://github.com/juspay/hyperswitch/pull/2964)) ([`b2f7dd1`](https://github.com/juspay/hyperswitch/commit/b2f7dd13925a1429e316cd9eaf0e2d31d46b6d4a))
25+
26+
**Full Changelog:** [`v1.88.0...v1.89.0`](https://github.com/juspay/hyperswitch/compare/v1.88.0...v1.89.0)
27+
28+
- - -
29+
30+
731
## 1.88.0 (2023-11-23)
832

933
### Features

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ We welcome contributions from the community. Please read through our
252252
Included are directions for opening issues, coding standards, and notes on
253253
development.
254254

255-
🦀 **Important note for Rust developers**: We aim for contributions from the community
255+
- We appreciate all types of contributions: code, documentation, demo creation, or something new way you want to contribute to us. We will reward every contribution with a Hyperswitch branded t-shirt.
256+
- 🦀 **Important note for Rust developers**: We aim for contributions from the community
256257
across a broad range of tracks. Hence, we have prioritised simplicity and code
257258
readability over purely idiomatic code. For example, some of the code in core
258259
functions (e.g., `payments_core`) is written to be more readable than
@@ -264,10 +265,9 @@ pure-idiomatic.
264265

265266
Get updates on Hyperswitch development and chat with the community:
266267

267-
- Read and subscribe to [the official Hyperswitch blog][blog].
268-
- Join our [Discord server][discord].
269-
- Join our [Slack workspace][slack].
270-
- Ask and explore our [GitHub Discussions][github-discussions].
268+
- [Discord server][discord] for questions related to contributing to hyperswitch, questions about the architecture, components, etc.
269+
- [Slack workspace][slack] for questions related to integrating hyperswitch, integrating a connector in hyperswitch, etc.
270+
- [GitHub Discussions][github-discussions] to drop feature requests or suggest anything payments-related you need for your stack.
271271

272272
[blog]: https://hyperswitch.io/blog
273273
[discord]: https://discord.gg/wJZ7DVW8mm

crates/api_models/src/payment_methods.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ impl SurchargeDetailsResponse {
352352
request_surcharge_details.surcharge_amount == self.surcharge_amount
353353
&& request_surcharge_details.tax_amount.unwrap_or(0) == self.tax_on_surcharge_amount
354354
}
355+
pub fn get_total_surcharge_amount(&self) -> i64 {
356+
self.surcharge_amount + self.tax_on_surcharge_amount
357+
}
355358
}
356359

357360
#[derive(Clone, Debug)]

crates/api_models/src/payments.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@ impl RequestSurchargeDetails {
347347
final_amount: original_amount + surcharge_amount + tax_on_surcharge_amount,
348348
}
349349
}
350+
pub fn get_total_surcharge_amount(&self) -> i64 {
351+
self.surcharge_amount + self.tax_amount.unwrap_or(0)
352+
}
350353
}
351354

352355
#[derive(Default, Debug, Clone, Copy)]

crates/data_models/src/payments/payment_attempt.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ pub enum PaymentAttemptUpdate {
264264
error_message: Option<Option<String>>,
265265
amount_capturable: Option<i64>,
266266
updated_by: String,
267+
surcharge_amount: Option<i64>,
268+
tax_amount: Option<i64>,
267269
merchant_connector_id: Option<String>,
268270
},
269271
RejectUpdate {
@@ -291,8 +293,6 @@ pub enum PaymentAttemptUpdate {
291293
error_reason: Option<Option<String>>,
292294
connector_response_reference_id: Option<String>,
293295
amount_capturable: Option<i64>,
294-
surcharge_amount: Option<i64>,
295-
tax_amount: Option<i64>,
296296
updated_by: String,
297297
authentication_data: Option<serde_json::Value>,
298298
encoded_data: Option<String>,
@@ -321,8 +321,6 @@ pub enum PaymentAttemptUpdate {
321321
error_message: Option<Option<String>>,
322322
error_reason: Option<Option<String>>,
323323
amount_capturable: Option<i64>,
324-
surcharge_amount: Option<i64>,
325-
tax_amount: Option<i64>,
326324
updated_by: String,
327325
unified_code: Option<Option<String>>,
328326
unified_message: Option<Option<String>>,

crates/diesel_models/src/payment_attempt.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ pub enum PaymentAttemptUpdate {
180180
error_code: Option<Option<String>>,
181181
error_message: Option<Option<String>>,
182182
amount_capturable: Option<i64>,
183+
surcharge_amount: Option<i64>,
184+
tax_amount: Option<i64>,
183185
updated_by: String,
184186
merchant_connector_id: Option<String>,
185187
},
@@ -208,8 +210,6 @@ pub enum PaymentAttemptUpdate {
208210
error_reason: Option<Option<String>>,
209211
connector_response_reference_id: Option<String>,
210212
amount_capturable: Option<i64>,
211-
surcharge_amount: Option<i64>,
212-
tax_amount: Option<i64>,
213213
updated_by: String,
214214
authentication_data: Option<serde_json::Value>,
215215
encoded_data: Option<String>,
@@ -238,8 +238,6 @@ pub enum PaymentAttemptUpdate {
238238
error_message: Option<Option<String>>,
239239
error_reason: Option<Option<String>>,
240240
amount_capturable: Option<i64>,
241-
surcharge_amount: Option<i64>,
242-
tax_amount: Option<i64>,
243241
updated_by: String,
244242
unified_code: Option<Option<String>>,
245243
unified_message: Option<Option<String>>,
@@ -443,6 +441,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
443441
amount_capturable,
444442
updated_by,
445443
merchant_connector_id,
444+
surcharge_amount,
445+
tax_amount,
446446
} => Self {
447447
amount: Some(amount),
448448
currency: Some(currency),
@@ -463,6 +463,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
463463
amount_capturable,
464464
updated_by,
465465
merchant_connector_id,
466+
surcharge_amount,
467+
tax_amount,
466468
..Default::default()
467469
},
468470
PaymentAttemptUpdate::VoidUpdate {
@@ -501,8 +503,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
501503
error_reason,
502504
connector_response_reference_id,
503505
amount_capturable,
504-
surcharge_amount,
505-
tax_amount,
506506
updated_by,
507507
authentication_data,
508508
encoded_data,
@@ -524,8 +524,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
524524
connector_response_reference_id,
525525
amount_capturable,
526526
updated_by,
527-
surcharge_amount,
528-
tax_amount,
529527
authentication_data,
530528
encoded_data,
531529
unified_code,
@@ -539,8 +537,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
539537
error_message,
540538
error_reason,
541539
amount_capturable,
542-
surcharge_amount,
543-
tax_amount,
544540
updated_by,
545541
unified_code,
546542
unified_message,
@@ -554,8 +550,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
554550
error_reason,
555551
amount_capturable,
556552
updated_by,
557-
surcharge_amount,
558-
tax_amount,
559553
unified_code,
560554
unified_message,
561555
connector_transaction_id,

crates/euclid/src/backend/vir_interpreter/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ impl Context {
7474
}
7575
}
7676

77+
if let Some(card_network) = payment_method.card_network {
78+
enum_values.insert(EuclidValue::CardNetwork(card_network));
79+
}
80+
7781
if let Some(at) = payment.authentication_type {
7882
enum_values.insert(EuclidValue::AuthenticationType(at));
7983
}

crates/router/src/analytics/routes.rs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ use router_env::AnalyticsFlow;
88
use super::{core::*, payments, refunds, types::AnalyticsDomain};
99
use crate::{
1010
core::api_locking,
11-
services::{api, authentication as auth, authentication::AuthenticationData},
11+
services::{
12+
api, authentication as auth, authentication::AuthenticationData,
13+
authorization::permissions::Permission,
14+
},
1215
AppState,
1316
};
1417

@@ -68,7 +71,11 @@ pub async fn get_payment_metrics(
6871
|state, auth: AuthenticationData, req| {
6972
payments::get_metrics(state.pool.clone(), auth.merchant_account, req)
7073
},
71-
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
74+
auth::auth_type(
75+
&auth::ApiKeyAuth,
76+
&auth::JWTAuth(Permission::Analytics),
77+
req.headers(),
78+
),
7279
api_locking::LockAction::NotApplicable,
7380
)
7481
.await
@@ -98,7 +105,11 @@ pub async fn get_refunds_metrics(
98105
|state, auth: AuthenticationData, req| {
99106
refunds::get_metrics(state.pool.clone(), auth.merchant_account, req)
100107
},
101-
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
108+
auth::auth_type(
109+
&auth::ApiKeyAuth,
110+
&auth::JWTAuth(Permission::Analytics),
111+
req.headers(),
112+
),
102113
api_locking::LockAction::NotApplicable,
103114
)
104115
.await
@@ -118,7 +129,11 @@ pub async fn get_payment_filters(
118129
|state, auth: AuthenticationData, req| {
119130
payment_filters_core(state.pool.clone(), req, auth.merchant_account)
120131
},
121-
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
132+
auth::auth_type(
133+
&auth::ApiKeyAuth,
134+
&auth::JWTAuth(Permission::Analytics),
135+
req.headers(),
136+
),
122137
api_locking::LockAction::NotApplicable,
123138
)
124139
.await
@@ -138,7 +153,11 @@ pub async fn get_refund_filters(
138153
|state, auth: AuthenticationData, req: GetRefundFilterRequest| {
139154
refund_filter_core(state.pool.clone(), req, auth.merchant_account)
140155
},
141-
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
156+
auth::auth_type(
157+
&auth::ApiKeyAuth,
158+
&auth::JWTAuth(Permission::Analytics),
159+
req.headers(),
160+
),
142161
api_locking::LockAction::NotApplicable,
143162
)
144163
.await

crates/router/src/connector/prophetpay/transformers.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,7 @@ impl<F> TryFrom<&ProphetpayRouterData<&types::RefundsRouterData<F>>> for Prophet
583583
action_type: ProphetpayActionType::get_action_type(&ProphetpayActionType::Refund),
584584
})
585585
} else {
586-
Err(errors::ConnectorError::NotImplemented(
587-
"Partial Refund is Not Supported".to_string(),
588-
)
589-
.into())
586+
Err(errors::ConnectorError::NotImplemented("Partial Refund".to_string()).into())
590587
}
591588
}
592589
}

crates/router/src/connector/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ where
113113
enums::AttemptStatus::Charged => {
114114
let captured_amount =
115115
types::Capturable::get_capture_amount(&self.request, payment_data);
116-
if Some(payment_data.payment_attempt.get_total_amount()) == captured_amount {
116+
let total_capturable_amount = payment_data.payment_attempt.get_total_amount();
117+
if Some(total_capturable_amount) == captured_amount {
117118
enums::AttemptStatus::Charged
118119
} else if captured_amount.is_some() {
119120
enums::AttemptStatus::PartialCharged

0 commit comments

Comments
 (0)