Skip to content

Commit

Permalink
Merge pull request #26 from tarfin-labs/iys-bulk-request
Browse files Browse the repository at this point in the history
Bulk address adding support added to IYS.
  • Loading branch information
hozdemir authored Jun 1, 2021
2 parents 3ce5366 + 04b4eda commit d6f2908
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions src/Iys/AbstractNetgsmIys.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public function send(): string
'brandCode' => $this->credentials['brand_code'],
],
'body' => [
'data' => [
$this->body,
],
'data' => $this->body,
],
],
]);
Expand Down
4 changes: 2 additions & 2 deletions src/Iys/NetgsmIys.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit d6f2908

Please sign in to comment.