Skip to content

Commit

Permalink
Update payloadFactory.js
Browse files Browse the repository at this point in the history
Consistent Formatting: Used destructuring and spread operator for a more concise and consistent format, especially in the fordCreatePayload function.
Parameter Names: Used shorthand for object property assignment where applicable (keys, hms_id).
Semantic Improvements: Ensured all functions are following a consistent pattern and naming conventions.
  • Loading branch information
jfarmer08 committed Aug 19, 2024
1 parent 8b82962 commit 9141887
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/payloadFactory.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
let constants = require("./constants");
let crypto = require("./crypto");
const constants = require("./constants");
const crypto = require("./crypto");

function fordCreatePayload(access_token, payload, url_path, request_method) {
payload["accessToken"] = access_token;
payload["key"] = constants.fordAppKey;
payload["timestamp"] = Date.now().toString();
payload["sign"] = crypto.fordCreateSignature(
url_path,
request_method,
payload
);
return payload;
return {
...payload,
accessToken: access_token,
key: constants.fordAppKey,
timestamp: Date.now().toString(),
sign: crypto.fordCreateSignature(url_path, request_method, payload),
};
}

function oliveCreateGetPayload(device_mac, keys) {
return {
keys: keys,
keys,
did: device_mac,
nonce: Date.now().toString(),
};
Expand Down Expand Up @@ -48,13 +46,14 @@ function oliveCreateUserInfoPayload() {

function oliveCreateHmsGetPayload(hms_id) {
return {
hms_id: hms_id,
hms_id,
nonce: Date.now().toString(),
};
}

function oliveCreateHmsPatchPayload(hms_id) {
return {
hms_id: hms_id,
hms_id,
};
}

Expand Down

0 comments on commit 9141887

Please sign in to comment.