Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioGattolla committed Feb 12, 2025
1 parent 4e81921 commit 1164504
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
10 changes: 5 additions & 5 deletions src/Handlers/WebhookHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ public function handle(Request $request, TelegraphBot $bot): void

$this->request = $request;

if ($this->request->has('message.successful_payment')) {
/* @phpstan-ignore-next-line */
$this->handleSuccessfulPayment(SuccessfulPayment::fromArray($this->request->input('message.successful_payment')));
}

if ($this->request->has('message')) {
/* @phpstan-ignore-next-line */
$this->message = Message::fromArray($this->request->input('message'));
Expand Down Expand Up @@ -320,11 +325,6 @@ public function handle(Request $request, TelegraphBot $bot): void
$this->handlePreCheckoutQuery(PreCheckoutQuery::fromArray($this->request->input('pre_checkout_query')));
}

if ($this->request->has('successful_payment')) {
/* @phpstan-ignore-next-line */
$this->handleSuccessfulPayment(SuccessfulPayment::fromArray($this->request->input('successful_payment')));
}

if ($this->request->has('inline_query')) {
/* @phpstan-ignore-next-line */
$this->handleInlineQuery(InlineQuery::fromArray($this->request->input('inline_query')));
Expand Down
44 changes: 23 additions & 21 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,29 +256,31 @@ function webhook_successful_payment($handler = TestWebhookHandler::class): Reque
register_webhook_handler($handler);

return Request::create('', 'POST', [
'successful_payment' => [
'currency' => 'EUR',
'total_amount' => 100,
'invoice_payload' => 'id_10',
'subscription_expiration_date' => 14000,
'is_recurring' => false,
'is_first_recurring' => false,
'shipping_option_id' => 10,
'order_info' => [
'name' => 'test name',
'phone_number' => ' + 39 333 333 3333',
'email' => 'test@email . it',
'shipping_address' => [
'country_code' => ' + 39',
'state' => 'italy',
'city' => 'rome',
'street_line1' => 'street test',
'street_line2' => '',
'post_code' => '00042',
'message' => [
'successful_payment' => [
'currency' => 'EUR',
'total_amount' => 100,
'invoice_payload' => 'id_10',
'subscription_expiration_date' => 14000,
'is_recurring' => false,
'is_first_recurring' => false,
'shipping_option_id' => 10,
'order_info' => [
'name' => 'test name',
'phone_number' => ' + 39 333 333 3333',
'email' => 'test@email . it',
'shipping_address' => [
'country_code' => ' + 39',
'state' => 'italy',
'city' => 'rome',
'street_line1' => 'street test',
'street_line2' => '',
'post_code' => '00042',
],
],
'telegram_payment_charge_id' => 10,
'provider_payment_charge_id' => 10,
],
'telegram_payment_charge_id' => 10,
'provider_payment_charge_id' => 10,
],
]);
}
Expand Down

0 comments on commit 1164504

Please sign in to comment.