diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dcae2ca..540e8552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [4.53.0](https://github.com/plivo/plivo-php/tree/v4.53.0) (2023-08-03) +**Feature - DLT parameters** +- Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the [send message API](https://www.plivo.com/docs/sms/api/message/send-a-message/) +- Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the response for the [list all messages API](https://www.plivo.com/docs/sms/api/message/list-all-messages/) and the [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message) + ## [4.52.0](https://github.com/plivo/plivo-php/tree/v4.52.0) (2023-07-18) - Removed object_id and object_type in the parameter as well as response in [list all numbers API] diff --git a/Makefile b/Makefile index 3dc93e32..ef7d0038 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,10 @@ build: docker-compose up --build --remove-orphans +start: + docker-compose up --build --remove-orphans --detach + docker attach $(shell docker-compose ps -q phpSDK) + test: @[ "${CONTAINER}" ] && \ docker exec -it $$CONTAINER /bin/bash -c "/usr/src/app/vendor/bin/phpunit --verbose --bootstrap tests/bootstrap.php --testsuite resources-tests tests" || \ diff --git a/src/Plivo/Resources/Message/Message.php b/src/Plivo/Resources/Message/Message.php index f1650b81..6cdce2f3 100644 --- a/src/Plivo/Resources/Message/Message.php +++ b/src/Plivo/Resources/Message/Message.php @@ -68,6 +68,15 @@ public function __construct( if (!empty($response['message_expiry'])) { $this->properties['messageExpiry'] = $response['message_expiry']; } + if (!empty($response['dlt_entity_id'])) { + $this->properties['dltEntityID'] = $response['dlt_entity_id']; + } + if (!empty($response['dlt_template_id'])) { + $this->properties['dltTemplateID'] = $response['dlt_template_id']; + } + if (!empty($response['dlt_template_category'])) { + $this->properties['dltTemplateCategory'] = $response['dlt_template_category']; + } if (!empty($response['requester_ip'])) { $this->properties['requesterIP'] = $response['requester_ip']; diff --git a/src/Plivo/Version.php b/src/Plivo/Version.php index 38ae7a1f..7bbf0783 100644 --- a/src/Plivo/Version.php +++ b/src/Plivo/Version.php @@ -20,7 +20,7 @@ class Version /** * @const int PHP helper library minor version number */ - const MINOR = 52; + const MINOR = 53; /** * @const int PHP helper library patch number diff --git a/tests/Mocks/messageGetResponse.json b/tests/Mocks/messageGetResponse.json index 26d63d22..db9c01e5 100644 --- a/tests/Mocks/messageGetResponse.json +++ b/tests/Mocks/messageGetResponse.json @@ -16,5 +16,8 @@ "requester_ip": "192.168.1.1", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "1234", + "dlt_template_id": "5678", + "dlt_template_category": "service_implicit" } \ No newline at end of file diff --git a/tests/Mocks/messageListResponse.json b/tests/Mocks/messageListResponse.json index b8a9600e..0a6f3589 100644 --- a/tests/Mocks/messageListResponse.json +++ b/tests/Mocks/messageListResponse.json @@ -23,7 +23,10 @@ "requester_ip": "192.168.1.1", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "9876", + "dlt_template_id": "5432", + "dlt_template_category": "promotional" }, { "error_code": null, @@ -41,7 +44,10 @@ "requester_ip": "192.168.1.2", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -59,7 +65,10 @@ "requester_ip": "192.168.1.3", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -77,7 +86,10 @@ "requester_ip": "192.168.1.4", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -95,7 +107,10 @@ "requester_ip": "192.168.1.5", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -113,7 +128,10 @@ "requester_ip": "192.168.1.6", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -131,7 +149,10 @@ "requester_ip": "192.168.1.7", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -149,7 +170,10 @@ "requester_ip": "192.168.1.8", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": "000", @@ -167,7 +191,10 @@ "requester_ip": "192.168.1.9", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -185,7 +212,10 @@ "requester_ip": "192.168.1.10", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": "000", @@ -203,7 +233,10 @@ "requester_ip": "192.168.1.11", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -221,7 +254,10 @@ "requester_ip": "192.168.1.12", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": "000", @@ -239,7 +275,10 @@ "requester_ip": "192.168.1.13", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -257,7 +296,10 @@ "requester_ip": "192.168.1.14", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": "000", @@ -275,7 +317,10 @@ "requester_ip": "192.168.1.15", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": null, @@ -293,7 +338,10 @@ "requester_ip": "192.168.1.16", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": "000", @@ -311,7 +359,10 @@ "requester_ip": "192.168.1.17", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": "000", @@ -329,7 +380,10 @@ "requester_ip": "192.168.1.18", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": "000", @@ -347,7 +401,10 @@ "requester_ip": "192.168.1.19", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" }, { "error_code": "000", @@ -365,7 +422,10 @@ "requester_ip": "192.168.1.20", "is_domestic": false, "destination_country_iso2": "IN", - "replaced_sender": "INSID" + "replaced_sender": "INSID", + "dlt_entity_id": "", + "dlt_template_id": "", + "dlt_template_category": "" } ] } \ No newline at end of file diff --git a/tests/Resources/MessageTest.php b/tests/Resources/MessageTest.php index b9fb330b..9f37043b 100644 --- a/tests/Resources/MessageTest.php +++ b/tests/Resources/MessageTest.php @@ -80,6 +80,9 @@ public function testMessageGet() { $messageUuid = "5b40a428-bfc7-4daf-9d06-726c558bf3b8"; $requesterIP = "192.168.1.1"; + $dltEntityID = "1234"; + $dltTemplateID = "5678"; + $dltTemplateCategory = "service_implicit"; $request = new PlivoRequest( 'GET', 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/', @@ -96,6 +99,9 @@ public function testMessageGet() self::assertEquals($actual->messageUuid, $messageUuid); self::assertEquals($actual->requesterIP, $requesterIP); + self::assertEquals($actual->dltEntityID, $dltEntityID); + self::assertEquals($actual->dltTemplateID, $dltTemplateID); + self::assertEquals($actual->dltTemplateCategory, $dltTemplateCategory); } public function testMessageGetwithPowerpack() @@ -143,6 +149,9 @@ function testMessageList() { $requesterIP1 = "192.168.1.1"; $requesterIP2 = "192.168.1.20"; + $dltEntityID = "9876"; + $dltTemplateID = "5432"; + $dltTemplateCategory = "promotional"; $request = new PlivoRequest( 'Get', 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', @@ -158,6 +167,13 @@ function testMessageList() self::assertNotNull($actual); self::assertEquals($actual->resources[0]->requesterIP, $requesterIP1); self::assertEquals($actual->resources[19]->requesterIP, $requesterIP2); + + self::assertEquals($actual->resources[0]->dltEntityID, $dltEntityID); + self::assertEquals($actual->resources[0]->dltTemplateID, $dltTemplateID); + self::assertEquals($actual->resources[0]->dltTemplateCategory, $dltTemplateCategory); + self::assertObjectNotHasAttribute('dltEntityID', $actual->resources[19]); + self::assertObjectNotHasAttribute('dltTemplateID', $actual->resources[19]); + self::assertObjectNotHasAttribute('dltTemplateCategory', $actual->resources[19]); } } \ No newline at end of file