Skip to content

macellan/iys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IYS

Tests Latest Stable Version Total Downloads

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('[email protected]')
                ->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('[email protected]')
            ->setStatus(StatusTypes::APPROVE)
            ->setType(PermissionTypes::EMAIL))
            ->setSource(ConsentSourceTypes::MOBILE)
            ->setRecipientType(RecipientTypes::INDIVIDUAL);
        ->addPermission($permission
            ->setConsentDate('2022-02-10 09:50:03')
            ->setRecipient('[email protected]')
            ->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('[email protected]')
                ->setRecipientType(RecipientTypes::INDIVIDUAL)
                ->setStatus(StatusTypes::APPROVE)
                ->setType(PermissionTypes::EMAIL)
    );

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.