From 672ab564c2b7edc0b4c64709f2c978ed3338caa7 Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 27 Nov 2024 14:45:18 -0500 Subject: [PATCH] Add AnswerPreCheckoutQuery method --- src/TgBotLib/Enums/Methods.php | 3 ++ .../Methods/AnswerPreCheckoutQuery.php | 40 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/TgBotLib/Methods/AnswerPreCheckoutQuery.php diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 1dd35af..0807f4c 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -8,6 +8,7 @@ use TgBotLib\Methods\AddStickerToSet; use TgBotLib\Methods\AnswerCallbackQuery; use TgBotLib\Methods\AnswerInlineQuery; + use TgBotLib\Methods\AnswerPreCheckoutQuery; use TgBotLib\Methods\AnswerShippingQuery; use TgBotLib\Methods\AnswerWebAppQuery; use TgBotLib\Methods\ApproveChatJoinRequest; @@ -245,6 +246,7 @@ case SEND_INVOICE = 'sendInvoice'; case CREATE_INVOICE_LINK = 'createInvoiceLink'; case ANSWER_SHIPPING_QUERY = 'answerShippingQuery'; + case ANSWER_PRE_CHECKOUT_QUERY = 'answerPreCheckoutQuery'; /** * Executes a command on the provided bot with the given parameters. @@ -377,6 +379,7 @@ self::SEND_INVOICE => SendInvoice::execute($bot, $parameters), self::CREATE_INVOICE_LINK => CreateInvoiceLink::execute($bot, $parameters), self::ANSWER_SHIPPING_QUERY => AnswerShippingQuery::execute($bot, $parameters), + self::ANSWER_PRE_CHECKOUT_QUERY => AnswerPreCheckoutQuery::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/AnswerPreCheckoutQuery.php b/src/TgBotLib/Methods/AnswerPreCheckoutQuery.php new file mode 100644 index 0000000..67c83b8 --- /dev/null +++ b/src/TgBotLib/Methods/AnswerPreCheckoutQuery.php @@ -0,0 +1,40 @@ +value, $parameters)); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'pre_checkout_query_id', + 'ok' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'error_message' + ]; + } + } \ No newline at end of file