Change payment ammounts from i32 to u32

This commit is contained in:
Maybe Waffle 2023-06-05 17:09:35 +04:00
parent 1b7252382f
commit 70b9510e33
5 changed files with 7 additions and 6 deletions

View file

@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `message_thread_id` method parameters now use `ThreadId` instead of `i32` ([#887][pr887]) - `message_thread_id` method parameters now use `ThreadId` instead of `i32` ([#887][pr887])
- `DiceEmoji` variant order ([#887][pr887]) - `DiceEmoji` variant order ([#887][pr887])
- `Dice::value` now use `u8`, instead of `i32` ([#887][pr887]) - `Dice::value` now use `u8`, instead of `i32` ([#887][pr887])
- `Invoice::total_amount`, `LabeledPrice::amount`, `PreCheckoutQuery::total_amount`, `SuccessfulPayment::total_amout` now use `u32`, instead of `i32` ([#887][pr887])
[pr852]: https://github.com/teloxide/teloxide/pull/853 [pr852]: https://github.com/teloxide/teloxide/pull/853
[pr859]: https://github.com/teloxide/teloxide/pull/859 [pr859]: https://github.com/teloxide/teloxide/pull/859

View file

@ -25,5 +25,5 @@ pub struct Invoice {
/// majority of currencies). /// majority of currencies).
/// ///
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json /// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
pub total_amount: i32, pub total_amount: u32,
} }

View file

@ -16,11 +16,11 @@ pub struct LabeledPrice {
/// ///
/// [currency]: https://core.telegram.org/bots/payments#supported-currencies /// [currency]: https://core.telegram.org/bots/payments#supported-currencies
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json /// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
pub amount: i32, pub amount: u32,
} }
impl LabeledPrice { impl LabeledPrice {
pub fn new<S>(label: S, amount: i32) -> Self pub fn new<S>(label: S, amount: u32) -> Self
where where
S: Into<String>, S: Into<String>,
{ {
@ -36,7 +36,7 @@ impl LabeledPrice {
} }
#[must_use] #[must_use]
pub fn amount(mut self, val: i32) -> Self { pub fn amount(mut self, val: u32) -> Self {
self.amount = val; self.amount = val;
self self
} }

View file

@ -26,7 +26,7 @@ pub struct PreCheckoutQuery {
/// majority of currencies). /// majority of currencies).
/// ///
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json /// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
pub total_amount: i32, pub total_amount: u32,
/// Bot specified invoice payload. /// Bot specified invoice payload.
pub invoice_payload: String, pub invoice_payload: String,

View file

@ -20,7 +20,7 @@ pub struct SuccessfulPayment {
/// the majority of currencies). /// the majority of currencies).
/// ///
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json /// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
pub total_amount: i32, pub total_amount: u32,
/// Bot specified invoice payload. /// Bot specified invoice payload.
pub invoice_payload: String, pub invoice_payload: String,