Add note to SendMessageRequest
This commit is contained in:
commit
a05cf2cc09
@ -72,6 +72,15 @@ class MessageSendRequest implements ModelInterface
|
|||||||
*/
|
*/
|
||||||
private $items;
|
private $items;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $note
|
||||||
|
*
|
||||||
|
* @Type("string")
|
||||||
|
* @Accessor(getter="getNote",setter="setNote")
|
||||||
|
* @SkipWhenEmpty()
|
||||||
|
*/
|
||||||
|
private $note;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $scope
|
* @var string $scope
|
||||||
*
|
*
|
||||||
@ -241,6 +250,22 @@ class MessageSendRequest implements ModelInterface
|
|||||||
$this->items = $items;
|
$this->items = $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null|string
|
||||||
|
*/
|
||||||
|
public function getNote(): ?string
|
||||||
|
{
|
||||||
|
return $this->note;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $note
|
||||||
|
*/
|
||||||
|
public function setNote(string $note): void
|
||||||
|
{
|
||||||
|
$this->note = $note;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
namespace RetailCrm\Mg\Bot\Tests;
|
namespace RetailCrm\Mg\Bot\Tests;
|
||||||
|
|
||||||
use RetailCrm\Mg\Bot\Model\Constants;
|
use RetailCrm\Mg\Bot\Model\Constants;
|
||||||
|
use RetailCrm\Mg\Bot\Model\Entity\Message\Item;
|
||||||
use RetailCrm\Mg\Bot\Model\Entity\Message\MessageCost;
|
use RetailCrm\Mg\Bot\Model\Entity\Message\MessageCost;
|
||||||
use RetailCrm\Mg\Bot\Model\Entity\Message\MessageDelivery;
|
use RetailCrm\Mg\Bot\Model\Entity\Message\MessageDelivery;
|
||||||
use RetailCrm\Mg\Bot\Model\Entity\Message\MessageOrder;
|
use RetailCrm\Mg\Bot\Model\Entity\Message\MessageOrder;
|
||||||
@ -361,4 +362,38 @@ class MessagesTest extends TestCase
|
|||||||
self::assertEquals(3636, $response->getMessageId());
|
self::assertEquals(3636, $response->getMessageId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMessageSendItems()
|
||||||
|
{
|
||||||
|
$client = self::getApiClient(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
$this->getResponse(
|
||||||
|
'{"message_id":4242,"time":"2019-06-24T06:02:04.434291791Z"}',
|
||||||
|
201
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$item = new Item();
|
||||||
|
$item->setCaption('demo caption');
|
||||||
|
$item->setId('e33e5398-814a-47d6-902a-466ba120ce45');
|
||||||
|
|
||||||
|
$request = new MessageSendRequest();
|
||||||
|
$request->setChatId(28);
|
||||||
|
$request->setScope(Constants::MESSAGE_SCOPE_PUBLIC);
|
||||||
|
$request->setContent("Hello");
|
||||||
|
$request->setItems([$item]);
|
||||||
|
$request->setNote('demo note');
|
||||||
|
|
||||||
|
$response = $client->messageSend($request);
|
||||||
|
|
||||||
|
self::assertInstanceOf(MessageSendResponse::class, $response);
|
||||||
|
|
||||||
|
if ($response instanceof MessageSendResponse) {
|
||||||
|
self::assertTrue($response->isSuccessful());
|
||||||
|
self::assertCount(0, $response->getErrors());
|
||||||
|
self::assertEquals(4242, $response->getMessageId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user