diff --git a/CHANGELOG.md b/CHANGELOG.md index fe7e780..5ea7a52 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to `netgsm` will be documented in this file ## Unreleased +## [4.1.0] - 2021-06-01 + +- Bulk address adding support added to IYS. + ## [4.0.0] - 2021-04-26 - IYS integration (add, search) added. diff --git a/README.md b/README.md index 3e5ba06..1fc5627 100755 --- a/README.md +++ b/README.md @@ -348,6 +348,36 @@ $address->setRefId(999999) } ``` +#### Bulk Insert +```php +$address = new \TarfinLabs\Netgsm\Iys\Requests\Add(); +$address->setRefId(999999) + ->setSource('HS_WEB') + ->setRecipient('+905XXXXXXXXX') + ->setStatus('ONAY') + ->setConsentDate(now()->toDateTimeString()) + ->setRecipientType('TACIR'); + +$iys = \TarfinLabs\Netgsm\Netgsm::iys(); +$iys->addAddress($address->setType('MESAJ')); +$iys->addAddress($address->setType('ARAMA')); +$iys->send(); +``` + +#### Response Paramaters for Bulk Insert +```json +{ + "code": "0", + "error": "false", + "uid": "16116f5e-ae2a-4745-927a-xxxxxxxxxxx", + "erroritem": { + "1": { + "recipient": "Telefon numarası 13 karakter ve numerik olmalıdır.+9xxxx" + } + } +} +``` + #### Search Address This service is used to search a phone number or email address on IYS using NetGsm IYS service. diff --git a/src/Iys/AbstractNetgsmIys.php b/src/Iys/AbstractNetgsmIys.php index c7c7533..c882f9c 100644 --- a/src/Iys/AbstractNetgsmIys.php +++ b/src/Iys/AbstractNetgsmIys.php @@ -30,9 +30,7 @@ public function send(): string 'brandCode' => $this->credentials['brand_code'], ], 'body' => [ - 'data' => [ - $this->body, - ], + 'data' => $this->body, ], ], ]); diff --git a/src/Iys/NetgsmIys.php b/src/Iys/NetgsmIys.php index a8dde89..97d346f 100644 --- a/src/Iys/NetgsmIys.php +++ b/src/Iys/NetgsmIys.php @@ -16,7 +16,7 @@ class NetgsmIys extends AbstractNetgsmIys public function addAddress(Add $request): NetgsmIys { $this->url = $request->getUrl(); - $this->body = $request->body(); + $this->body[] = $request->body(); $this->method = 'POST'; return $this; @@ -31,7 +31,7 @@ public function addAddress(Add $request): NetgsmIys public function searchAddress(Search $request): NetgsmIys { $this->url = $request->getUrl(); - $this->body = $request->body(); + $this->body = [$request->body()]; $this->method = 'POST'; return $this;