Skip to content

Commit df89ce0

Browse files
committed
Update code to reflect latest changes to the Bot API documentation
1 parent fa86cc2 commit df89ce0

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

src/Telegram/Message.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ class Message extends MaybeInaccessibleMessage
206206
/** <em>Optional</em>. Message is a service message about a successful payment, information about the payment. <a href="https://core.telegram.org/bots/api#payments">More about payments &#xBB;</a> */
207207
public ?SuccessfulPayment $successful_payment = null;
208208

209+
/** <em>Optional</em>. Message is a service message about a refunded payment, information about the payment. <a href="https://core.telegram.org/bots/api#payments">More about payments &#xBB;</a> */
210+
public ?RefundedPayment $refunded_payment = null;
211+
209212
/** <em>Optional</em>. Service message: users were shared with the bot */
210213
public ?UsersShared $users_shared = null;
211214

@@ -339,6 +342,7 @@ class Message extends MaybeInaccessibleMessage
339342
* @param MaybeInaccessibleMessage $pinned_message <em>Optional</em>. Specified message was pinned. Note that the Message object in this field will not contain further <em>reply_to_message</em> fields even if it itself is a reply.
340343
* @param Invoice $invoice <em>Optional</em>. Message is an invoice for a <a href="https://core.telegram.org/bots/api#payments">payment</a>, information about the invoice. <a href="https://core.telegram.org/bots/api#payments">More about payments &#xBB;</a>
341344
* @param SuccessfulPayment $successful_payment <em>Optional</em>. Message is a service message about a successful payment, information about the payment. <a href="https://core.telegram.org/bots/api#payments">More about payments &#xBB;</a>
345+
* @param RefundedPayment $refunded_payment <em>Optional</em>. Message is a service message about a refunded payment, information about the payment. <a href="https://core.telegram.org/bots/api#payments">More about payments &#xBB;</a>
342346
* @param UsersShared $users_shared <em>Optional</em>. Service message: users were shared with the bot
343347
* @param ChatShared $chat_shared <em>Optional</em>. Service message: a chat was shared with the bot
344348
* @param string $connected_website <em>Optional</em>. The domain name of the website on which the user has logged in. <a href="https://core.telegram.org/widgets/login">More about Telegram Login &#xBB;</a>
@@ -425,6 +429,7 @@ public static function make(
425429
?MaybeInaccessibleMessage $pinned_message = null,
426430
?Invoice $invoice = null,
427431
?SuccessfulPayment $successful_payment = null,
432+
?RefundedPayment $refunded_payment = null,
428433
?UsersShared $users_shared = null,
429434
?ChatShared $chat_shared = null,
430435
?string $connected_website = null,
@@ -511,6 +516,7 @@ public static function make(
511516
'pinned_message' => $pinned_message,
512517
'invoice' => $invoice,
513518
'successful_payment' => $successful_payment,
519+
'refunded_payment' => $refunded_payment,
514520
'users_shared' => $users_shared,
515521
'chat_shared' => $chat_shared,
516522
'connected_website' => $connected_website,

src/Telegram/RefundedPayment.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
/**
4+
* This file is auto-generated.
5+
*/
6+
7+
namespace Telepath\Telegram;
8+
9+
use Telepath\Types\Type;
10+
11+
/**
12+
* This object contains basic information about a refunded payment.
13+
*/
14+
class RefundedPayment extends Type
15+
{
16+
/** Three-letter ISO 4217 <a href="https://core.telegram.org/bots/payments#supported-currencies">currency</a> code, or “XTR” for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>. Currently, always “XTR” */
17+
public string $currency = 'XTR';
18+
19+
/** Total refunded price in the <em>smallest units</em> of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the <em>exp</em> parameter in <a href="https://core.telegram.org/bots/payments/currencies.json">currencies.json</a>, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
20+
public int $total_amount;
21+
22+
/** Bot-specified invoice payload */
23+
public string $invoice_payload;
24+
25+
/** Telegram payment identifier */
26+
public string $telegram_payment_charge_id;
27+
28+
/** <em>Optional</em>. Provider payment identifier */
29+
public ?string $provider_payment_charge_id = null;
30+
31+
/**
32+
* @param int $total_amount Total refunded price in the <em>smallest units</em> of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the <em>exp</em> parameter in <a href="https://core.telegram.org/bots/payments/currencies.json">currencies.json</a>, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
33+
* @param string $invoice_payload Bot-specified invoice payload
34+
* @param string $telegram_payment_charge_id Telegram payment identifier
35+
* @param string $provider_payment_charge_id <em>Optional</em>. Provider payment identifier
36+
*/
37+
public static function make(
38+
int $total_amount,
39+
string $invoice_payload,
40+
string $telegram_payment_charge_id,
41+
?string $provider_payment_charge_id = null,
42+
): static {
43+
return new static([
44+
'total_amount' => $total_amount,
45+
'invoice_payload' => $invoice_payload,
46+
'telegram_payment_charge_id' => $telegram_payment_charge_id,
47+
'provider_payment_charge_id' => $provider_payment_charge_id,
48+
]);
49+
}
50+
}

0 commit comments

Comments
 (0)