Add PreCheckoutQueryEvent handling
This commit is contained in:
parent
c57cdfe05c
commit
f1342e3f42
3 changed files with 36 additions and 0 deletions
|
@ -101,6 +101,11 @@
|
||||||
return UpdateEventType::PAID_MEDIA_PURCHASED;
|
return UpdateEventType::PAID_MEDIA_PURCHASED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($update->getPreCheckoutQuery() !== null)
|
||||||
|
{
|
||||||
|
return UpdateEventType::PRE_CHECKOUT_QUERY;
|
||||||
|
}
|
||||||
|
|
||||||
return UpdateEventType::UPDATE_EVENT;
|
return UpdateEventType::UPDATE_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
use TgBotLib\Events\PollAnswerEvent;
|
use TgBotLib\Events\PollAnswerEvent;
|
||||||
use TgBotLib\Events\PollEvent;
|
use TgBotLib\Events\PollEvent;
|
||||||
use TgBotLib\Events\PaidMediaPurchasedEvent;
|
use TgBotLib\Events\PaidMediaPurchasedEvent;
|
||||||
|
use TgBotLib\Events\PreCheckoutQueryEvent;
|
||||||
use TgBotLib\Events\RemovedChatBoostEvent;
|
use TgBotLib\Events\RemovedChatBoostEvent;
|
||||||
|
|
||||||
enum UpdateEventType : string
|
enum UpdateEventType : string
|
||||||
|
@ -23,4 +24,5 @@
|
||||||
case POLL_ANSWER = PollAnswerEvent::class;
|
case POLL_ANSWER = PollAnswerEvent::class;
|
||||||
case POLL = PollEvent::class;
|
case POLL = PollEvent::class;
|
||||||
case PAID_MEDIA_PURCHASED = PaidMediaPurchasedEvent::class;
|
case PAID_MEDIA_PURCHASED = PaidMediaPurchasedEvent::class;
|
||||||
|
case PRE_CHECKOUT_QUERY = PreCheckoutQueryEvent::class;
|
||||||
}
|
}
|
||||||
|
|
29
src/TgBotLib/Events/PreCheckoutQueryEvent.php
Normal file
29
src/TgBotLib/Events/PreCheckoutQueryEvent.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Events;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\UpdateEvent;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\UpdateEventType;
|
||||||
|
use TgBotLib\Objects\Payments\PreCheckoutQuery;
|
||||||
|
|
||||||
|
abstract class PreCheckoutQueryEvent extends UpdateEvent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getEventType(): UpdateEventType
|
||||||
|
{
|
||||||
|
return UpdateEventType::PRE_CHECKOUT_QUERY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New incoming pre-checkout query. Contains full information about checkout
|
||||||
|
*
|
||||||
|
* @return PreCheckoutQuery
|
||||||
|
*/
|
||||||
|
protected function getPreCheckoutQuery(): PreCheckoutQuery
|
||||||
|
{
|
||||||
|
return $this->update->getPreCheckoutQuery();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue