Add support for ShippingQuery events
This commit is contained in:
parent
f1342e3f42
commit
e843c8ca4f
3 changed files with 37 additions and 0 deletions
|
@ -106,6 +106,11 @@
|
|||
return UpdateEventType::PRE_CHECKOUT_QUERY;
|
||||
}
|
||||
|
||||
if($update->getPreCheckoutQuery() !== null)
|
||||
{
|
||||
return UpdateEventType::PRE_CHECKOUT_QUERY;
|
||||
}
|
||||
|
||||
return UpdateEventType::UPDATE_EVENT;
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
use TgBotLib\Events\PaidMediaPurchasedEvent;
|
||||
use TgBotLib\Events\PreCheckoutQueryEvent;
|
||||
use TgBotLib\Events\RemovedChatBoostEvent;
|
||||
use TgBotLib\Events\ShippingQueryEvent;
|
||||
|
||||
enum UpdateEventType : string
|
||||
{
|
||||
|
@ -25,4 +26,5 @@
|
|||
case POLL = PollEvent::class;
|
||||
case PAID_MEDIA_PURCHASED = PaidMediaPurchasedEvent::class;
|
||||
case PRE_CHECKOUT_QUERY = PreCheckoutQueryEvent::class;
|
||||
case SHIPPING_QUERY = ShippingQueryEvent::class;
|
||||
}
|
||||
|
|
30
src/TgBotLib/Events/ShippingQueryEvent.php
Normal file
30
src/TgBotLib/Events/ShippingQueryEvent.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Events;
|
||||
|
||||
use TgBotLib\Abstracts\UpdateEvent;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Types\EventType;
|
||||
use TgBotLib\Enums\UpdateEventType;
|
||||
use TgBotLib\Objects\Payments\ShippingQuery;
|
||||
|
||||
abstract class ShippingQueryEvent extends UpdateEvent
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getEventType(): UpdateEventType
|
||||
{
|
||||
return UpdateEventType::SHIPPING_QUERY;
|
||||
}
|
||||
|
||||
/**
|
||||
* New incoming shipping query. Only for invoices with flexible price
|
||||
*
|
||||
* @return ShippingQuery
|
||||
*/
|
||||
protected function getShippingQuery(): ShippingQuery
|
||||
{
|
||||
return $this->update->getShippingQuery();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue