Complete QF100 ops commands and detail UI
This commit is contained in:
@ -223,6 +223,45 @@ async function triggerDynamicMqttQr({ bundle, ts }) {
|
||||
return response;
|
||||
}
|
||||
|
||||
async function triggerDynamicQrDisplay({ bundle }) {
|
||||
const result = await reqAdmin(`/admin/devices/${bundle.device.id}/commands`, {
|
||||
method: "POST",
|
||||
body: {
|
||||
command: "dynamic_qr.display",
|
||||
payload: {
|
||||
"qr-url": "https://pay.example/qr/qf100-smoke",
|
||||
amount: 25000,
|
||||
"expire-seconds": 60
|
||||
}
|
||||
},
|
||||
_label: "POST /admin/devices/:id/commands dynamic QR display"
|
||||
});
|
||||
|
||||
assert(result.status === "delivered", "dynamic QR display command must be delivered");
|
||||
assert(result.result_payload?.topic === `soundbox/${bundle.device.serial_number}/down`, "dynamic QR display topic must use serial number");
|
||||
assert(result.result_payload?.payload?.header?.category === 4, "dynamic QR display category must be 4");
|
||||
return result;
|
||||
}
|
||||
|
||||
async function triggerRebootCommand({ bundle }) {
|
||||
const result = await reqAdmin(`/admin/devices/${bundle.device.id}/commands`, {
|
||||
method: "POST",
|
||||
body: {
|
||||
command: "device.reboot",
|
||||
payload: {
|
||||
requested_from: "qf100_smoke"
|
||||
}
|
||||
},
|
||||
_label: "POST /admin/devices/:id/commands reboot"
|
||||
});
|
||||
|
||||
assert(result.status === "delivered", "reboot command must be delivered");
|
||||
assert(result.result_payload?.topic === `soundbox/${bundle.device.serial_number}/down`, "reboot topic must use serial number");
|
||||
assert(result.result_payload?.payload?.header?.category === 5, "reboot category must be 5");
|
||||
assert(result.result_payload?.payload?.data?.command === "reboot", "reboot command payload must be reboot");
|
||||
return result;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await req("/health", { _label: "GET /health" });
|
||||
const ts = Date.now();
|
||||
@ -253,6 +292,8 @@ async function main() {
|
||||
|
||||
const staticPaymentMessage = await triggerStaticPayment({ bundle: staticBundle, ts });
|
||||
const dynamicQr = await triggerDynamicMqttQr({ bundle: dynamicBundle, ts });
|
||||
const dynamicQrDisplay = await triggerDynamicQrDisplay({ bundle: dynamicBundle });
|
||||
const rebootCommand = await triggerRebootCommand({ bundle: staticBundle });
|
||||
|
||||
console.log("\nQF100 adapter smoke passed");
|
||||
console.log(`static_sn=${STATIC_SN}`);
|
||||
@ -261,6 +302,8 @@ async function main() {
|
||||
console.log(`dynamic_sn=${DYNAMIC_SN}`);
|
||||
console.log(`dynamic_device_id=${dynamicBundle.device.id}`);
|
||||
console.log(`dynamic_transaction_id=${dynamicQr.transaction_id}`);
|
||||
console.log(`dynamic_qr_display_command=${dynamicQrDisplay.id || dynamicQrDisplay.command_id}`);
|
||||
console.log(`reboot_command=${rebootCommand.id || rebootCommand.command_id}`);
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user