diff --git a/community_server/src/Controller/AppController.php b/community_server/src/Controller/AppController.php index b9522c2e7..42d97d5d8 100644 --- a/community_server/src/Controller/AppController.php +++ b/community_server/src/Controller/AppController.php @@ -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) diff --git a/community_server/src/Controller/AppRequestsController.php b/community_server/src/Controller/AppRequestsController.php index f2c0dbac6..fa59887c8 100644 --- a/community_server/src/Controller/AppRequestsController.php +++ b/community_server/src/Controller/AppRequestsController.php @@ -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']) { diff --git a/community_server/src/Controller/Component/JsonRequestClientComponent.php b/community_server/src/Controller/Component/JsonRequestClientComponent.php index c73a00528..09856d7e2 100644 --- a/community_server/src/Controller/Component/JsonRequestClientComponent.php +++ b/community_server/src/Controller/Component/JsonRequestClientComponent.php @@ -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'); } diff --git a/community_server/src/Controller/TransactionCreationsController.php b/community_server/src/Controller/TransactionCreationsController.php index 77429d8d7..f439bd893 100644 --- a/community_server/src/Controller/TransactionCreationsController.php +++ b/community_server/src/Controller/TransactionCreationsController.php @@ -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'; diff --git a/community_server/src/Controller/TransactionSendCoinsController.php b/community_server/src/Controller/TransactionSendCoinsController.php index 12aa3e69a..033e2343f 100644 --- a/community_server/src/Controller/TransactionSendCoinsController.php +++ b/community_server/src/Controller/TransactionSendCoinsController.php @@ -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']) {