Skip to content

Commit dab6a94

Browse files
authored
Change logic to look for the text field to determine the type of webhook (#364)
1 parent 01f762e commit dab6a94

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/SMS/Webhook/DeliveryReceipt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public function getPrice(): string
270270
return $this->price;
271271
}
272272

273-
public function getScts(): string
273+
public function getScts(): ?string
274274
{
275275
return $this->scts;
276276
}

src/SMS/Webhook/Factory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class Factory extends WebhookFactory
2929
*/
3030
public static function createFromArray(array $data)
3131
{
32-
if (array_key_exists('scts', $data)) {
32+
// We are dealing with only two webhooks here. One has the text field, one does not.
33+
// A sort of if/else style block here smells a bit, ideally the backend needs to change.
34+
35+
if (!array_key_exists('text', $data)) {
3336
return new DeliveryReceipt($data);
3437
}
3538

0 commit comments

Comments
 (0)