tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
RefundedPayment.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
8 RefundedPayment() = default;
9 explicit RefundedPayment(const nl::json& json) {
10 fromJson(json);
11 }
12
16 std::string currency;
17
23 std::int64_t totalAmount{};
24
26 std::string invoicePayload;
27
30
33
36 nl::json toJson() const {
37 nl::json json = nl::json::object();
38 OBJECT_SERIALIZE_FIELD(json, "currency", currency);
39 OBJECT_SERIALIZE_FIELD(json, "total_amount", totalAmount);
40 OBJECT_SERIALIZE_FIELD(json, "invoice_payload", invoicePayload);
41 OBJECT_SERIALIZE_FIELD(json, "telegram_payment_charge_id", telegramPaymentChargeId);
42 OBJECT_SERIALIZE_FIELD(json, "provider_payment_charge_id", providerPaymentChargeId);
43 return json;
44 }
45
47 void fromJson(const nl::json& json) {
48 OBJECT_DESERIALIZE_FIELD(json, "currency", currency, "", false);
49 OBJECT_DESERIALIZE_FIELD(json, "total_amount", totalAmount, 0, false);
50 OBJECT_DESERIALIZE_FIELD(json, "invoice_payload", invoicePayload, "", false);
51 OBJECT_DESERIALIZE_FIELD(json, "telegram_payment_charge_id", telegramPaymentChargeId, "", false);
52 OBJECT_DESERIALIZE_FIELD(json, "provider_payment_charge_id", providerPaymentChargeId, "", true);
53 }
54 };
55}
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:46
This object contains basic information about a refunded payment. https://core.telegram....
nl::json toJson() const
Serializes this object to JSON.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::int64_t totalAmount
Total refunded price in the smallest units of the currency (integer, not float/double)....
std::string currency
Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently,...
std::string providerPaymentChargeId
Optional. Provider payment identifier.
std::string telegramPaymentChargeId
Telegram payment identifier.
std::string invoicePayload
Bot-specified invoice payload.
RefundedPayment(const nl::json &json)