transfer blockchain type to login server

This commit is contained in:
Dario Rekowski on RockPI 2021-04-06 11:09:16 +00:00
parent 6ca4fa7931
commit feb66dc670
5 changed files with 29 additions and 6 deletions

View File

@ -35,6 +35,7 @@ class AppController extends Controller
{
var $loginServerUrl = '';
var $blockchainType = 'mysql';
/**
* Initialization hook method.
*
@ -136,6 +137,23 @@ class AppController extends Controller
} else {
$this->loginServerUrl = Router::url('/', true);
}
/*
*
* 'GradidoBlockchain' => [
* // type:
* // - mysql: centralized blockchain in mysql db, no cross group transactions
* // - hedera: send transaction over hedera
* 'type' => 'hedera',
* // gradido nodes with blockchain (if type != mysql)
* 'nodes' => [
* ['host' => 'http://192.168.178.225', 'port' => 13702]
* ]
* ],
*/
$blockchain = Configure::read('GradidoBlockchain');
if($blockchain && isset($blockchain['type'])) {
$this->blockchainType = $blockchain['type'];
}
}
protected function requestLogin($session_id = 0, $redirect = true)

View File

@ -110,7 +110,8 @@ class AppRequestsController extends AppController
'amount' => $amount,
'target_group' => $group,
'target_email' => $email,
'auto_sign' => $auto_sign
'auto_sign' => $auto_sign,
'blockchain_type' => $this->blockchainType
]), '/createTransaction');
if('success' == $requestAnswear['state'] && 'success' == $requestAnswear['data']['state']) {

View File

@ -15,7 +15,7 @@ use Cake\Core\Configure;
class JsonRequestClientComponent extends Component
{
public function sendTransaction($session_id, $base64Message, $user_balance = 0, $auto_sign = false) {
public function sendTransaction($session_id, $base64Message, $user_balance = 0, $auto_sign = false, $blockchain_type = 'mysql') {
if(!is_numeric($session_id)) {
return ['state' => 'error', 'type' => 'parameter error', 'msg' => 'session_id isn\'t numeric'];
}
@ -36,7 +36,8 @@ class JsonRequestClientComponent extends Component
'session_id' => $session_id,
'transaction_base64' => $base64Message,
'balance' => $user_balance,
'auto_sign' => $auto_sign
'auto_sign' => $auto_sign,
'blockchain_type' => $this->blockchainType
]), '/checkTransaction');
}

View File

@ -399,7 +399,8 @@ class TransactionCreationsController extends AppController
'memo' => $memo,
'amount' => $localAmountCent,
'target_pubkey' => $pubKeyHex,
'target_date' => $localTargetDateFrozen
'target_date' => $localTargetDateFrozen,
'blockchain_type' => $this->blockchainType
]), '/createTransaction');
if('success' != $requestAnswear['state']) {
@ -580,7 +581,8 @@ class TransactionCreationsController extends AppController
$session_id,
$transaction_base64,
$user['balance'],
$auto_sign
$auto_sign,
$this->blockchainType
);
if ($requestResult['state'] != 'success') {
$msg = 'error returned from login server';

View File

@ -185,7 +185,8 @@ class TransactionSendCoinsController extends AppController
'memo' => $requestData['memo'],
'amount' => $amountCent,
'target_group' => $known_groups['data']['data']['groups'][$requestData['group']],
'target_email' => $receiverEmail
'target_email' => $receiverEmail,
'blockchain_type' => $this->blockchainType
]), '/createTransaction');
if('success' == $requestAnswear['state'] && 'success' == $requestAnswear['data']['state']) {