mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
transfer blockchain type to login server
This commit is contained in:
parent
6ca4fa7931
commit
feb66dc670
@ -35,6 +35,7 @@ class AppController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
var $loginServerUrl = '';
|
var $loginServerUrl = '';
|
||||||
|
var $blockchainType = 'mysql';
|
||||||
/**
|
/**
|
||||||
* Initialization hook method.
|
* Initialization hook method.
|
||||||
*
|
*
|
||||||
@ -136,6 +137,23 @@ class AppController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$this->loginServerUrl = Router::url('/', true);
|
$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)
|
protected function requestLogin($session_id = 0, $redirect = true)
|
||||||
|
|||||||
@ -110,7 +110,8 @@ class AppRequestsController extends AppController
|
|||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'target_group' => $group,
|
'target_group' => $group,
|
||||||
'target_email' => $email,
|
'target_email' => $email,
|
||||||
'auto_sign' => $auto_sign
|
'auto_sign' => $auto_sign,
|
||||||
|
'blockchain_type' => $this->blockchainType
|
||||||
]), '/createTransaction');
|
]), '/createTransaction');
|
||||||
|
|
||||||
if('success' == $requestAnswear['state'] && 'success' == $requestAnswear['data']['state']) {
|
if('success' == $requestAnswear['state'] && 'success' == $requestAnswear['data']['state']) {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use Cake\Core\Configure;
|
|||||||
|
|
||||||
class JsonRequestClientComponent extends Component
|
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)) {
|
if(!is_numeric($session_id)) {
|
||||||
return ['state' => 'error', 'type' => 'parameter error', 'msg' => 'session_id isn\'t numeric'];
|
return ['state' => 'error', 'type' => 'parameter error', 'msg' => 'session_id isn\'t numeric'];
|
||||||
}
|
}
|
||||||
@ -36,7 +36,8 @@ class JsonRequestClientComponent extends Component
|
|||||||
'session_id' => $session_id,
|
'session_id' => $session_id,
|
||||||
'transaction_base64' => $base64Message,
|
'transaction_base64' => $base64Message,
|
||||||
'balance' => $user_balance,
|
'balance' => $user_balance,
|
||||||
'auto_sign' => $auto_sign
|
'auto_sign' => $auto_sign,
|
||||||
|
'blockchain_type' => $this->blockchainType
|
||||||
]), '/checkTransaction');
|
]), '/checkTransaction');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -399,7 +399,8 @@ class TransactionCreationsController extends AppController
|
|||||||
'memo' => $memo,
|
'memo' => $memo,
|
||||||
'amount' => $localAmountCent,
|
'amount' => $localAmountCent,
|
||||||
'target_pubkey' => $pubKeyHex,
|
'target_pubkey' => $pubKeyHex,
|
||||||
'target_date' => $localTargetDateFrozen
|
'target_date' => $localTargetDateFrozen,
|
||||||
|
'blockchain_type' => $this->blockchainType
|
||||||
]), '/createTransaction');
|
]), '/createTransaction');
|
||||||
|
|
||||||
if('success' != $requestAnswear['state']) {
|
if('success' != $requestAnswear['state']) {
|
||||||
@ -580,7 +581,8 @@ class TransactionCreationsController extends AppController
|
|||||||
$session_id,
|
$session_id,
|
||||||
$transaction_base64,
|
$transaction_base64,
|
||||||
$user['balance'],
|
$user['balance'],
|
||||||
$auto_sign
|
$auto_sign,
|
||||||
|
$this->blockchainType
|
||||||
);
|
);
|
||||||
if ($requestResult['state'] != 'success') {
|
if ($requestResult['state'] != 'success') {
|
||||||
$msg = 'error returned from login server';
|
$msg = 'error returned from login server';
|
||||||
|
|||||||
@ -185,7 +185,8 @@ class TransactionSendCoinsController extends AppController
|
|||||||
'memo' => $requestData['memo'],
|
'memo' => $requestData['memo'],
|
||||||
'amount' => $amountCent,
|
'amount' => $amountCent,
|
||||||
'target_group' => $known_groups['data']['data']['groups'][$requestData['group']],
|
'target_group' => $known_groups['data']['data']['groups'][$requestData['group']],
|
||||||
'target_email' => $receiverEmail
|
'target_email' => $receiverEmail,
|
||||||
|
'blockchain_type' => $this->blockchainType
|
||||||
]), '/createTransaction');
|
]), '/createTransaction');
|
||||||
|
|
||||||
if('success' == $requestAnswear['state'] && 'success' == $requestAnswear['data']['state']) {
|
if('success' == $requestAnswear['state'] && 'success' == $requestAnswear['data']['state']) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user