Skip to content

Commit

Permalink
Fixes invalid LabeledPrice array
Browse files Browse the repository at this point in the history
Tests will follow
  • Loading branch information
unreal4u committed Jun 19, 2017
1 parent d586553 commit b0359c2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/conf.php-sample
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ define('A_GROUP_CHAT_ID', 'XXXXXXXXX');
define('A_FILE_ID', 'XXXXXXXXXXXXXXXXXXXXXXXX');

define('A_USER_ID', 'XXXXXXXX');

define('PAYMENT_TOKEN', '123412341234:TEST:XXXXXXXXXXX');
15 changes: 15 additions & 0 deletions src/Telegram/Methods/SendInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@ class SendInvoice extends TelegramMethods
*/
public $reply_markup;

/**
* Prices must be an array of objects, so json_encode() them
*
* @see https://github.com/unreal4u/telegram-api/issues/32
* @return TelegramMethods
*/
public function performSpecialConditions(): TelegramMethods
{
if (!empty($this->prices)) {
$this->prices = json_encode($this->prices);
}

return parent::performSpecialConditions();
}

public function getMandatoryFields(): array
{
return [
Expand Down
2 changes: 1 addition & 1 deletion src/TgLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TgLog
* Stores the token
* @var string
*/
private $botToken = '';
private $botToken;

/**
* Contains an instance to a PSR-3 compatible logger
Expand Down

0 comments on commit b0359c2

Please sign in to comment.