macellan / iys
Iys library for Laravel
Installs: 3 500
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.2|^7.0.1
- illuminate/http: ^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- mockery/mockery: ^1.4.4
- orchestra/testbench: 6.24|^7.1|^8.0|^9.0
- phpunit/phpunit: ^9.5.10|^10.0
- squizlabs/php_codesniffer: ^3.6
README
Installation
You can install this package via composer:
composer require macellan/iys
Setting up the IYS service
Add your IYS login to your config/services.php:
// config/services.php ... 'iys' => [ 'username' => env('IYS_USERNAME', ''), 'password' => env('IYS_PASSWORD', ''), 'iys_code' => env('IYS_CODE', ''), 'brand_code' => env('IYS_BRAND_CODE', ''), 'url' => env('IYS_URL', ''), ], ...
Enums
IYS consent source types:
enum ConsentSourceTypes: string { case PHYSICAL = 'HS_FIZIKSEL_ORTAM'; case WET_SIGNATURE = 'HS_ISLAK_IMZA'; case WEB = 'HS_WEB'; case CALL_CENTER = 'HS_CAGRI_MERKEZI'; case SOCIAL_MEDIA = 'HS_SOSYAL_MEDYA'; case EMAIL = 'HS_EPOSTA'; case MESSAGE = 'HS_MESAJ'; case MOBILE = 'HS_MOBIL'; case HS_EORTAM = 'HS_EORTAM'; case ACTIVITY = 'HS_ETKINLIK'; case HS_2015 = 'HS_2015'; case HS_ATM = 'HS_ATM'; case HS_DECISION = 'HS_KARAR'; }
IYS permission types:
enum PermissionTypes: string { case CALL = 'ARAMA'; case MESSAGE = 'MESAJ'; case EMAIL = 'EPOSTA'; }
IYS recipient types:
enum RecipientTypes: string { case INDIVIDUAL = 'BIREYSEL'; case TRADER = 'TACIR'; }
IYS source types:
enum SourceTypes: string { case HS = 'HS'; case IYS = 'IYS'; }
IYS status types:
enum StatusTypes: string { case APPROVE = 'ONAY'; case REJECT = 'RET'; }
Usage
NOTE: Authentication token is generated per UserManager instance. Expire time is two hour.
With the usage in this example, you can submit a single release. This method works with the "Permission" model
IysManager::make()->createPermissionDriver()->sendSingle( Permission::make() ->setConsentDate('2022-02-10 09:50:02') ->setSource(ConsentSourceTypes::MOBILE) ->setRecipient('example@.com') ->setRecipientType(RecipientTypes::INDIVIDUAL) ->setStatus(StatusTypes::APPROVE) ->setType(PermissionTypes::EMAIL) );
You can send permissions by filling out the permission list model. The permission list model is the permission model array.
$permissionList = PermissionList::make() ->addPermission($permission ->setConsentDate('2022-02-10 09:50:02') ->setRecipient('example1@.com') ->setStatus(StatusTypes::APPROVE) ->setType(PermissionTypes::EMAIL)) ->setSource(ConsentSourceTypes::MOBILE) ->setRecipientType(RecipientTypes::INDIVIDUAL); ->addPermission($permission ->setConsentDate('2022-02-10 09:50:03') ->setRecipient('example2@.com') ->setStatus(StatusTypes::REJECT) ->setType(PermissionTypes::MESSAGE)); ->setSource(ConsentSourceTypes::MOBILE) ->setRecipientType(RecipientTypes::INDIVIDUAL); IysManager::make()->createPermissionDriver()->sendMultiple($permissionList);
You can get send permission information with request id
IysManager::make()->createPermissionDriver()->getStatusByRequestId('request_id');
You can get changed permission by IYS
IysManager::make()->createPermissionDriver()->getChanges();
You can get permission status by permission model
IysManager::make()->createPermissionDriver()->getStatus( Permission::make() ->setConsentDate('2022-02-10 09:50:02') ->setSource(ConsentSourceTypes::MOBILE) ->setRecipient('example@.com') ->setRecipientType(RecipientTypes::INDIVIDUAL) ->setStatus(StatusTypes::APPROVE) ->setType(PermissionTypes::EMAIL) );
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.