mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 12:15:40 +08:00
fix: fix address being null after cancel (#202)
This commit is contained in:
@ -9,13 +9,14 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
|
|||||||
use crate::{
|
use crate::{
|
||||||
core::{
|
core::{
|
||||||
errors::{self, RouterResult, StorageErrorExt},
|
errors::{self, RouterResult, StorageErrorExt},
|
||||||
payments::{operations, CustomerDetails, PaymentAddress, PaymentData},
|
payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
|
||||||
},
|
},
|
||||||
db::StorageInterface,
|
db::StorageInterface,
|
||||||
routes::AppState,
|
routes::AppState,
|
||||||
types::{
|
types::{
|
||||||
api::{self, PaymentIdTypeExt},
|
api::{self, PaymentIdTypeExt},
|
||||||
storage::{self, enums, Customer},
|
storage::{self, enums, Customer},
|
||||||
|
transformers::ForeignInto,
|
||||||
},
|
},
|
||||||
utils::OptionExt,
|
utils::OptionExt,
|
||||||
};
|
};
|
||||||
@ -63,6 +64,23 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
|
|||||||
error.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
|
error.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
let shipping_address = helpers::get_address_for_payment_request(
|
||||||
|
db,
|
||||||
|
None,
|
||||||
|
payment_intent.shipping_address_id.as_deref(),
|
||||||
|
merchant_id,
|
||||||
|
&payment_intent.customer_id,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
let billing_address = helpers::get_address_for_payment_request(
|
||||||
|
db,
|
||||||
|
None,
|
||||||
|
payment_intent.billing_address_id.as_deref(),
|
||||||
|
merchant_id,
|
||||||
|
&payment_intent.customer_id,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
let connector_response = db
|
let connector_response = db
|
||||||
.find_connector_response_by_payment_id_merchant_id_txn_id(
|
.find_connector_response_by_payment_id_merchant_id_txn_id(
|
||||||
&payment_attempt.payment_id,
|
&payment_attempt.payment_id,
|
||||||
@ -98,7 +116,10 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
|
|||||||
mandate_id: None,
|
mandate_id: None,
|
||||||
setup_mandate: None,
|
setup_mandate: None,
|
||||||
token: None,
|
token: None,
|
||||||
address: PaymentAddress::default(),
|
address: PaymentAddress {
|
||||||
|
shipping: shipping_address.as_ref().map(|a| a.foreign_into()),
|
||||||
|
billing: billing_address.as_ref().map(|a| a.foreign_into()),
|
||||||
|
},
|
||||||
confirm: None,
|
confirm: None,
|
||||||
payment_method_data: None,
|
payment_method_data: None,
|
||||||
force_sync: None,
|
force_sync: None,
|
||||||
|
|||||||
Reference in New Issue
Block a user