Payroll software and start moneyd on click?

Hi guys,

So we just thought we would share what we have been working on recently.

We are trying to develop a new payroll system that allows employees to be paid in a minutely basis, with a simple spsp payment, this is calculated against the hourly wage stored in the SQL DB every minute before releasing payment in xrp to the employee payment pointer, Taxman payment pointer and a pension payment pointer.

We got our proof of concept up and working and are now trying to develop it to conform with HMRC standards. Currently HMRC have put there blockchain project on hold until after the Brexit scenario, so we need to revert our system back to the old fashioned way in order to facilitate RTI FPS payments. we have a solution for sending the info in the FPS payment (XML Document) for when they start there blockchain project back up, but struggling to find away to incorporate the traditional way.

In order to make it simple for companies to set up, we have incorporated moneyd and a wallet generator into the application so to minimise software required by the employers.
We have had some success. But then these options were not going to work how we envisaged.

We tried running concurrently in the package.json script which works but either our application and moneyd xrp:start but if the was no configuration them obviously moneyd would crash.
And if we ran configure then we couldnt start with out restarting the application.

"scripts": {
"start": "concurrently \"./bin/www\" \"./bin/moneyd.js xrp:start --testnet\""

},

So we tried a few other process,

function moneydconfig(){
const { spawn } = require('child_process');
const ls = spawn('moneyd', ['xrp:configure','--testnet']);

ls.stdout.on('data', (data) => {
  console.log(`stdout: ${data}`);
});

ls.stderr.on('data', (data) => {
  console.log(`stderr: ${data}`);
});

ls.on('close', (code) => {
  console.log(`child process exited with code ${code}`);
});

}

but we have currently settled on using a shelljs, this give us the option of running start, clean up or configure at the click of a button, only once moneyd starts it blocks access to the other processes carried out by the application. Does anybody have any suggestions or a solution as to how we could overcome this?
Also when trying to exit the clean up command this exits everything and not just moneyd.

const shell = require('shelljs')
const HOME = require('os').homedir()
const path = require('path')
const configpathtestnet = path.join(HOME, '.moneyd.test.json')
const configpathlivenet = path.join(HOME, '.moneyd.json')


//show json data on canvas
	router.get('/config', function(req, res) {
		var action  = req.query.action;
		console.log(action);
		if (action == 1) {
			shell.exec('moneyd xrp:cleanup --testnet')
			res.redirect('/wallet');
		} else if (action == 2) {
			fs.unlink(configpathtestnet, function (err) {
				if (err) {
					console.log("erro to delete moneyd config file " + err);
				} else {
					// if no error, file has been deleted successfully
				console.log('File deleted!');
				shell.exec('moneyd xrp:configure --testnet --advanced')
				res.redirect('/wallet');
				}
			})
		} else if (action == 3) {
			shell.exec('moneyd xrp:start --testnet')
			res.redirect('/wallet');
		// } else if (action == 4) {
		// 	shell.exec('node ./ILPaw06/bin/www')
		// 	res.redirect('/');
		} else {
			res.redirect('/');
		}
		if (action == 4) {
			shell.exec('moneyd xrp:cleanup')
			res.redirect('/wallet');
	} else if (action == 5) {
		fs.unlink(configpathlivenet, function (err) {
			if (err) {
				console.log("erro to delete moneyd config file " + err);
			} else {
				// if no error, file has been deleted successfully
			console.log('File deleted!');
			shell.exec('moneyd xrp:configure --advanced')
			res.redirect('/wallet');
			}
		})
	} else if (action == 6) {
		shell.exec('moneyd xrp:start ')
		res.redirect('/wallet');
	// } else if (action == 4) {
	// 	shell.exec('node ./ILPaw06/bin/www')
	// 	res.redirect('/');
	} else {
		res.redirect('/');
	}
});

In views/templates the following for starting on click.

<a href="/config?action=1" class="w3-button w3-blue w3-medium w3-border w3-border-white w3-round-large w3-padding-small">Clean Up Testnet</a>
<a href="/config?action=2" class="w3-button w3-blue w3-medium w3-border w3-border-white w3-round-large w3-padding-small">Config Testnet</a>
<a href="/config?action=3" class="w3-button w3-blue w3-medium w3-border w3-border-white w3-round-large w3-padding-small">Start Testnet</a>
<a href="/config?action=4" class="w3-button w3-blue w3-medium w3-border w3-border-white w3-round-large w3-padding-small">Clean Up</a>
<a href="/config?action=5" class="w3-button w3-blue w3-medium w3-border w3-border-white w3-round-large w3-padding-small">Config</a>
<a href="/config?action=6" class="w3-button w3-blue w3-medium w3-border w3-border-white w3-round-large w3-padding-small">Start</a>

Any suggestions on how to have the payroll software process run alongside moneyd would be appreciated?

Would also appreciate any ideas on how we could send the fiat value to HMRC with out us using a traditional bank account is this something we could do with the ILP-IOU or over XRPL?

Richard