Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reportUrl parameter for SMS and voice messages #41

Merged
merged 2 commits into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MessageBird/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/MessageBird/Objects/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/MessageBird/Objects/VoiceMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
11 changes: 6 additions & 5 deletions tests/integration/messages/MessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/voicemessages/VoiceMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down