Skip to content

Commit

Permalink
Various updates (closes TelegramBots/Telegram.Bot#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Nov 11, 2024
1 parent 5035860 commit 90f6bdc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/4/payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Otherwise you can skip to the next section.

`update.ShippingQuery` would contain information like the current shipping address for the user, and can be received again if the user changes the address.

You should check if the address is supported, and reply using `bot.AnswerShippingQuery` with an error message or a list of shipping options with associated price lines:
You should check if the address is supported, and reply using `bot.AnswerShippingQuery` with an error message or a list of shipping options with associated additional price lines:
```csharp
var shippingOptions = new List<ShippingOption>();
shippingOptions.Add(new() { Title = "DHL Express", Id = "dhl-express",
Expand Down Expand Up @@ -95,7 +95,7 @@ If you confirmed the order in the step above, Telegram requests the payment with

If the payment is successfully processed, you will receive a private Message of type `SuccessfulPayment` from the user, and you must then proceed with delivering the goods or services to the user.

The `message.SuccessfulPayment` structure contains all the same previous information, plus two payment identifiers from Telegram & from the Payment Provider.
The `message.SuccessfulPayment` structure contains all the same previous information, plus two payment identifiers from Telegram and from the Payment Provider.

You should store these ChargeId strings for traceability of the transaction in case of dispute, or refund _(possible with [RefundStarPayment](https://core.telegram.org/bots/api#refundstarpayment))_.

Expand Down Expand Up @@ -125,9 +125,9 @@ async Task OnUpdate(Update update)
await bot.AnswerPreCheckoutQuery(preCheckoutQuery.Id, "Invalid order");
break;
case { Message.SuccessfulPayment: { } successfulPayment }:
System.IO.File.AppendAllText("payments.log", $"\n{DateTime.Now}: " +
System.IO.File.AppendAllText("payments.log", $"{DateTime.Now}: " +
$"User {update.Message.From} paid for {successfulPayment.InvoicePayload}: " +
$"{successfulPayment.TelegramPaymentChargeId} {successfulPayment.ProviderPaymentChargeId}");
$"{successfulPayment.TelegramPaymentChargeId} {successfulPayment.ProviderPaymentChargeId}\n");
if (successfulPayment.InvoicePayload is "unlock_X")
await bot.SendMessage(update.Message.Chat, "Thank you! Feature X is unlocked");
break;
Expand Down
3 changes: 3 additions & 0 deletions src/migrate/Version-21.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ To make it work in your ASP.NET projects, you should now:
- Remove package **Microsoft.AspNetCore.Mvc.NewtonsoftJson** from your project dependencies
- Follow our [Webhook page](../3/updates/webhook.md) to configure your web app correctly

_Note: When deploying a .NET 6+ build via Docker, this introduced a dependency on ASP.NET Core.
See [this issue](https://github.com/TelegramBots/Telegram.Bot/issues/1432) for methods to update your Dockerfile_

## InputPollOption in SendPollAsync

SendPollAsync now expect an array of InputPollOption instead of string.
Expand Down
4 changes: 2 additions & 2 deletions src/migrate/Version-22.x.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Migration guide for version 22.x

If you're migrating from version 19.x, you might want to read our [migration doc for v21](Version-21.x.md) first.
There were a lot of interesting changes in versions v21.x.
There were lots of interesting changes in versions v21.x.

## ⚠️ Breaking changes

Expand Down Expand Up @@ -56,7 +56,7 @@ _(maybe a few more parameter reordering if you didn't use named parameters)_
**Addendum:** we also renamed method `MakeRequest`Async to `SendRequest`
_(if you use this [non-recommended](Version-21.x.md#request-structures) method)_

## What's new in version 22.0.0
## What's new in version 22.0

- Support for [Bot API 7.11](https://core.telegram.org/bots/api#october-31-2024)
- Implicit conversions for single-field structures
Expand Down

0 comments on commit 90f6bdc

Please sign in to comment.