|
@@ 165-191 (lines=27) @@
|
| 162 |
|
* @param array $body |
| 163 |
|
* @return object |
| 164 |
|
*/ |
| 165 |
|
public function createAppUrl(array $body) |
| 166 |
|
{ |
| 167 |
|
// keys that are mandatory for this request |
| 168 |
|
$needKeys = ['DocumentId', 'SigneeRefId', 'UserAgent']; |
| 169 |
|
|
| 170 |
|
// if the body doesn't have needed fields, throw an exception |
| 171 |
|
if (array_intersect(array_keys($body), $needKeys) !== $needKeys) { |
| 172 |
|
throw new BadMethodCallException( |
| 173 |
|
'Missing fields in input array. Need '.implode(', ', $needKeys) |
| 174 |
|
); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
// make the URL for this request |
| 178 |
|
$url = $this->transformUrl(sprintf('%s/BankIDAppUrl', self::URI)); |
| 179 |
|
|
| 180 |
|
// get the headers for this request |
| 181 |
|
$headers = $this->headers->make('PUT', $url, $body, true); |
| 182 |
|
|
| 183 |
|
// get the response |
| 184 |
|
$response = $this->client->put($url, [ |
| 185 |
|
'headers' => $headers, |
| 186 |
|
'json' => $body, |
| 187 |
|
]); |
| 188 |
|
|
| 189 |
|
// return the response |
| 190 |
|
return $response; |
| 191 |
|
} |
| 192 |
|
|
| 193 |
|
/** |
| 194 |
|
* Starts a BankID mobile sign session for the given document |
|
@@ 200-226 (lines=27) @@
|
| 197 |
|
* @param array $body |
| 198 |
|
* @return object |
| 199 |
|
*/ |
| 200 |
|
public function startMobile(array $body) |
| 201 |
|
{ |
| 202 |
|
// keys that are mandatory for this request |
| 203 |
|
$needKeys = ['DateOfBirth', 'DocumentId', 'Mobile', 'SigneeRefId']; |
| 204 |
|
|
| 205 |
|
// if the body doesn't have needed fields, throw an exception |
| 206 |
|
if (array_intersect(array_keys($body), $needKeys) !== $needKeys) { |
| 207 |
|
throw new BadMethodCallException( |
| 208 |
|
'Missing fields in input array. Need '.implode(', ', $needKeys) |
| 209 |
|
); |
| 210 |
|
} |
| 211 |
|
|
| 212 |
|
// make the URL for this request |
| 213 |
|
$url = $this->transformUrl(sprintf('%s/BankIDMobileSign', self::URI)); |
| 214 |
|
|
| 215 |
|
// get the headers for this request |
| 216 |
|
$headers = $this->headers->make('PUT', $url, $body, true); |
| 217 |
|
|
| 218 |
|
// get the response |
| 219 |
|
$response = $this->client->put($url, [ |
| 220 |
|
'headers' => $headers, |
| 221 |
|
'json' => $body, |
| 222 |
|
]); |
| 223 |
|
|
| 224 |
|
// return the response |
| 225 |
|
return $response; |
| 226 |
|
} |
| 227 |
|
} |
| 228 |
|
|