mhunesi / yii2-iys

Yii2 İYS 服务组件

安装: 15

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 1

开放问题: 0

类型:yii2-extension

1.0.1 2020-12-01 06:50 UTC

This package is auto-updated.

Last update: 2024-09-29 05:49:42 UTC


README

Yii2 İleti Yönetim Sistemi (IYS) 集成。Http 请求使用了 Guzzle

安装

推荐通过 composer 工具进行此扩展的安装。

执行以下命令

composer require --prefer-dist mhunesi/yii2-iys "*"

或者

"mhunesi/yii2-iys": "*"

将以下内容添加到您的 composer.json 文件的相关部分。

使用方法

您可以通过 https://apidocs.iys.org.tr/ 地址访问 IYS API 文档和返回的请求响应。

注意:如果您与 IYS 或合作伙伴工作,也可以使用此包。当然,一些合作伙伴可能采用不同的方法。

扩展安装后,请按照以下方式在您的代码中添加配置文件;

'components' => [
    ...
    
    'iys' => [
        'class' => \mhunesi\iys\Iys::className(),
        'url' => 'IYS_URL', // Varsayılan Değer https://api.iys.org.tr
        'username' => 'IYS_USERNAME',
        'password' => 'IYS_PASSWORD',
        'iys_code' => 'IYS_CODE',
        'brand_code' => 'IYS_BRAND_CODE', // Ana Marka. Birden fazla marka ile çalışıyorsanız boş geçebilirsiniz.
    ],
    
    ...
],

如果您与多个品牌合作,则可以省略 brand_code 字段。您可以使用 setBrandCode 方法设置您要与之合作的品牌。

/** @var Iys $iys */
$iys = Yii::$app->iys;

$iys->setBrandCode('A Marka Kodu')->consents(); // A Markası İzin İşlemleri
$iys->setBrandCode('B Marka Kodu')->consents(); // B Markası İzin İşlemleri

$iys

权限管理

添加单个权限

此方法允许将接收到的单个权限一次性加载到 IYS 中。

/** @var Iys $iys */
$iys = Yii::$app->iys;

$response = $iys->consents()->add([
                'consentDate'    => '2018-02-10 09:30:00',
                'source'         => 'HS_CAGRI_MERKEZI',
                'recipient'      => '+905813334455',
                'recipientType'  => 'BIREYSEL',
                'status'         => 'ONAY',
                'type'           => 'ARAMA',
                'retailerCode '  => 11223344,
                'retailerAccess' => [
                     22233344,
                     44222419,
                     13239987
                ]
            ]);

查询单个权限状态

此方法允许服务提供商列出在 IYS 中注册的权限。

$response = $iys->consents()->detail(([
                  'recipient'     => '+905813334455',
                  'recipientType' => 'BIREYSEL',
                  'type'          => 'MESAJ',
              ]);

异步批量添加权限

此方法允许将接收到的权限批量加载到 IYS 中。

$response = $iys->consents()->addBatch([
             [
                 'consentDate'    => '2018-02-10 09:30:00',
                 'source'         => 'HS_MESAJ',
                 'recipient'      => '+905813334455',
                 'recipientType'  => 'BIREYSEL',
                 'status'         => 'RET',
                 'type'           => 'ARAMA',
                 'retailerCode '  => 11223344,
                 'retailerAccess' => [
                     22233344,
                     44222419,
                     13239987
                 ]
             ],
             [
                 'consentDate'    => '2018-02-10 09:40:00',
                 'source'         => 'HS_WEB',
                 'recipient'      => 'ornek@adiniz.com',
                 'recipientType'  => 'BIREYSEL',
                 'status'         => 'ONAY',
                 'type'           => 'EPOSTA',
                 'retailerCode '  => 11223344,
                 'retailerAccess' => [
                     22233344,
                     44222419,
                     13239987
                 ]
             ],
         ]);

查询异步批量添加权限状态

此方法在异步批量添加权限操作完成后,使用返回的操作查询信息来查询权限注册请求的结果。

$response = $iys->consents()->requestDetails('73b75030-3a92-4f1e-b247-b0509dbadbfc');

权限移动查询(拉取)

$response = $iys->consents()->changes();

品牌管理

列出品牌

通过此方法可以获取服务提供商账户下所有品牌的列表。

$response = $iys->brands()->all();

列出授权给合作伙伴的品牌

合作伙伴可以通过此方法列出它们被授权的所有品牌。

$response = $iys->brands()->allIntegratorBrands();

查询授权给合作伙伴的品牌

合作伙伴可以通过此方法列出在请求体(path 参数)中指定的 iysCode 值对应的它们有权限的品牌。

$response = $iys->brands()->oneIntegratorBrand('1111111');

IYS 路径

这是服务提供商通过 IYS 向接收者请求确认,以便将权限添加到品牌中的权限添加方法。为了通过 IYS 请求权限确认并使确认的权限能够添加到品牌中,提供了两种方法。

启动确认操作

$response = $iys->consents()->overIys([
            'recipient' => 'abc@deneme.com',
            'recipientType' => 'BIREYSEL',
            'type' => [
                "EPOSTA"
            ],
            'source' => 'IYS_EPOSTA'
        ]);

完成确认操作

$response = $iys->consents()->verificationCode([
            'requestId' => '111ad006-6210-6axx-oa7c-y672f66e2536',
            'verificationCode' => '5AW5XX'
        ]);

信息服务

列出省

列出所有省份,包括名称和代码信息。

$response = $iys->info()->cities();

查询省

返回查询省份的信息。

$response = $iys->info()->cityDetails(34);

列出县

列出所有县,包括它们所属的省份代码。

$response = $iys->info()->towns();

查询县

返回查询省份的信息。

$response = $iys->info()->townDetails(514);

代理商权限管理

即将推出...

对账管理

即将推出...