|
8 | 8 | using Bunq.Sdk.Model.Generated; |
9 | 9 | using Bunq.Sdk.Security; |
10 | 10 | using Newtonsoft.Json; |
11 | | -using DeviceServer = Bunq.Sdk.Model.DeviceServer; |
12 | 11 |
|
13 | 12 | namespace Bunq.Sdk.Context |
14 | 13 | { |
@@ -112,21 +111,31 @@ private void InitializeInstallationContext() |
112 | 111 | { |
113 | 112 | var keyPairClient = SecurityUtils.GenerateKeyPair(); |
114 | 113 | var publicKeyFormattedString = SecurityUtils.GetPublicKeyFormattedString(keyPairClient); |
115 | | - var installation = Installation.Create(this, publicKeyFormattedString); |
116 | | - InstallationContext = new InstallationContext(installation, keyPairClient); |
| 114 | + var installationResponse = Installation.Create(this, publicKeyFormattedString); |
| 115 | + InstallationContext = new InstallationContext(installationResponse.Value, keyPairClient); |
117 | 116 | } |
118 | 117 |
|
119 | 118 | private void RegisterDevice(string deviceDescription, IList<string> permittedIps) |
120 | 119 | { |
121 | | - DeviceServer.Create(this, deviceDescription, permittedIps); |
| 120 | + DeviceServer.Create(this, GenerateRequestBodyBytes(deviceDescription, permittedIps)); |
| 121 | + } |
| 122 | + |
| 123 | + private IDictionary<string, object> GenerateRequestBodyBytes(string description, IList<string> permittedIps) |
| 124 | + { |
| 125 | + return new Dictionary<string, object> |
| 126 | + { |
| 127 | + {DeviceServer.FIELD_DESCRIPTION, description}, |
| 128 | + {DeviceServer.FIELD_SECRET, ApiKey}, |
| 129 | + {DeviceServer.FIELD_PERMITTED_IPS, permittedIps} |
| 130 | + }; |
122 | 131 | } |
123 | 132 |
|
124 | 133 | /// <summary> |
125 | 134 | /// Create a new session and its data in a SessionContext. |
126 | 135 | /// </summary> |
127 | 136 | private void InitializeSessionContext() |
128 | 137 | { |
129 | | - SessionContext = new SessionContext(SessionServer.Create(this)); |
| 138 | + SessionContext = new SessionContext(SessionServer.Create(this).Value); |
130 | 139 | } |
131 | 140 |
|
132 | 141 | /// <summary> |
|
0 commit comments