| @@ 191-213 (lines=23) @@ | ||
| 188 | * @param array $body |
|
| 189 | * @return object |
|
| 190 | */ |
|
| 191 | public function cancel(array $body) |
|
| 192 | { |
|
| 193 | // keys that are mandatory for this request |
|
| 194 | $needKeys = ['CanceledDate', 'DocumentID', 'Signature']; |
|
| 195 | ||
| 196 | // if the body doesn't have needed fields, throw an exception |
|
| 197 | $this->validateHasKeys($body, $needKeys); |
|
| 198 | ||
| 199 | // make the URL for this request |
|
| 200 | $url = sprintf('%s/CancelDocument', $this->getBaseUrl()); |
|
| 201 | ||
| 202 | // get the headers for this request |
|
| 203 | $headers = $this->headers->make('POST', $url, $body); |
|
| 204 | ||
| 205 | // get the response |
|
| 206 | $response = $this->client->post($url, [ |
|
| 207 | 'headers' => $headers, |
|
| 208 | 'json' => $body, |
|
| 209 | ]); |
|
| 210 | ||
| 211 | // return the response |
|
| 212 | return $response; |
|
| 213 | } |
|
| 214 | ||
| 215 | /** |
|
| 216 | * Creates a new document to sign, and returns |
|
| @@ 222-244 (lines=23) @@ | ||
| 219 | * @param array $body |
|
| 220 | * @return object |
|
| 221 | */ |
|
| 222 | public function changeDeadline(array $body) |
|
| 223 | { |
|
| 224 | // keys that are mandatory for this request |
|
| 225 | $needKeys = ['DocumentID', 'NewDeadline', 'ProviderID']; |
|
| 226 | ||
| 227 | // if the body doesn't have needed fields, throw an exception |
|
| 228 | $this->validateHasKeys($body, $needKeys); |
|
| 229 | ||
| 230 | // make the URL for this request |
|
| 231 | $url = sprintf('%s/ChangeDeadline', $this->getBaseUrl()); |
|
| 232 | ||
| 233 | // get the headers for this request |
|
| 234 | $headers = $this->headers->make('PUT', $url, $body); |
|
| 235 | ||
| 236 | // get the response |
|
| 237 | $response = $this->client->put($url, [ |
|
| 238 | 'headers' => $headers, |
|
| 239 | 'json' => $body, |
|
| 240 | ]); |
|
| 241 | ||
| 242 | // return the response |
|
| 243 | return $response; |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| @@ 40-62 (lines=23) @@ | ||
| 37 | * @param array $body |
|
| 38 | * @return object |
|
| 39 | */ |
|
| 40 | public function create(array $body) |
|
| 41 | { |
|
| 42 | // keys that are mandatory for this request |
|
| 43 | $needKeys = ['Contact_Email', 'Contact_Phone']; |
|
| 44 | ||
| 45 | // if the body doesn't have needed fields, throw an exception |
|
| 46 | $this->validateHasKeys($body, $needKeys); |
|
| 47 | ||
| 48 | // make the URL for this request |
|
| 49 | $url = $this->getBaseUrl(); |
|
| 50 | ||
| 51 | // get the headers for this request |
|
| 52 | $headers = $this->headers->make('POST', $url, $body); |
|
| 53 | ||
| 54 | // get the response |
|
| 55 | $response = $this->client->post($url, [ |
|
| 56 | 'headers' => $headers, |
|
| 57 | 'json' => $body, |
|
| 58 | ]); |
|
| 59 | ||
| 60 | // return the response |
|
| 61 | return $response; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 43-65 (lines=23) @@ | ||
| 40 | * @param array $body |
|
| 41 | * @return object |
|
| 42 | */ |
|
| 43 | public function createAppLaunchUri(array $body) |
|
| 44 | { |
|
| 45 | // keys that are mandatory for this request |
|
| 46 | $needKeys = ['ExternalId', 'ReturnUrl']; |
|
| 47 | ||
| 48 | // if the body doesn't have needed fields, throw an exception |
|
| 49 | $this->validateHasKeys($body, $needKeys); |
|
| 50 | ||
| 51 | // make the URL for this request |
|
| 52 | $url = sprintf('%s/AppLogin', $this->getBaseUrl()); |
|
| 53 | ||
| 54 | // get the headers for this request |
|
| 55 | $headers = $this->headers->make('POST', $url, $body); |
|
| 56 | ||
| 57 | // get the response |
|
| 58 | $response = $this->client->post($url, [ |
|
| 59 | 'headers' => $headers, |
|
| 60 | 'json' => $body, |
|
| 61 | ]); |
|
| 62 | ||
| 63 | // return the response |
|
| 64 | return $response; |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Creates a BankID mobile login response. |
|
| @@ 73-95 (lines=23) @@ | ||
| 70 | * @param array $body |
|
| 71 | * @return object |
|
| 72 | */ |
|
| 73 | public function createMobile(array $body) |
|
| 74 | { |
|
| 75 | // keys that are mandatory for this request |
|
| 76 | $needKeys = ['DateOfBirth', 'Mobile']; |
|
| 77 | ||
| 78 | // if the body doesn't have needed fields, throw an exception |
|
| 79 | $this->validateHasKeys($body, $needKeys); |
|
| 80 | ||
| 81 | // make the URL for this request |
|
| 82 | $url = sprintf('%s/BankIDMobileLogin/Create', $this->getBaseUrl()); |
|
| 83 | ||
| 84 | // get the headers for this request |
|
| 85 | $headers = $this->headers->make('POST', $url, $body); |
|
| 86 | ||
| 87 | // get the response |
|
| 88 | $response = $this->client->post($url, [ |
|
| 89 | 'headers' => $headers, |
|
| 90 | 'json' => $body, |
|
| 91 | ]); |
|
| 92 | ||
| 93 | // return the response |
|
| 94 | return $response; |
|
| 95 | } |
|
| 96 | ||
| 97 | /** |
|
| 98 | * Starts the BankID mobile session that |
|
| @@ 161-183 (lines=23) @@ | ||
| 158 | * @param array $body |
|
| 159 | * @return object |
|
| 160 | */ |
|
| 161 | public function createAppUrl(array $body) |
|
| 162 | { |
|
| 163 | // keys that are mandatory for this request |
|
| 164 | $needKeys = ['DocumentId', 'SigneeRefId', 'UserAgent']; |
|
| 165 | ||
| 166 | // if the body doesn't have needed fields, throw an exception |
|
| 167 | $this->validateHasKeys($body, $needKeys); |
|
| 168 | ||
| 169 | // make the URL for this request |
|
| 170 | $url = sprintf('%s/BankIDAppUrl', $this->getBaseUrl()); |
|
| 171 | ||
| 172 | // get the headers for this request |
|
| 173 | $headers = $this->headers->make('PUT', $url, $body, true); |
|
| 174 | ||
| 175 | // get the response |
|
| 176 | $response = $this->client->put($url, [ |
|
| 177 | 'headers' => $headers, |
|
| 178 | 'json' => $body, |
|
| 179 | ]); |
|
| 180 | ||
| 181 | // return the response |
|
| 182 | return $response; |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Starts a BankID mobile sign session for the given document |
|
| @@ 192-214 (lines=23) @@ | ||
| 189 | * @param array $body |
|
| 190 | * @return object |
|
| 191 | */ |
|
| 192 | public function startMobile(array $body) |
|
| 193 | { |
|
| 194 | // keys that are mandatory for this request |
|
| 195 | $needKeys = ['DateOfBirth', 'DocumentId', 'Mobile', 'SigneeRefId']; |
|
| 196 | ||
| 197 | // if the body doesn't have needed fields, throw an exception |
|
| 198 | $this->validateHasKeys($body, $needKeys); |
|
| 199 | ||
| 200 | // make the URL for this request |
|
| 201 | $url = sprintf('%s/BankIDMobileSign', $this->getBaseUrl()); |
|
| 202 | ||
| 203 | // get the headers for this request |
|
| 204 | $headers = $this->headers->make('PUT', $url, $body, true); |
|
| 205 | ||
| 206 | // get the response |
|
| 207 | $response = $this->client->put($url, [ |
|
| 208 | 'headers' => $headers, |
|
| 209 | 'json' => $body, |
|
| 210 | ]); |
|
| 211 | ||
| 212 | // return the response |
|
| 213 | return $response; |
|
| 214 | } |
|
| 215 | } |
|
| 216 | ||