From d206d20dd59241865dec4084e287f9cfcd462389 Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 27 Nov 2024 21:55:15 -0500 Subject: [PATCH] Add SetPassportDataErrors method --- src/TgBotLib/Enums/Methods.php | 3 + .../Methods/SetPassportDataErrors.php | 58 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/TgBotLib/Methods/SetPassportDataErrors.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 7912128..b8af170 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -109,6 +109,7 @@ use TgBotLib\Methods\SetMyDescription; use TgBotLib\Methods\SetMyName; use TgBotLib\Methods\SetMyShortDescription; + use TgBotLib\Methods\SetPassportDataErrors; use TgBotLib\Methods\SetStickerEmojiList; use TgBotLib\Methods\SetStickerMaskPosition; use TgBotLib\Methods\SetStickerPositionInSet; @@ -249,6 +250,7 @@ case ANSWER_SHIPPING_QUERY = 'answerShippingQuery'; case ANSWER_PRE_CHECKOUT_QUERY = 'answerPreCheckoutQuery'; case GET_STAR_TRANSACTIONS = 'getStarTransactions'; + case SET_PASSPORT_DATA_ERRORS = 'setPassportDataErrors'; /** * Executes a command on the provided bot with the given parameters. @@ -383,6 +385,7 @@ self::ANSWER_SHIPPING_QUERY => AnswerShippingQuery::execute($bot, $parameters), self::ANSWER_PRE_CHECKOUT_QUERY => AnswerPreCheckoutQuery::execute($bot, $parameters), self::GET_STAR_TRANSACTIONS => GetStarTransactions::execute($bot, $parameters), + self::SET_PASSPORT_DATA_ERRORS => SetPassportDataErrors::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/SetPassportDataErrors.php b/src/TgBotLib/Methods/SetPassportDataErrors.php new file mode 100644 index 0000000..c48c3f7 --- /dev/null +++ b/src/TgBotLib/Methods/SetPassportDataErrors.php @@ -0,0 +1,58 @@ +toArray(); + } + + if(is_array($error)) + { + $errors[] = $error; + } + } + + $parameters['errors'] = json_encode($errors); + } + + return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_PASSPORT_DATA_ERRORS->value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'user_id', + 'errors' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return null; + } + } \ No newline at end of file