From f073e19034b336e12ca1842d1162f300a10ef871 Mon Sep 17 00:00:00 2001 From: David Stotijn Date: Wed, 5 Apr 2017 10:28:47 +0200 Subject: [PATCH 1/2] Add `reportUrl` parameter for SMS and voice messages --- src/MessageBird/Objects/Message.php | 7 +++++++ src/MessageBird/Objects/VoiceMessage.php | 7 +++++++ tests/integration/messages/MessagesTest.php | 11 ++++++----- tests/integration/voicemessages/VoiceMessagesTest.php | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/MessageBird/Objects/Message.php b/src/MessageBird/Objects/Message.php index 50bfebe3..667f6246 100644 --- a/src/MessageBird/Objects/Message.php +++ b/src/MessageBird/Objects/Message.php @@ -130,6 +130,13 @@ class Message extends Base */ public $recipients = array (); + /** + * The URL to send status delivery reports for the message to + * + * @var string + */ + public $reportUrl; + /** * Send a premium SMS diff --git a/src/MessageBird/Objects/VoiceMessage.php b/src/MessageBird/Objects/VoiceMessage.php index d19afe57..7381ebbb 100644 --- a/src/MessageBird/Objects/VoiceMessage.php +++ b/src/MessageBird/Objects/VoiceMessage.php @@ -101,6 +101,13 @@ class VoiceMessage extends Base */ public $recipients = array (); + /** + * The URL to send status delivery reports for the voice message to + * + * @var string + */ + public $reportUrl; + /** * Get the created id * diff --git a/tests/integration/messages/MessagesTest.php b/tests/integration/messages/MessagesTest.php index bcf32bd4..b74648d9 100644 --- a/tests/integration/messages/MessagesTest.php +++ b/tests/integration/messages/MessagesTest.php @@ -43,9 +43,10 @@ public function testCreateMessage() "statusDatetime":"2015-07-03T07:55:31+00:00" } ] - } + }, + "reportUrl":null }')); - $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'messages', null, '{"direction":"mt","type":"sms","originator":"MessageBird","body":"This is a test message.","reference":null,"validity":null,"gateway":null,"typeDetails":[],"datacoding":"plain","mclass":1,"scheduledDatetime":null,"recipients":[31612345678]}'); + $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'messages', null, '{"direction":"mt","type":"sms","originator":"MessageBird","body":"This is a test message.","reference":null,"validity":null,"gateway":null,"typeDetails":[],"datacoding":"plain","mclass":1,"scheduledDatetime":null,"recipients":[31612345678],"reportUrl":null}'); $this->client->messages->create($Message); } @@ -59,7 +60,7 @@ public function testPremiumSmsMessage() $Message->recipients = array(31612345678); $Message->body = 'This is a test message.'; $Message->setPremiumSms(2002, 'mb', 1, 2); - $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'messages', null, '{"direction":"mt","type":"premium","originator":"MessageBird","body":"This is a test message.","reference":null,"validity":null,"gateway":null,"typeDetails":{"shortcode":2002,"keyword":"mb","tariff":1,"mid":2},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"recipients":[31612345678]}'); + $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'messages', null, '{"direction":"mt","type":"premium","originator":"MessageBird","body":"This is a test message.","reference":null,"validity":null,"gateway":null,"typeDetails":{"shortcode":2002,"keyword":"mb","tariff":1,"mid":2},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"recipients":[31612345678],"reportUrl":null}'); $this->client->messages->create($Message); } @@ -73,7 +74,7 @@ public function testBinarySmsMessage() $Message->recipients = array(31612345678); $Message->body = 'This is a test message.'; $Message->setBinarySms("HEADER", "test"); - $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'messages', null, '{"direction":"mt","type":"binary","originator":"MessageBird","body":"test","reference":null,"validity":null,"gateway":null,"typeDetails":{"udh":"HEADER"},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"recipients":[31612345678]}'); + $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'messages', null, '{"direction":"mt","type":"binary","originator":"MessageBird","body":"test","reference":null,"validity":null,"gateway":null,"typeDetails":{"udh":"HEADER"},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"recipients":[31612345678],"reportUrl":null}'); $this->client->messages->create($Message); } @@ -89,7 +90,7 @@ public function testFlashSmsMessage() $Message->body = 'This is a test message.'; $Message->setBinarySms("HEADER", "test"); $Message->setFlash(true); - $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'messages', null, '{"direction":"mt","type":"binary","originator":"MessageBird","body":"test","reference":null,"validity":null,"gateway":null,"typeDetails":{"udh":"HEADER"},"datacoding":"plain","mclass":0,"scheduledDatetime":null,"recipients":[31612345678]}'); + $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'messages', null, '{"direction":"mt","type":"binary","originator":"MessageBird","body":"test","reference":null,"validity":null,"gateway":null,"typeDetails":{"udh":"HEADER"},"datacoding":"plain","mclass":0,"scheduledDatetime":null,"recipients":[31612345678],"reportUrl":null}'); $this->client->messages->create($Message); } diff --git a/tests/integration/voicemessages/VoiceMessagesTest.php b/tests/integration/voicemessages/VoiceMessagesTest.php index d94120c1..e4f3bb31 100644 --- a/tests/integration/voicemessages/VoiceMessagesTest.php +++ b/tests/integration/voicemessages/VoiceMessagesTest.php @@ -18,7 +18,7 @@ public function testVoiceMessageCreate() $Message->body = 'This is a test message.'; $Message->language = "nl"; $Message->voice = "male"; - $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'voicemessages', null, '{"originator":"MessageBird","body":"This is a test message.","reference":null,"language":"nl","voice":"male","repeat":1,"ifMachine":"continue","scheduledDatetime":null,"recipients":[31612345678]}'); + $this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'voicemessages', null, '{"originator":"MessageBird","body":"This is a test message.","reference":null,"language":"nl","voice":"male","repeat":1,"ifMachine":"continue","scheduledDatetime":null,"recipients":[31612345678],"reportUrl":null}'); $this->client->voicemessages->create($Message); } From 2bafd65532454709e84577604cda37bd3e6449ef Mon Sep 17 00:00:00 2001 From: David Stotijn Date: Wed, 5 Apr 2017 10:32:17 +0200 Subject: [PATCH 2/2] Version bump --- src/MessageBird/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessageBird/Client.php b/src/MessageBird/Client.php index 75f50084..91aff4cc 100644 --- a/src/MessageBird/Client.php +++ b/src/MessageBird/Client.php @@ -12,7 +12,7 @@ class Client const ENDPOINT = 'https://rest.messagebird.com'; const CHATAPI_ENDPOINT = 'https://chat.messagebird.com/1'; - const CLIENT_VERSION = '1.6.4'; + const CLIENT_VERSION = '1.6.5'; /** * @var string