Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(payment_attempt): fix incorrect value being serialized in payment attempt update flow (#12592)

Sanchith Hegde71532f87eec1
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index e0f0f20a47..0c3562f0b9 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -1056,12 +1056,13 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.convert()
.await
.change_context(errors::StorageError::EncryptionError)?;
- let updated_payment_attempt_diesel = payment_attempt.to_storage_model();
+ let payment_attempt_update_diesel = payment_attempt.to_storage_model();
+ let updated_payment_attempt_diesel = payment_attempt_update_diesel
+ .clone()
+ .apply_changeset(source_payment_attempt_diesel.clone());
let updated_attempt = PaymentAttempt::convert_back(
key_manager_state,
- updated_payment_attempt_diesel
- .clone()
- .apply_changeset(source_payment_attempt_diesel.clone()),
+ updated_payment_attempt_diesel.clone(),
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
@@ -1132,7 +1133,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
let mut query_gen_conn = pg_connection_write(self).await?;
- let drainer_query = updated_payment_attempt_diesel
+ let drainer_query = payment_attempt_update_diesel
.generate_drainer_update_query(
&mut query_gen_conn,
&source_payment_attempt_diesel,