-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added answerPreCheckoutQuery, answerShippingQuery payments api methods
- Loading branch information
1 parent
42b715b
commit 3fccd2d
Showing
3 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#pragma once | ||
#include <tgbotxx/objects/LabeledPrice.hpp> | ||
#include <tgbotxx/objects/Object.hpp> | ||
|
||
namespace tgbotxx { | ||
/// @brief This object represents one shipping option. | ||
/// @ref https://core.telegram.org/bots/api#shippingoption | ||
struct ShippingOption { | ||
ShippingOption() = default; | ||
explicit ShippingOption(const nl::json& json) { | ||
fromJson(json); | ||
} | ||
|
||
/// @brief Shipping option identifier | ||
std::string id; | ||
|
||
/// @brief Option title | ||
std::string title; | ||
|
||
/// @brief List of price portions | ||
std::vector<Ptr<LabeledPrice>> prices; | ||
|
||
/// @brief Serializes this object to JSON | ||
/// @returns JSON representation of this object | ||
nl::json toJson() const { | ||
nl::json json = nl::json::object(); | ||
OBJECT_SERIALIZE_FIELD(json, "id", id); | ||
OBJECT_SERIALIZE_FIELD(json, "title", title); | ||
OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, "prices", prices); | ||
return json; | ||
} | ||
|
||
/// @brief Deserializes this object from JSON | ||
void fromJson(const nl::json& json) { | ||
OBJECT_DESERIALIZE_FIELD(json, "id", id, "", false); | ||
OBJECT_DESERIALIZE_FIELD(json, "title", title, "", false); | ||
OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "prices", prices, false); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters