mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
fix: fix bugs found when testing drainer (#512)
This commit is contained in:
@ -454,7 +454,7 @@ mod storage {
|
||||
|
||||
enums::MerchantStorageScheme::RedisKv => {
|
||||
let key = format!("{}_{}", this.merchant_id, this.payment_id);
|
||||
|
||||
let old_connector_transaction_id = &this.connector_transaction_id;
|
||||
let updated_attempt = payment_attempt.clone().apply_changeset(this.clone());
|
||||
// Check for database presence as well Maybe use a read replica here ?
|
||||
let redis_value = serde_json::to_string(&updated_attempt)
|
||||
@ -470,9 +470,10 @@ mod storage {
|
||||
|
||||
let conn = pg_connection(&self.master_pool).await;
|
||||
// Reverse lookup for connector_transaction_id
|
||||
if let Some(ref connector_transaction_id) =
|
||||
updated_attempt.connector_transaction_id
|
||||
{
|
||||
if let (None, Some(connector_transaction_id)) = (
|
||||
old_connector_transaction_id,
|
||||
&updated_attempt.connector_transaction_id,
|
||||
) {
|
||||
let field = format!("pa_{}", updated_attempt.attempt_id);
|
||||
ReverseLookupNew {
|
||||
lookup_id: format!(
|
||||
|
||||
@ -171,9 +171,9 @@ impl PaymentAttemptUpdate {
|
||||
payment_method_id: pa_update
|
||||
.payment_method_id
|
||||
.unwrap_or(source.payment_method_id),
|
||||
browser_info: pa_update.browser_info,
|
||||
browser_info: pa_update.browser_info.or(source.browser_info),
|
||||
modified_at: common_utils::date_time::now(),
|
||||
payment_token: pa_update.payment_token,
|
||||
payment_token: pa_update.payment_token.or(source.payment_token),
|
||||
..source
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,13 +160,15 @@ impl RefundUpdate {
|
||||
pub fn apply_changeset(self, source: Refund) -> Refund {
|
||||
let pa_update: RefundUpdateInternal = self.into();
|
||||
Refund {
|
||||
connector_refund_id: pa_update.connector_refund_id,
|
||||
connector_refund_id: pa_update.connector_refund_id.or(source.connector_refund_id),
|
||||
refund_status: pa_update.refund_status.unwrap_or(source.refund_status),
|
||||
sent_to_gateway: pa_update.sent_to_gateway.unwrap_or(source.sent_to_gateway),
|
||||
refund_error_message: pa_update.refund_error_message,
|
||||
refund_error_code: pa_update.refund_error_code,
|
||||
refund_arn: pa_update.refund_arn,
|
||||
metadata: pa_update.metadata,
|
||||
refund_error_message: pa_update
|
||||
.refund_error_message
|
||||
.or(source.refund_error_message),
|
||||
refund_error_code: pa_update.refund_error_code.or(source.refund_error_code),
|
||||
refund_arn: pa_update.refund_arn.or(source.refund_arn),
|
||||
metadata: pa_update.metadata.or(source.metadata),
|
||||
..source
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user