Skip to content

Commit

Permalink
Passport Data Errors (fix #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Aug 1, 2024
1 parent 33351eb commit 1333b04
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion src/4/passport/errors.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# Passport Data Errors

> This chapter is not yet written.
[![setPassportDataErrors method](https://img.shields.io/badge/Bot_API_method-setPassportDataErrors-blue.svg?style=flat-square)](https://core.telegram.org/bots/api#setpassportdataerrors)
[![Passport Element Errors tests](https://img.shields.io/badge/Examples-Passport_Element_Errors-green.svg?style=flat-square)](https://github.com/TelegramBots/Telegram.Bot.Extensions.Passport/tree/master/test/IntegrationTests/Passport%20Element%20Errors)

If the passport data you received contains errors, the bot can use the [SetPassportDataErrors](https://core.telegram.org/bots/api#setpassportdataerrors) method to inform the user and request information again. The user will not be able to resend the data, until all errors are fixed.

Here is an example call using decrypted [credentials](files-docs.md#credentials):

```csharp
//using Telegram.Bot.Types.Passport;
PassportElementError[] errors =
{
new PassportElementErrorDataField
{
Type = EncryptedPassportElementType.Passport,
FieldName = "document_no",
DataHash = credentials.SecureData.Passport.Data.DataHash,
Message = "Invalid passport number"
},
new PassportElementErrorFrontSide
{
Type = EncryptedPassportElementType.Passport,
FileHash = credentials.SecureData.Passport.FrontSide.FileHash,
Message = "Document scan is redacted"
},
new PassportElementErrorSelfie
{
Type = EncryptedPassportElementType.Passport,
FileHash = credentials.SecureData.Passport.Selfie.FileHash,
Message = "Take a selfie without glasses"
},
new PassportElementErrorTranslationFile
{
Type = EncryptedPassportElementType.Passport,
FileHash = credentials.SecureData.Passport.Translation[0].FileHash,
Message = "Document photo is blury"
},
};

await bot.SetPassportDataErrors(passportMessage.From.Id, errors);
```

0 comments on commit 1333b04

Please sign in to comment.