From 6839980fdb7a1c82a173345b89426b49884d1102 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 4 Oct 2024 15:25:14 -0400 Subject: [PATCH] Added PaidMediaPurchased --- .../Objects/Payments/PaidMediaPurchased.php | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/TgBotLib/Objects/Payments/PaidMediaPurchased.php diff --git a/src/TgBotLib/Objects/Payments/PaidMediaPurchased.php b/src/TgBotLib/Objects/Payments/PaidMediaPurchased.php new file mode 100644 index 0000000..c0b1a47 --- /dev/null +++ b/src/TgBotLib/Objects/Payments/PaidMediaPurchased.php @@ -0,0 +1,60 @@ +from; + } + + /** + * Bot-specified paid media payload + * + * @return string + */ + public function getPaidMediaPayload(): string + { + return $this->paid_media_payload; + } + + /** + * @inheritDoc + */ + public function toArray(): ?array + { + return [ + 'from' => $this->from->toArray(), + 'paid_media_payload' => $this->paid_media_payload, + ]; + } + + /** + * @inheritDoc + */ + public static function fromArray(?array $data): ?PaidMediaPurchased + { + if (is_null($data)) + { + return null; + } + + $object = new self(); + $object->from = isset($data['from']) ? User::fromArray($data['from']) : null; + $object->paid_media_payload = $data['paid_media_payload']; + + return $object; + } + } \ No newline at end of file