1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TarfinLabs\Iys; |
4
|
|
|
|
5
|
|
|
class Consent |
6
|
|
|
{ |
7
|
|
|
protected $endpoint; |
8
|
|
|
protected $config; |
9
|
|
|
|
10
|
|
|
public function __construct() |
11
|
|
|
{ |
12
|
|
|
$this->config = config('laravel-iys'); |
13
|
|
|
$this->endpoint = "/sps/{$this->config['iys_code']}/brands/{$this->config['brand_code']}/consents"; |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Alıcıdan alınmış izinleri tekil olarak İYS'ye yükler. |
18
|
|
|
* |
19
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/izin-yonetimi/tekil-izin-ekleme/ |
20
|
|
|
* |
21
|
|
|
* @param array $params |
22
|
|
|
* @return array|mixed |
23
|
|
|
*/ |
24
|
|
|
public function create(array $params) |
25
|
|
|
{ |
26
|
|
|
return app(Client::class)->postJson($this->endpoint, $params); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Alıcıdan alınmış izinleri yığın olarak İYS'ye yükler. |
31
|
|
|
* |
32
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/izin-yonetimi/asenkron-coklu-izin-ekleme/ |
33
|
|
|
* |
34
|
|
|
* @param array $params |
35
|
|
|
* @return array|mixed |
36
|
|
|
*/ |
37
|
|
|
public function createMany(array $params) |
38
|
|
|
{ |
39
|
|
|
return app(Client::class)->postJson($this->endpoint . '/request', $params); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Hizmet sağlayıcıların İYS'de kayıtlı olan izinlerini tekil olarak listelemelerini sağlar. |
44
|
|
|
* |
45
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/izin-yonetimi/tekil-izin-durumu-sorgulama/ |
46
|
|
|
* |
47
|
|
|
* @param array $params |
48
|
|
|
* @return array|mixed |
49
|
|
|
*/ |
50
|
|
|
public function status(array $params) |
51
|
|
|
{ |
52
|
|
|
return app(Client::class)->postJson($this->endpoint . '/status', $params); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Asenkron çoklu izin ekleme işlemi sonunda dönen işlem sorgulama bilgisiyle |
57
|
|
|
* izin kayıt isteklerinin sonuçlarını sorgular. |
58
|
|
|
* |
59
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/izin-yonetimi/coklu-izin-ekleme-istegi-sorgulama/ |
60
|
|
|
* |
61
|
|
|
* @param string $requestId |
62
|
|
|
* @return array|mixed |
63
|
|
|
*/ |
64
|
|
|
public function statuses(string $requestId) |
65
|
|
|
{ |
66
|
|
|
return app(Client::class)->getJson($this->endpoint . '/request/' . $requestId); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Tekil iznin mevcut bayi izin erişimlerine, yeni bayilerin izin erişimini ekler. |
71
|
|
|
* |
72
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/bayi-izin-yonetimi/bayi-izin-erisimi-ekleme/ |
73
|
|
|
* |
74
|
|
|
* @param array $params |
75
|
|
|
* @return array|mixed |
76
|
|
|
*/ |
77
|
|
|
public function giveAccess(array $params) |
78
|
|
|
{ |
79
|
|
|
return app(Client::class)->postJson($this->endpoint . '/retailers/access', $params); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Birden fazla bayiye birden fazla izin için erişim verilmesini sağlar. |
84
|
|
|
* |
85
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/bayi-izin-yonetimi/bayi-izin-erisimi-verme/ |
86
|
|
|
* |
87
|
|
|
* @param array $params |
88
|
|
|
* @return array|mixed |
89
|
|
|
*/ |
90
|
|
|
public function giveManyAccess(array $params) |
91
|
|
|
{ |
92
|
|
|
return app(Client::class)->putJson($this->endpoint . '/retailers/access', $params); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Tekil iznin hangi bayilerle ilişkili olduğunu sorgular. |
97
|
|
|
* |
98
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/bayi-izin-yonetimi/bayi-erisimi-sorgulama/ |
99
|
|
|
* |
100
|
|
|
* @param array $params |
101
|
|
|
* @param int|null $offset |
102
|
|
|
* @param int|null $limit |
103
|
|
|
* @return array|mixed |
104
|
|
|
*/ |
105
|
|
|
public function accessList(array $params, int $offset = null, int $limit = null) |
106
|
|
|
{ |
107
|
|
|
$query = ''; |
108
|
|
|
|
109
|
|
|
if ($offset && $limit) { |
|
|
|
|
110
|
|
|
$query = '?' . http_build_query([ |
111
|
|
|
'offset' => $offset, |
112
|
|
|
'limit' => $limit, |
113
|
|
|
]); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
return app(Client::class)->postJson($this->endpoint . '/retailers/access/list' . $query, $params); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Birden fazla bayinin birden fazla izin için erişimini siler. |
121
|
|
|
* |
122
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/bayi-izin-yonetimi/coklu-bayi-erisimi-silme/ |
123
|
|
|
* |
124
|
|
|
* @param array $params |
125
|
|
|
* @return array|mixed |
126
|
|
|
*/ |
127
|
|
|
public function deleteAccess(array $params) |
128
|
|
|
{ |
129
|
|
|
return app(Client::class)->postJson($this->endpoint . '/retailer/access/remove', $params); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Tüm bayilerin birden fazla izin için erişimini siler. |
134
|
|
|
* |
135
|
|
|
* Doc: https://dev.iys.org.tr/api-metotlar/bayi-izin-yonetimi/tum-bayilerin-izin-erisimlerini-silme/ |
136
|
|
|
* |
137
|
|
|
* @param array $params |
138
|
|
|
* @return array|mixed |
139
|
|
|
*/ |
140
|
|
|
public function deleteAllAccess(array $params) |
141
|
|
|
{ |
142
|
|
|
return app(Client::class)->postJson($this->endpoint . '/retailer/access/remove/all', $params); |
143
|
|
|
} |
144
|
|
|
} |
145
|
|
|
|
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: