|
@@ 191-217 (lines=27) @@
|
| 188 |
|
* @param array $body |
| 189 |
|
* @return object |
| 190 |
|
*/ |
| 191 |
|
public function createAppUrl(array $body) |
| 192 |
|
{ |
| 193 |
|
// keys that are mandatory for this request |
| 194 |
|
$needKeys = ['DocumentId', 'SigneeRefId', 'UserAgent']; |
| 195 |
|
|
| 196 |
|
// if the body doesn't have needed fields, throw an exception |
| 197 |
|
if (array_intersect(array_keys($body), $needKeys) !== $needKeys) { |
| 198 |
|
throw new BadMethodCallException( |
| 199 |
|
'Missing fields in input array. Need '.implode(', ', $needKeys) |
| 200 |
|
); |
| 201 |
|
} |
| 202 |
|
|
| 203 |
|
// make the URL for this request |
| 204 |
|
$url = $this->transformUrl(sprintf('%s/BankIDAppUrl', self::URI)); |
| 205 |
|
|
| 206 |
|
// get the headers for this request |
| 207 |
|
$headers = $this->headers->make('PUT', $url, $body, true); |
| 208 |
|
|
| 209 |
|
// get the response |
| 210 |
|
$response = $this->client->put($url, [ |
| 211 |
|
'headers' => $headers, |
| 212 |
|
'json' => $body, |
| 213 |
|
]); |
| 214 |
|
|
| 215 |
|
// return the response |
| 216 |
|
return $response; |
| 217 |
|
} |
| 218 |
|
|
| 219 |
|
/** |
| 220 |
|
* Starts a BankID mobile sign session for the given document |
|
@@ 226-252 (lines=27) @@
|
| 223 |
|
* @param array $body |
| 224 |
|
* @return object |
| 225 |
|
*/ |
| 226 |
|
public function startMobile(array $body) |
| 227 |
|
{ |
| 228 |
|
// keys that are mandatory for this request |
| 229 |
|
$needKeys = ['DateOfBirth', 'DocumentId', 'Mobile', 'SigneeRefId']; |
| 230 |
|
|
| 231 |
|
// if the body doesn't have needed fields, throw an exception |
| 232 |
|
if (array_intersect(array_keys($body), $needKeys) !== $needKeys) { |
| 233 |
|
throw new BadMethodCallException( |
| 234 |
|
'Missing fields in input array. Need '.implode(', ', $needKeys) |
| 235 |
|
); |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
// make the URL for this request |
| 239 |
|
$url = $this->transformUrl(sprintf('%s/BankIDMobileSign', self::URI)); |
| 240 |
|
|
| 241 |
|
// get the headers for this request |
| 242 |
|
$headers = $this->headers->make('PUT', $url, $body, true); |
| 243 |
|
|
| 244 |
|
// get the response |
| 245 |
|
$response = $this->client->put($url, [ |
| 246 |
|
'headers' => $headers, |
| 247 |
|
'json' => $body, |
| 248 |
|
]); |
| 249 |
|
|
| 250 |
|
// return the response |
| 251 |
|
return $response; |
| 252 |
|
} |
| 253 |
|
} |
| 254 |
|
|