Skip to content

Commit

Permalink
Fix kado webhook model
Browse files Browse the repository at this point in the history
  • Loading branch information
gemcoder21 committed May 28, 2024
1 parent ff49098 commit 43a0358
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion crates/fiat/src/providers/kado/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ impl KadoClient {
provider: Self::NAME.as_fiat_provider(),
fiat_amount: request.fiat_amount,
fiat_currency: request.clone().fiat_currency,
crypto_amount: quote.clone().receive_unit_count_after_fees.amount,
crypto_amount: quote
.clone()
.receive_unit_count_after_fees
.amount
.unwrap_or_default(),
redirect_url: self.redirect_url(
request.fiat_currency.as_str(),
request.fiat_amount,
Expand Down
2 changes: 1 addition & 1 deletion crates/fiat/src/providers/kado/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub struct Quote {
#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Amount {
pub amount: f64,
pub amount: Option<f64>,
pub unit: String,
}

Expand Down
6 changes: 3 additions & 3 deletions crates/fiat/src/providers/kado/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ impl FiatProvider for KadoClient {
provider_id: Self::NAME.id(),
provider_transaction_id: data.data.id,
status,
fiat_amount: data.data.buy_amount.amount,
fiat_amount: data.data.buy_amount.amount.unwrap_or_default(),
fiat_currency: data.data.currency_type,
transaction_hash: Some(data.data.tx_hash),
address: Some(data.data.wallet_address),
fee_provider: data.data.processing_fee.amount,
fee_network: data.data.gas_fee.amount,
fee_provider: data.data.processing_fee.amount.unwrap_or_default(),
fee_network: data.data.gas_fee.amount.unwrap_or_default(),
fee_partner: 0.0,
};

Expand Down

0 comments on commit 43a0358

Please sign in to comment.