You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ You can install the library by running `pip install openpaygo` or adding `openpa
40
40
41
41
## Getting Started - OpenPAYGO Token
42
42
43
-
### Generating Tokens
43
+
### Generating Tokens (Server Side)
44
44
45
45
You can use the `generate_token()` function to generate an OpenPAYGOToken Token. The function takes the following parameters, and they should match the configuration in the hardware of the device:
46
46
@@ -95,11 +95,11 @@ device.save() # We save the new count that we set for the device
95
95
```
96
96
97
97
98
-
### Decoding Tokens
98
+
### Decoding Tokens (Device Side)
99
99
100
100
You can use the `decode_token()` function to generate an OpenPAYGOToken Token. The function takes the following parameters, and they should match the configuration in the hardware of the device:
101
101
102
-
-`token` (required): The token that was given by the user
102
+
-`token` (required): The token that was given by the user, as a string
103
103
-`secret_key` (required): The secret key of the device
104
104
-`count` (required): The token count of the last valid token. When a device is new, this is 1.
105
105
-`used_counts` (optional): An array of recently used token counts, as returned by the function itself after the last valid token was decoded. This allows for handling unordered token entry.
You can use the `MetricsHandler` object to process your OpenPAYGO Metrics request from start to finish. It accepts the following initial inputs:
164
-
-`metrics_payload` (required): The OpenPAYGO Metrics payload, in a JSON string format.
164
+
You can use the `MetricsRequestHandler` object to create a new OpenPAYGO Metrics request from start to finish. It accepts the following initial inputs:
165
+
-`serial_number` (required): The serial number of the device
166
+
-`data_format` (optional): The data format, provided as dictionnary matching the data format object specifications.
167
+
-`secret_key` (optional): The secret key provided as a string containing 32 hexadecimal characters. Required if `auth_method` is defined.
168
+
-`auth_method` (optional): One of the auth method contained in the `AuthMethod` class.
169
+
170
+
It provides the following methods:
171
+
-`set_timestamp(timestamp)`: Used to set the `timestamp` of the request.
172
+
-`set_request_count(request_count)`: Used to set the `request_count` of the request.
173
+
174
+
175
+
### Handling a Request and Generating a Response (Server Side)
176
+
177
+
You can use the `MetricsResponseHandler` object to process your OpenPAYGO Metrics request from start to finish. It accepts the following initial inputs:
178
+
-`metrics_payload` (required): The OpenPAYGO Metrics payload, as a string containing the JSON payload.
165
179
-`secret_key` (optional): The secret key provided as a string containing 32 hexadecimal characters
166
180
-`data_format` (optional): The data format, provided as dictionnary matching the data format object specifications.
0 commit comments