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 additional properties to Recipient object #186

Merged
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
78 changes: 77 additions & 1 deletion src/MessageBird/Objects/Recipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,85 @@ class Recipient extends Base
public $status;

/**
* The datum time of the last status in RFC3339 format (Y-m-d\TH:i:sP)
* The date and time of the last status in RFC3339 format (Y-m-d\TH:i:sP)
*
* @var string
*/
public $statusDatetime;


/**
* The details about the status message. More details can be found here:
* https://developers.messagebird.com/api/sms-messaging/#sms-statuses
*
* @var string
*/
public $statusReason;

/**
* Extra error code that describes the failure in more detail (optional,
* null if not available)
*
* @var string
*/
public $statusErrorCode;

/**
* The name of the recipient’s original country, based on MSISDN.
*
* @var string
*/
public $recipientCountry;

/**
* The prefix code for the recipient’s original country, based on MSISDN.
*
* @var int
*/
public $recipientCountryPrefix;

/**
* The name of the operator of the recipient. Identified by MCCMNC
* of the message.
*
* @var string
*/
public $recipientOperator;

/**
* The code of the operator of the message sender.
* It could have null value if the message isn’t delivered yet.
*
* @var string
*/
public $mccmnc;

/**
* The MCC (Mobile Country Code) part of MCCMNC.
*
* @var string
*/
public $mcc;

/**
* The MNC (Mobile Network Code) part of MCCMNC.
*
* @var string
*/
public $mnc;

/**
* The length of the message in characters. Depends on the
* message datacoding.
*
* @var int
*/
public $messageLength;

/**
* The count of total messages send. Personalisation not taken in account.
*
* @var int
*/
public $messagePartCount;
}
26 changes: 25 additions & 1 deletion tests/Integration/Messages/MessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,21 @@ public function testCreateMessageResponse(): void
{
"recipient":31612345678,
"status":"sent",
"statusDatetime":"2015-07-03T07:55:31+00:00"
"statusDatetime":"2015-07-03T07:55:31+00:00",
"statusReason":"successfully delivered",
"statusErrorCode":null,
"recipientCountry":"Netherlands",
"recipientCountryPrefix":31,
"recipientOperator":"KPN",
"mccmnc":"20408",
"mcc":"204",
"mnc":"08",
"messageLength":22,
"messagePartCount":1,
"price":{
"amount":0.075,
"currency":"EUR"
}
}
]
},
Expand Down Expand Up @@ -206,5 +220,15 @@ public function testCreateMessageResponse(): void
self::assertSame(31612345678, $messageResponse->recipients->items[0]->recipient);
self::assertSame('sent', $messageResponse->recipients->items[0]->status);
self::assertSame('2015-07-03T07:55:31+00:00', $messageResponse->recipients->items[0]->statusDatetime);
self::assertSame('successfully delivered', $messageResponse->recipients->items[0]->statusReason);
self::assertSame(null, $messageResponse->recipients->items[0]->statusErrorCode);
self::assertSame('Netherlands', $messageResponse->recipients->items[0]->recipientCountry);
self::assertSame(31, $messageResponse->recipients->items[0]->recipientCountryPrefix);
self::assertSame('KPN', $messageResponse->recipients->items[0]->recipientOperator);
self::assertSame('20408', $messageResponse->recipients->items[0]->mccmnc);
self::assertSame('204', $messageResponse->recipients->items[0]->mcc);
self::assertSame('08', $messageResponse->recipients->items[0]->mnc);
self::assertSame(22, $messageResponse->recipients->items[0]->messageLength);
self::assertSame(1, $messageResponse->recipients->items[0]->messagePartCount);
}
}