diff --git a/api/src/domain/projectors/projections_for_refresh.rs b/api/src/domain/projectors/projections_for_refresh.rs index 72a57a55e5..ef98ce329c 100644 --- a/api/src/domain/projectors/projections_for_refresh.rs +++ b/api/src/domain/projectors/projections_for_refresh.rs @@ -172,14 +172,11 @@ impl EventListener for Projector { }, _ => (), }, - Event::Project(event) => match event { - ProjectEvent::BudgetLinked { id, budget_id, .. } => { - self.project_budgets_repository.try_insert(ProjectsBudget { - project_id: id, - budget_id, - })?; - }, - _ => (), + Event::Project(ProjectEvent::BudgetLinked { id, budget_id, .. }) => { + self.project_budgets_repository.try_insert(ProjectsBudget { + project_id: id, + budget_id, + })?; }, _ => (), } diff --git a/api/src/presentation/http/routes/payment/receipts.rs b/api/src/presentation/http/routes/payment/receipts.rs index 9c930ebb95..d0d73f4e15 100644 --- a/api/src/presentation/http/routes/payment/receipts.rs +++ b/api/src/presentation/http/routes/payment/receipts.rs @@ -82,31 +82,12 @@ async fn build_payment_receipt( transaction_reference: String, ) -> anyhow::Result { match currency { - currencies::USD => match (recipient_iban, recipient_wallet) { - (Some(recipient_iban), None) => Ok(PaymentReceipt::Sepa { + currencies::USD => match recipient_iban { + Some(recipient_iban) => Ok(PaymentReceipt::Sepa { recipient_iban, transaction_reference, }), - (None, Some(wallet)) => { - let (recipient_address, recipient_ens) = if wallet.starts_with("0x") { - (wallet.parse()?, None) - } else { - let address = ens.eth_address(&wallet).await?; - (address, Some(evm::Name::new(wallet))) - }; - - Ok(PaymentReceipt::Ethereum { - recipient_address, - recipient_ens, - transaction_hash: transaction_reference.parse()?, - }) - }, - (Some(_), Some(_)) => Err(anyhow!( - "You cannot specify both the recipient iban and wallet" - )), - (None, None) => Err(anyhow!( - "You must provide at least the recipient iban or wallet" - )), + _ => Err(anyhow!("You must provide the recipient iban")), }, currencies::OPTIMISM => match recipient_wallet { Some(recipient_address) => Ok(PaymentReceipt::Optimism { @@ -130,11 +111,20 @@ async fn build_payment_receipt( None => Err(anyhow!("You must provide the recipient wallet")), }, currencies::LORDS | currencies::USDC => match recipient_wallet { - Some(recipient_address) => Ok(PaymentReceipt::Ethereum { - recipient_address: recipient_address.parse()?, - recipient_ens: None, - transaction_hash: transaction_reference.parse()?, - }), + Some(wallet) => { + let (recipient_address, recipient_ens) = if wallet.starts_with("0x") { + (wallet.parse()?, None) + } else { + let address = ens.eth_address(&wallet).await?; + (address, Some(evm::Name::new(wallet))) + }; + + Ok(PaymentReceipt::Ethereum { + recipient_address, + recipient_ens, + transaction_hash: transaction_reference.parse()?, + }) + }, None => Err(anyhow!("You must provide the recipient wallet")), }, _ => Err(anyhow!("Currency {currency} is not supported")), diff --git a/api/tests/payment_it.rs b/api/tests/payment_it.rs index 4bc2f1f1d8..2666ccc01b 100644 --- a/api/tests/payment_it.rs +++ b/api/tests/payment_it.rs @@ -994,7 +994,7 @@ impl<'a> Test<'a> { let request = json!({ "amount": 100, - "currency": "USD", + "currency": "USDC", "recipientWallet": "vitalik.eth", "transactionReference": "0xe81124e94cf8dad83553eb35f1e50821dba16d145d9c8e3cc43d7681c68e4b2b", }); @@ -1036,7 +1036,7 @@ impl<'a> Test<'a> { processed_at } => { assert_eq!(id, payment_id); - assert_eq!(amount, Amount::from_decimal(dec!(100), currencies::USD)); + assert_eq!(amount, Amount::from_decimal(dec!(100), currencies::USDC)); assert_eq!(receipt_id, response.receipt_id); assert_eq!(receipt, PaymentReceipt::Ethereum { recipient_address: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045".parse().unwrap(),