Skip to content

Commit 63d208f

Browse files
authored
Fix the type of the message to save a lot of money 💸 (#69)
* Fix the type of the message to save a lot of money Without specifying the type, the default is unicode and messages are split at 70 chars according to the official documentation : https://developer.vonage.com/en/messaging/sms/guides/concatenation-and-encoding The default type is defined in class `VonageMessage` message line 26 as `public $type = 'text';` * Update tests to add the default type "text" * Fix one test
1 parent f13d3a9 commit 63d208f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

‎src/Channels/VonageSmsChannel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public function send($notifiable, Notification $notification)
5858
$vonageSms = new SMS(
5959
$to,
6060
$message->from ?: $this->from,
61-
trim($message->content)
61+
trim($message->content),
62+
$message->type
6263
);
6364

6465
$vonageSms->setClientRef($message->clientReference);

‎tests/Unit/Channels/VonageSmsChannelTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public function testSmsIsSentViaVonage()
2929
$mockSms = (new SMS(
3030
'5555555555',
3131
'4444444444',
32-
'this is my message'
32+
'this is my message',
33+
'text'
3334
));
3435

3536
$vonage->shouldReceive('sms->send')
@@ -46,7 +47,8 @@ public function testSmsIsSentViaVonageWithCustomClient()
4647
->with(IsEqual::equalTo(new SMS(
4748
'5555555555',
4849
'4444444444',
49-
'this is my message'
50+
'this is my message',
51+
'text'
5052
)))
5153
->once();
5254

@@ -177,7 +179,8 @@ public function testCallbackIsApplied()
177179
$mockSms = (new SMS(
178180
'5555555555',
179181
'4444444444',
180-
'this is my message'
182+
'this is my message',
183+
'text'
181184
));
182185

183186
$mockSms->setDeliveryReceiptCallback('https://example.com');

0 commit comments

Comments
 (0)