Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): get apple pay certificates only from metadata during the session call #6515

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 2024.11.08.0

### Features

- **payments:** Add audit events for PaymentCreate update ([#6427](https://github.com/juspay/hyperswitch/pull/6427)) ([`063fe90`](https://github.com/juspay/hyperswitch/commit/063fe904c66c9af3d7ce0a82ad712eac69e41786))

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

- - -

## 2024.11.07.1

### Bug Fixes
Expand Down
19 changes: 5 additions & 14 deletions crates/router/src/core/payments/flows/session_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,11 @@ async fn create_applepay_session_token(
)
} else {
// Get the apple pay metadata
let connector_apple_pay_wallet_details =
helpers::get_applepay_metadata(router_data.connector_wallets_details.clone())
.map_err(|error| {
logger::debug!(
"Apple pay connector wallets details parsing failed in create_applepay_session_token {:?}",
error
)
})
.ok();

let apple_pay_metadata = match connector_apple_pay_wallet_details {
Some(apple_pay_wallet_details) => apple_pay_wallet_details,
None => helpers::get_applepay_metadata(router_data.connector_meta_data.clone())?,
};
let apple_pay_metadata =
helpers::get_applepay_metadata(router_data.connector_meta_data.clone())
.attach_printable(
"Failed to to fetch apple pay certificates during session call",
)?;

// Get payment request data , apple pay session request and merchant keys
let (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use crate::{
utils as core_utils,
},
db::StorageInterface,
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
services,
types::{
Expand Down Expand Up @@ -818,7 +819,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
async fn update_trackers<'b>(
&'b self,
state: &'b SessionState,
_req_state: ReqState,
req_state: ReqState,
mut payment_data: PaymentData<F>,
customer: Option<domain::Customer>,
storage_scheme: enums::MerchantStorageScheme,
Expand Down Expand Up @@ -923,6 +924,11 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
req_state
.event_context
.event(AuditEvent::new(AuditEventType::PaymentCreate))
.with(payment_data.to_event())
.emit();

// payment_data.mandate_id = response.and_then(|router_data| router_data.request.mandate_id);
Ok((
Expand Down
2 changes: 2 additions & 0 deletions crates/router/src/events/audit_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub enum AuditEventType {
capture_amount: Option<MinorUnit>,
multiple_capture_count: Option<i16>,
},
PaymentCreate,
}

#[derive(Debug, Clone, Serialize)]
Expand Down Expand Up @@ -65,6 +66,7 @@ impl Event for AuditEvent {
AuditEventType::RefundSuccess => "refund_success",
AuditEventType::RefundFail => "refund_fail",
AuditEventType::PaymentCancelled { .. } => "payment_cancelled",
AuditEventType::PaymentCreate { .. } => "payment_create",
};
format!(
"{event_type}-{}",
Expand Down
Loading