Skip to content

Commit

Permalink
Fixed cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
maaktweluit committed Jan 25, 2021
1 parent 8ff2d65 commit c52f1f9
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions core/payment-driver/zksync/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,20 @@ impl PaymentDriverCron for ZksyncDriver {
.iter()
.map(|payment| payment.order_id.clone())
.collect();
let details = match wallet::verify_tx(&tx_hash).await
{
let details = match wallet::verify_tx(&tx_hash).await {
Ok(a) => a,
Err(e) => {
log::warn!("Failed to get transaction details from zksync, creating bespoke details. Error={}", e);

// Create bespoke payment details:
// - Sender + receiver are the same
// - Date is always now
// - Amount needs to be updated to total of all PaymentEntity's
let mut details = utils::db_to_payment_details(&payments.first().unwrap());
details.amount = payments
.into_iter()
.map(|payment| utils::db_amount_to_big_dec(payment.amount.clone()))
.sum::<BigDecimal>();
// Create bespoke payment details:
// - Sender + receiver are the same
// - Date is always now
// - Amount needs to be updated to total of all PaymentEntity's
let mut details = utils::db_to_payment_details(&payments.first().unwrap());
details.amount = payments
.into_iter()
.map(|payment| utils::db_amount_to_big_dec(payment.amount.clone()))
.sum::<BigDecimal>();
details
}
};
Expand Down

0 comments on commit c52f1f9

Please sign in to comment.