Skip to content

Commit

Permalink
Update code to reflect latest changes to the Bot API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TiiFuchs committed Jul 7, 2024
1 parent fa86cc2 commit df89ce0
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Telegram/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ class Message extends MaybeInaccessibleMessage
/** <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> */
public ?SuccessfulPayment $successful_payment = null;

/** <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> */
public ?RefundedPayment $refunded_payment = null;

/** <em>Optional</em>. Service message: users were shared with the bot */
public ?UsersShared $users_shared = null;

Expand Down Expand Up @@ -339,6 +342,7 @@ class Message extends MaybeInaccessibleMessage
* @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.
* @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>
* @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>
* @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>
* @param UsersShared $users_shared <em>Optional</em>. Service message: users were shared with the bot
* @param ChatShared $chat_shared <em>Optional</em>. Service message: a chat was shared with the bot
* @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>
Expand Down Expand Up @@ -425,6 +429,7 @@ public static function make(
?MaybeInaccessibleMessage $pinned_message = null,
?Invoice $invoice = null,
?SuccessfulPayment $successful_payment = null,
?RefundedPayment $refunded_payment = null,
?UsersShared $users_shared = null,
?ChatShared $chat_shared = null,
?string $connected_website = null,
Expand Down Expand Up @@ -511,6 +516,7 @@ public static function make(
'pinned_message' => $pinned_message,
'invoice' => $invoice,
'successful_payment' => $successful_payment,
'refunded_payment' => $refunded_payment,
'users_shared' => $users_shared,
'chat_shared' => $chat_shared,
'connected_website' => $connected_website,
Expand Down
50 changes: 50 additions & 0 deletions src/Telegram/RefundedPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/**
* This file is auto-generated.
*/

namespace Telepath\Telegram;

use Telepath\Types\Type;

/**
* This object contains basic information about a refunded payment.
*/
class RefundedPayment extends Type
{
/** 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” */
public string $currency = 'XTR';

/** 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). */
public int $total_amount;

/** Bot-specified invoice payload */
public string $invoice_payload;

/** Telegram payment identifier */
public string $telegram_payment_charge_id;

/** <em>Optional</em>. Provider payment identifier */
public ?string $provider_payment_charge_id = null;

/**
* @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).
* @param string $invoice_payload Bot-specified invoice payload
* @param string $telegram_payment_charge_id Telegram payment identifier
* @param string $provider_payment_charge_id <em>Optional</em>. Provider payment identifier
*/
public static function make(
int $total_amount,
string $invoice_payload,
string $telegram_payment_charge_id,
?string $provider_payment_charge_id = null,
): static {
return new static([
'total_amount' => $total_amount,
'invoice_payload' => $invoice_payload,
'telegram_payment_charge_id' => $telegram_payment_charge_id,
'provider_payment_charge_id' => $provider_payment_charge_id,
]);
}
}

0 comments on commit df89ce0

Please sign in to comment.