@@ 44-66 (lines=23) @@ | ||
41 | * @return ApplicationEntity |
|
42 | * @throws SdkException |
|
43 | */ |
|
44 | public function initialiseApplication(ApplicationEntity $application, $token) |
|
45 | { |
|
46 | $api = $this->getApiFactory()->makeApiClient($token); |
|
47 | ||
48 | try { |
|
49 | $response = $api->post('/v4/initialize-application', $application->toArray(true)); |
|
50 | ||
51 | $application->setId($response['application']); |
|
52 | $application->setResumeUrl($response['url']); |
|
53 | ||
54 | return $application; |
|
55 | ||
56 | } catch (ErrorResponseException $e) { |
|
57 | ||
58 | $this->logWarning('ApplicationGateway::initialiseApplication[' . $e->getCode() . ']: ' . $e->getMessage()); |
|
59 | throw new SdkException($e->getMessage()); |
|
60 | ||
61 | } catch (\Exception $e) { |
|
62 | ||
63 | $this->logError('ApplicationGateway::initialiseApplication[' . $e->getCode() . ']: ' . $e->getMessage()); |
|
64 | throw new SdkException('Problem Initialising Application on Provider API'); |
|
65 | } |
|
66 | } |
|
67 | ||
68 | /** |
|
69 | * @author EA, EB |
|
@@ 75-98 (lines=24) @@ | ||
72 | * @return ApplicationEntity |
|
73 | * @throws SdkException |
|
74 | */ |
|
75 | public function initialiseAssistedApplication(ApplicationEntity $application, $token) |
|
76 | { |
|
77 | $api = $this->getApiFactory()->makeApiClient($token); |
|
78 | ||
79 | try { |
|
80 | $response = $api->post('/v4/initialize-assisted-application', $application->toArray(true)); |
|
81 | ||
82 | $application->setId($response['application']); |
|
83 | $application->setResumeUrl($response['url']); |
|
84 | $application->setUser($response['user']); |
|
85 | ||
86 | return $application; |
|
87 | ||
88 | } catch (ErrorResponseException $e) { |
|
89 | ||
90 | $this->logWarning('ApplicationGateway::initialiseAssistedApplication[' . $e->getCode() . ']: ' . $e->getMessage()); |
|
91 | throw new SdkException($e->getMessage()); |
|
92 | ||
93 | } catch (\Exception $e) { |
|
94 | ||
95 | $this->logError('ApplicationGateway::initialiseAssistedApplication[' . $e->getCode() . ']: ' . $e->getMessage()); |
|
96 | throw new SdkException('Problem Initialising Assisted Application on Provider API'); |
|
97 | } |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * @author WN |