Skip to content

Commit

Permalink
Merge pull request #400 from Catrya/new_order_premium_price
Browse files Browse the repository at this point in the history
* disallow premium with fixed order

* fix test

* cargo fmt

* more idiomatic
  • Loading branch information
grunch authored Dec 11, 2024
2 parents e019e8a + ecb5835 commit 3e5f7fa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ pub async fn order_action(
amount_vec.push(max);
}

let premium = (order.premium != 0).then_some(order.premium);
let amount = (order.amount != 0).then_some(order.amount);
let fiat_amount = (order.fiat_amount != 0).then_some(order.fiat_amount);

if premium.is_some() && amount.is_some() && fiat_amount.is_some() {
send_cant_do_msg(request_id, None, None, &event.sender).await;
return Ok(());
}

for fiat_amount in amount_vec.iter() {
let quote = match order.amount {
0 => match get_bitcoin_price(&order.fiat_code) {
Expand Down

0 comments on commit 3e5f7fa

Please sign in to comment.