diff --git a/community_server/src/Controller/JsonRequestHandlerController.php b/community_server/src/Controller/JsonRequestHandlerController.php
index 12e03be8d..4013ace9f 100644
--- a/community_server/src/Controller/JsonRequestHandlerController.php
+++ b/community_server/src/Controller/JsonRequestHandlerController.php
@@ -340,12 +340,13 @@ class JsonRequestHandlerController extends AppController {
return;
}
$transaction_body = $transaction->getTransactionBody();
- $transaction_type_name = $transaction_body->getTransactionTypeName();
- $senderUser = null;
- if($transaction_type_name === 'transfer') {
- $senderUser = $transaction_body->getSpecificTransaction()->getSenderUser();
- } else if($transaction_type_name === 'creation') {
- $senderUser = $transaction->getFirstSigningUser();
+ $senderUser = $transaction->getFirstSigningUser();
+ if($transaction_body != null) {
+ $transaction_type_name = $transaction_body->getTransactionTypeName();
+
+ if($transaction_type_name === 'transfer') {
+ $senderUser = $transaction_body->getSpecificTransaction()->getSenderUser();
+ }
}
// send notification email
$noReplyEmail = Configure::read('noReplyEmail');
@@ -373,6 +374,15 @@ class JsonRequestHandlerController extends AppController {
private function putTransaction($transactionBase64) {
$transaction = new Transaction($transactionBase64);
+ //echo "new transaction\n$transactionBase64\n";
+ /*try {
+ $transactionBin = sodium_base642bin($transactionBase64, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING);
+ $transaction = new Transaction($transactionBin);
+ } catch(\SodiumException $e) {
+ //echo 'exception: '. $e->getMessage();
+ return $this->returnJson(['state' => 'error', 'msg' => 'error decoding base 64', 'details' => $e->getMessage(), 'base64' => $transactionBase64]);
+ }*/
+
//echo "after new transaction
";
if($transaction->hasErrors()) {
$this->sendEMailTransactionFailed($transaction, 'parse');
diff --git a/community_server/src/Controller/TransactionsController.php b/community_server/src/Controller/TransactionsController.php
index 90e78b7fb..67526dfcc 100644
--- a/community_server/src/Controller/TransactionsController.php
+++ b/community_server/src/Controller/TransactionsController.php
@@ -7,6 +7,7 @@ use Model\Transactions\Transaction;
use Model\Transactions\TransactionBody;
use Cake\Core\Configure;
+use Cake\I18n\Time;
use Cake\ORM\TableRegistry;
/**
@@ -24,7 +25,7 @@ class TransactionsController extends AppController
parent::initialize();
$this->loadComponent('GradidoNumber');
$this->loadComponent('JsonRpcRequestClient');
- $this->Auth->allow(['decode']);
+ $this->Auth->allow(['decode', 'manualTransaction']);
}
/**
@@ -170,6 +171,78 @@ class TransactionsController extends AppController
$this->set('transaction', $transaction);
}
+ public function manualTransaction()
+ {
+ if ($this->request->is('post')) {
+ $data = $this->request->getData();
+ $type = $data['type'];
+
+ $transaction = new \Proto\Gradido\GradidoTransaction();
+ $transactionBody = new \Proto\Gradido\TransactionBody();
+ $transactionBody->setMemo($data['memo']);
+ $created = new \Proto\Gradido\TimestampSeconds();
+ $now = new Time();
+ $created->setSeconds($now->getTimestamp());
+ $transactionBody->setCreated($created);
+ if($type == "creation") {
+ $creation = new \Proto\Gradido\GradidoCreation();
+ $target_date = new \Proto\Gradido\TimestampSeconds();
+ $target_time = new Time($data['target_date']);
+ $target_date->setSeconds($target_time->getTimestamp());
+ $creation->setTargetDate($target_date);
+ $receiver = new \Proto\Gradido\TransferAmount();
+ $receiver->setAmount(intval($data['amount']));
+ $receiver->setPubkey(hex2bin($data['target_public_key']));
+ $creation->setReceiver($receiver);
+ $transactionBody->setCreation($creation);
+ } else if($type == "transfer") {
+ $transfer = new \Proto\Gradido\GradidoTransfer();
+ $local_transfer = new \Proto\Gradido\LocalTransfer();
+ $sender = new \Proto\Gradido\TransferAmount();
+ $sender->setAmount(intval($data['amount']));
+ $sender->setPubkey(hex2bin($data['sender_public_key']));
+ $local_transfer->setSender($sender);
+ $local_transfer->setReceiver(hex2bin($data['receiver_public_key']));
+ $transfer->setLocal($local_transfer);
+ $transactionBody->setTransfer($transfer);
+ }
+ $body_bytes = $transactionBody->serializeToString();
+ $transaction->setBodyBytes($body_bytes);
+
+ $protoSigMap = new \Proto\Gradido\SignatureMap();
+ $sigPairs = $protoSigMap->getSigPair();
+ //echo "sigPairs: "; var_dump($sigPairs); echo "
";
+ //return null;
+
+ // sign with keys
+ //foreach($keys as $key) {
+ $sigPair = new \Proto\Gradido\SignaturePair();
+ $sigPair->setPubKey(hex2bin($data['signer_public_key']));
+
+ $signature = sodium_crypto_sign_detached($body_bytes, hex2bin($data['signer_private_key']));
+ echo "signature: " . bin2hex($signature). "
";
+ $sigPair->setEd25519($signature);
+
+ $sigPairs[] = $sigPair;
+ // SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING
+ // SODIUM_BASE64_VARIANT_ORIGINAL
+ $transaction->setSigMap($protoSigMap);
+ //var_dump($protoSigMap);
+ $transaction_bin = $transaction->serializeToString();
+// $url_safe = sodium_bin2base64($transaction_bin, sodium_base64_VARIANT_ORIGINAL);
+ $base64 = [
+ //'original' => sodium_bin2base64($transaction_bin, sodium_base64_VARIANT_ORIGINAL),
+ //'original_nopadding' => sodium_bin2base64($transaction_bin, sodium_base64_VARIANT_ORIGINAL_NO_PADDING),
+ //'urlsafe' => sodium_bin2base64($transaction_bin, sodium_base64_VARIANT_URLSAFE),
+ 'urlsafe_nopadding' => sodium_bin2base64($transaction_bin, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING),
+ 'php' => base64_encode($transaction_bin)
+
+ ];
+
+ $this->set('base64', $base64);
+ }
+ }
+
public function decode()
{
$this->viewBuilder()->setLayout('frontend');
diff --git a/community_server/src/Model/Messages/Gradido/Key.php b/community_server/src/Model/Messages/Gradido/Key.php
deleted file mode 100644
index b6190304c..000000000
--- a/community_server/src/Model/Messages/Gradido/Key.php
+++ /dev/null
@@ -1,96 +0,0 @@
-model.messages.gradido.Key
- */
-class Key extends \Google\Protobuf\Internal\Message
-{
- protected $key;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $ed25519
- * ed25519 signature (libsodium default)
- * @type string $ed25519_ref10
- * ed25519 ref10 signature
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\BasicTypes::initOnce();
- parent::__construct($data);
- }
-
- /**
- * ed25519 signature (libsodium default)
- *
- * Generated from protobuf field bytes ed25519 = 2;
- * @return string
- */
- public function getEd25519()
- {
- return $this->readOneof(2);
- }
-
- /**
- * ed25519 signature (libsodium default)
- *
- * Generated from protobuf field bytes ed25519 = 2;
- * @param string $var
- * @return $this
- */
- public function setEd25519($var)
- {
- GPBUtil::checkString($var, False);
- $this->writeOneof(2, $var);
-
- return $this;
- }
-
- /**
- * ed25519 ref10 signature
- *
- * Generated from protobuf field bytes ed25519_ref10 = 3;
- * @return string
- */
- public function getEd25519Ref10()
- {
- return $this->readOneof(3);
- }
-
- /**
- * ed25519 ref10 signature
- *
- * Generated from protobuf field bytes ed25519_ref10 = 3;
- * @param string $var
- * @return $this
- */
- public function setEd25519Ref10($var)
- {
- GPBUtil::checkString($var, False);
- $this->writeOneof(3, $var);
-
- return $this;
- }
-
- /**
- * @return string
- */
- public function getKey()
- {
- return $this->whichOneof("key");
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/ReceiverAmount.php b/community_server/src/Model/Messages/Gradido/ReceiverAmount.php
deleted file mode 100644
index 240c5a6fe..000000000
--- a/community_server/src/Model/Messages/Gradido/ReceiverAmount.php
+++ /dev/null
@@ -1,85 +0,0 @@
-model.messages.gradido.ReceiverAmount
- */
-class ReceiverAmount extends \Google\Protobuf\Internal\Message
-{
- /**
- * Generated from protobuf field bytes ed25519_receiver_pubkey = 1;
- */
- private $ed25519_receiver_pubkey = '';
- /**
- * Generated from protobuf field sint64 amount = 2;
- */
- private $amount = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $ed25519_receiver_pubkey
- * @type int|string $amount
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\BasicTypes::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Generated from protobuf field bytes ed25519_receiver_pubkey = 1;
- * @return string
- */
- public function getEd25519ReceiverPubkey()
- {
- return $this->ed25519_receiver_pubkey;
- }
-
- /**
- * Generated from protobuf field bytes ed25519_receiver_pubkey = 1;
- * @param string $var
- * @return $this
- */
- public function setEd25519ReceiverPubkey($var)
- {
- GPBUtil::checkString($var, False);
- $this->ed25519_receiver_pubkey = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field sint64 amount = 2;
- * @return int|string
- */
- public function getAmount()
- {
- return $this->amount;
- }
-
- /**
- * Generated from protobuf field sint64 amount = 2;
- * @param int|string $var
- * @return $this
- */
- public function setAmount($var)
- {
- GPBUtil::checkInt64($var);
- $this->amount = $var;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/SenderAmount.php b/community_server/src/Model/Messages/Gradido/SenderAmount.php
deleted file mode 100644
index 52a41f71f..000000000
--- a/community_server/src/Model/Messages/Gradido/SenderAmount.php
+++ /dev/null
@@ -1,119 +0,0 @@
-model.messages.gradido.SenderAmount
- */
-class SenderAmount extends \Google\Protobuf\Internal\Message
-{
- /**
- * Generated from protobuf field bytes ed25519_sender_pubkey = 1;
- */
- private $ed25519_sender_pubkey = '';
- /**
- * Generated from protobuf field sint64 amount = 2;
- */
- private $amount = 0;
- /**
- * sender balance after transaction, including perishability
- *
- * Generated from protobuf field sint64 senderFinalBalance = 3;
- */
- private $senderFinalBalance = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $ed25519_sender_pubkey
- * @type int|string $amount
- * @type int|string $senderFinalBalance
- * sender balance after transaction, including perishability
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\BasicTypes::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Generated from protobuf field bytes ed25519_sender_pubkey = 1;
- * @return string
- */
- public function getEd25519SenderPubkey()
- {
- return $this->ed25519_sender_pubkey;
- }
-
- /**
- * Generated from protobuf field bytes ed25519_sender_pubkey = 1;
- * @param string $var
- * @return $this
- */
- public function setEd25519SenderPubkey($var)
- {
- GPBUtil::checkString($var, False);
- $this->ed25519_sender_pubkey = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field sint64 amount = 2;
- * @return int|string
- */
- public function getAmount()
- {
- return $this->amount;
- }
-
- /**
- * Generated from protobuf field sint64 amount = 2;
- * @param int|string $var
- * @return $this
- */
- public function setAmount($var)
- {
- GPBUtil::checkInt64($var);
- $this->amount = $var;
-
- return $this;
- }
-
- /**
- * sender balance after transaction, including perishability
- *
- * Generated from protobuf field sint64 senderFinalBalance = 3;
- * @return int|string
- */
- public function getSenderFinalBalance()
- {
- return $this->senderFinalBalance;
- }
-
- /**
- * sender balance after transaction, including perishability
- *
- * Generated from protobuf field sint64 senderFinalBalance = 3;
- * @param int|string $var
- * @return $this
- */
- public function setSenderFinalBalance($var)
- {
- GPBUtil::checkInt64($var);
- $this->senderFinalBalance = $var;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/SignatureMap.php b/community_server/src/Model/Messages/Gradido/SignatureMap.php
deleted file mode 100644
index 228282747..000000000
--- a/community_server/src/Model/Messages/Gradido/SignatureMap.php
+++ /dev/null
@@ -1,65 +0,0 @@
-model.messages.gradido.SignatureMap
- */
-class SignatureMap extends \Google\Protobuf\Internal\Message
-{
- /**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
- *
- * Generated from protobuf field repeated .model.messages.gradido.SignaturePair sigPair = 1;
- */
- private $sigPair;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Model\Messages\Gradido\SignaturePair[]|\Google\Protobuf\Internal\RepeatedField $sigPair
- * Each signature pair corresponds to a unique Key required to sign the transaction.
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\BasicTypes::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
- *
- * Generated from protobuf field repeated .model.messages.gradido.SignaturePair sigPair = 1;
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getSigPair()
- {
- return $this->sigPair;
- }
-
- /**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
- *
- * Generated from protobuf field repeated .model.messages.gradido.SignaturePair sigPair = 1;
- * @param \Model\Messages\Gradido\SignaturePair[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setSigPair($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Model\Messages\Gradido\SignaturePair::class);
- $this->sigPair = $arr;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/SignaturePair.php b/community_server/src/Model/Messages/Gradido/SignaturePair.php
deleted file mode 100644
index 203eb5677..000000000
--- a/community_server/src/Model/Messages/Gradido/SignaturePair.php
+++ /dev/null
@@ -1,123 +0,0 @@
-model.messages.gradido.SignaturePair
- */
-class SignaturePair extends \Google\Protobuf\Internal\Message
-{
- /**
- * Generated from protobuf field bytes pubKey = 1;
- */
- private $pubKey = '';
- protected $signature;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $pubKey
- * @type string $ed25519
- * ed25519 signature (libsodium default)
- * @type string $ed25519_ref10
- * ed25519 ref10 signature
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\BasicTypes::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Generated from protobuf field bytes pubKey = 1;
- * @return string
- */
- public function getPubKey()
- {
- return $this->pubKey;
- }
-
- /**
- * Generated from protobuf field bytes pubKey = 1;
- * @param string $var
- * @return $this
- */
- public function setPubKey($var)
- {
- GPBUtil::checkString($var, False);
- $this->pubKey = $var;
-
- return $this;
- }
-
- /**
- * ed25519 signature (libsodium default)
- *
- * Generated from protobuf field bytes ed25519 = 2;
- * @return string
- */
- public function getEd25519()
- {
- return $this->readOneof(2);
- }
-
- /**
- * ed25519 signature (libsodium default)
- *
- * Generated from protobuf field bytes ed25519 = 2;
- * @param string $var
- * @return $this
- */
- public function setEd25519($var)
- {
- GPBUtil::checkString($var, False);
- $this->writeOneof(2, $var);
-
- return $this;
- }
-
- /**
- * ed25519 ref10 signature
- *
- * Generated from protobuf field bytes ed25519_ref10 = 3;
- * @return string
- */
- public function getEd25519Ref10()
- {
- return $this->readOneof(3);
- }
-
- /**
- * ed25519 ref10 signature
- *
- * Generated from protobuf field bytes ed25519_ref10 = 3;
- * @param string $var
- * @return $this
- */
- public function setEd25519Ref10($var)
- {
- GPBUtil::checkString($var, False);
- $this->writeOneof(3, $var);
-
- return $this;
- }
-
- /**
- * @return string
- */
- public function getSignature()
- {
- return $this->whichOneof("signature");
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/StateCreateGroup.php b/community_server/src/Model/Messages/Gradido/StateCreateGroup.php
deleted file mode 100644
index 4273ef93d..000000000
--- a/community_server/src/Model/Messages/Gradido/StateCreateGroup.php
+++ /dev/null
@@ -1,114 +0,0 @@
-model.messages.gradido.StateCreateGroup
- */
-class StateCreateGroup extends \Google\Protobuf\Internal\Message
-{
- /**
- * Generated from protobuf field string name = 1;
- */
- private $name = '';
- /**
- * Generated from protobuf field .model.messages.gradido.Key groupPublicKey = 2;
- */
- private $groupPublicKey = null;
- /**
- * Generated from protobuf field .model.messages.gradido.Key parentGroupPublicKey = 3;
- */
- private $parentGroupPublicKey = null;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $name
- * @type \Model\Messages\Gradido\Key $groupPublicKey
- * @type \Model\Messages\Gradido\Key $parentGroupPublicKey
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\StateCreateGroup::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Generated from protobuf field string name = 1;
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * Generated from protobuf field string name = 1;
- * @param string $var
- * @return $this
- */
- public function setName($var)
- {
- GPBUtil::checkString($var, True);
- $this->name = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key groupPublicKey = 2;
- * @return \Model\Messages\Gradido\Key
- */
- public function getGroupPublicKey()
- {
- return $this->groupPublicKey;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key groupPublicKey = 2;
- * @param \Model\Messages\Gradido\Key $var
- * @return $this
- */
- public function setGroupPublicKey($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\Key::class);
- $this->groupPublicKey = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key parentGroupPublicKey = 3;
- * @return \Model\Messages\Gradido\Key
- */
- public function getParentGroupPublicKey()
- {
- return $this->parentGroupPublicKey;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key parentGroupPublicKey = 3;
- * @param \Model\Messages\Gradido\Key $var
- * @return $this
- */
- public function setParentGroupPublicKey($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\Key::class);
- $this->parentGroupPublicKey = $var;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/StateGroupChangeParent.php b/community_server/src/Model/Messages/Gradido/StateGroupChangeParent.php
deleted file mode 100644
index c5371d76c..000000000
--- a/community_server/src/Model/Messages/Gradido/StateGroupChangeParent.php
+++ /dev/null
@@ -1,114 +0,0 @@
-model.messages.gradido.StateGroupChangeParent
- */
-class StateGroupChangeParent extends \Google\Protobuf\Internal\Message
-{
- /**
- * Generated from protobuf field .model.messages.gradido.Key groupPublicKey = 1;
- */
- private $groupPublicKey = null;
- /**
- * Generated from protobuf field .model.messages.gradido.Key newParentGroupPublicKey = 2;
- */
- private $newParentGroupPublicKey = null;
- /**
- * Generated from protobuf field .model.messages.gradido.Key oldParentGroupPublicKey = 3;
- */
- private $oldParentGroupPublicKey = null;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Model\Messages\Gradido\Key $groupPublicKey
- * @type \Model\Messages\Gradido\Key $newParentGroupPublicKey
- * @type \Model\Messages\Gradido\Key $oldParentGroupPublicKey
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\StateGroupChangeParent::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key groupPublicKey = 1;
- * @return \Model\Messages\Gradido\Key
- */
- public function getGroupPublicKey()
- {
- return $this->groupPublicKey;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key groupPublicKey = 1;
- * @param \Model\Messages\Gradido\Key $var
- * @return $this
- */
- public function setGroupPublicKey($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\Key::class);
- $this->groupPublicKey = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key newParentGroupPublicKey = 2;
- * @return \Model\Messages\Gradido\Key
- */
- public function getNewParentGroupPublicKey()
- {
- return $this->newParentGroupPublicKey;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key newParentGroupPublicKey = 2;
- * @param \Model\Messages\Gradido\Key $var
- * @return $this
- */
- public function setNewParentGroupPublicKey($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\Key::class);
- $this->newParentGroupPublicKey = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key oldParentGroupPublicKey = 3;
- * @return \Model\Messages\Gradido\Key
- */
- public function getOldParentGroupPublicKey()
- {
- return $this->oldParentGroupPublicKey;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Key oldParentGroupPublicKey = 3;
- * @param \Model\Messages\Gradido\Key $var
- * @return $this
- */
- public function setOldParentGroupPublicKey($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\Key::class);
- $this->oldParentGroupPublicKey = $var;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/Timestamp.php b/community_server/src/Model/Messages/Gradido/Timestamp.php
deleted file mode 100644
index 19721729b..000000000
--- a/community_server/src/Model/Messages/Gradido/Timestamp.php
+++ /dev/null
@@ -1,101 +0,0 @@
-model.messages.gradido.Timestamp
- */
-class Timestamp extends \Google\Protobuf\Internal\Message
-{
- /**
- * Number of complete seconds since the start of the epoch
- *
- * Generated from protobuf field int64 seconds = 1;
- */
- private $seconds = 0;
- /**
- * Number of nanoseconds since the start of the last second
- *
- * Generated from protobuf field int32 nanos = 2;
- */
- private $nanos = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int|string $seconds
- * Number of complete seconds since the start of the epoch
- * @type int $nanos
- * Number of nanoseconds since the start of the last second
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\BasicTypes::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Number of complete seconds since the start of the epoch
- *
- * Generated from protobuf field int64 seconds = 1;
- * @return int|string
- */
- public function getSeconds()
- {
- return $this->seconds;
- }
-
- /**
- * Number of complete seconds since the start of the epoch
- *
- * Generated from protobuf field int64 seconds = 1;
- * @param int|string $var
- * @return $this
- */
- public function setSeconds($var)
- {
- GPBUtil::checkInt64($var);
- $this->seconds = $var;
-
- return $this;
- }
-
- /**
- * Number of nanoseconds since the start of the last second
- *
- * Generated from protobuf field int32 nanos = 2;
- * @return int
- */
- public function getNanos()
- {
- return $this->nanos;
- }
-
- /**
- * Number of nanoseconds since the start of the last second
- *
- * Generated from protobuf field int32 nanos = 2;
- * @param int $var
- * @return $this
- */
- public function setNanos($var)
- {
- GPBUtil::checkInt32($var);
- $this->nanos = $var;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/TimestampSeconds.php b/community_server/src/Model/Messages/Gradido/TimestampSeconds.php
deleted file mode 100644
index 2a588a312..000000000
--- a/community_server/src/Model/Messages/Gradido/TimestampSeconds.php
+++ /dev/null
@@ -1,67 +0,0 @@
-model.messages.gradido.TimestampSeconds
- */
-class TimestampSeconds extends \Google\Protobuf\Internal\Message
-{
- /**
- * Number of complete seconds since the start of the epoch
- *
- * Generated from protobuf field int64 seconds = 1;
- */
- private $seconds = 0;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int|string $seconds
- * Number of complete seconds since the start of the epoch
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\BasicTypes::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Number of complete seconds since the start of the epoch
- *
- * Generated from protobuf field int64 seconds = 1;
- * @return int|string
- */
- public function getSeconds()
- {
- return $this->seconds;
- }
-
- /**
- * Number of complete seconds since the start of the epoch
- *
- * Generated from protobuf field int64 seconds = 1;
- * @param int|string $var
- * @return $this
- */
- public function setSeconds($var)
- {
- GPBUtil::checkInt64($var);
- $this->seconds = $var;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/Transaction.php b/community_server/src/Model/Messages/Gradido/Transaction.php
deleted file mode 100644
index 065cd80bb..000000000
--- a/community_server/src/Model/Messages/Gradido/Transaction.php
+++ /dev/null
@@ -1,166 +0,0 @@
-model.messages.gradido.Transaction
- */
-class Transaction extends \Google\Protobuf\Internal\Message
-{
- /**
- * Generated from protobuf field uint64 id = 1;
- */
- private $id = 0;
- /**
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds received = 2;
- */
- private $received = null;
- /**
- * Generated from protobuf field .model.messages.gradido.SignatureMap sigMap = 3;
- */
- private $sigMap = null;
- /**
- * Generated from protobuf field bytes txHash = 4;
- */
- private $txHash = '';
- /**
- * Generated from protobuf field bytes bodyBytes = 5;
- */
- private $bodyBytes = '';
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type int|string $id
- * @type \Model\Messages\Gradido\TimestampSeconds $received
- * @type \Model\Messages\Gradido\SignatureMap $sigMap
- * @type string $txHash
- * @type string $bodyBytes
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Transaction::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Generated from protobuf field uint64 id = 1;
- * @return int|string
- */
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * Generated from protobuf field uint64 id = 1;
- * @param int|string $var
- * @return $this
- */
- public function setId($var)
- {
- GPBUtil::checkUint64($var);
- $this->id = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds received = 2;
- * @return \Model\Messages\Gradido\TimestampSeconds
- */
- public function getReceived()
- {
- return $this->received;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds received = 2;
- * @param \Model\Messages\Gradido\TimestampSeconds $var
- * @return $this
- */
- public function setReceived($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\TimestampSeconds::class);
- $this->received = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.SignatureMap sigMap = 3;
- * @return \Model\Messages\Gradido\SignatureMap
- */
- public function getSigMap()
- {
- return $this->sigMap;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.SignatureMap sigMap = 3;
- * @param \Model\Messages\Gradido\SignatureMap $var
- * @return $this
- */
- public function setSigMap($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\SignatureMap::class);
- $this->sigMap = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field bytes txHash = 4;
- * @return string
- */
- public function getTxHash()
- {
- return $this->txHash;
- }
-
- /**
- * Generated from protobuf field bytes txHash = 4;
- * @param string $var
- * @return $this
- */
- public function setTxHash($var)
- {
- GPBUtil::checkString($var, False);
- $this->txHash = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field bytes bodyBytes = 5;
- * @return string
- */
- public function getBodyBytes()
- {
- return $this->bodyBytes;
- }
-
- /**
- * Generated from protobuf field bytes bodyBytes = 5;
- * @param string $var
- * @return $this
- */
- public function setBodyBytes($var)
- {
- GPBUtil::checkString($var, False);
- $this->bodyBytes = $var;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/TransactionBody.php b/community_server/src/Model/Messages/Gradido/TransactionBody.php
deleted file mode 100644
index 3452d4251..000000000
--- a/community_server/src/Model/Messages/Gradido/TransactionBody.php
+++ /dev/null
@@ -1,193 +0,0 @@
-model.messages.gradido.TransactionBody
- */
-class TransactionBody extends \Google\Protobuf\Internal\Message
-{
- /**
- * max 150 chars
- *
- * Generated from protobuf field string memo = 1;
- */
- private $memo = '';
- /**
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds created = 2;
- */
- private $created = null;
- protected $data;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type string $memo
- * max 150 chars
- * @type \Model\Messages\Gradido\TimestampSeconds $created
- * @type \Model\Messages\Gradido\StateCreateGroup $createGroup
- * @type \Model\Messages\Gradido\StateGroupChangeParent $groupChangeParent
- * @type \Model\Messages\Gradido\Transfer $transfer
- * @type \Model\Messages\Gradido\TransactionCreation $creation
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\TransactionBody::initOnce();
- parent::__construct($data);
- }
-
- /**
- * max 150 chars
- *
- * Generated from protobuf field string memo = 1;
- * @return string
- */
- public function getMemo()
- {
- return $this->memo;
- }
-
- /**
- * max 150 chars
- *
- * Generated from protobuf field string memo = 1;
- * @param string $var
- * @return $this
- */
- public function setMemo($var)
- {
- GPBUtil::checkString($var, True);
- $this->memo = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds created = 2;
- * @return \Model\Messages\Gradido\TimestampSeconds
- */
- public function getCreated()
- {
- return $this->created;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds created = 2;
- * @param \Model\Messages\Gradido\TimestampSeconds $var
- * @return $this
- */
- public function setCreated($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\TimestampSeconds::class);
- $this->created = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.StateCreateGroup createGroup = 6;
- * @return \Model\Messages\Gradido\StateCreateGroup
- */
- public function getCreateGroup()
- {
- return $this->readOneof(6);
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.StateCreateGroup createGroup = 6;
- * @param \Model\Messages\Gradido\StateCreateGroup $var
- * @return $this
- */
- public function setCreateGroup($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\StateCreateGroup::class);
- $this->writeOneof(6, $var);
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.StateGroupChangeParent groupChangeParent = 7;
- * @return \Model\Messages\Gradido\StateGroupChangeParent
- */
- public function getGroupChangeParent()
- {
- return $this->readOneof(7);
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.StateGroupChangeParent groupChangeParent = 7;
- * @param \Model\Messages\Gradido\StateGroupChangeParent $var
- * @return $this
- */
- public function setGroupChangeParent($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\StateGroupChangeParent::class);
- $this->writeOneof(7, $var);
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Transfer transfer = 8;
- * @return \Model\Messages\Gradido\Transfer
- */
- public function getTransfer()
- {
- return $this->readOneof(8);
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.Transfer transfer = 8;
- * @param \Model\Messages\Gradido\Transfer $var
- * @return $this
- */
- public function setTransfer($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\Transfer::class);
- $this->writeOneof(8, $var);
-
- return $this;
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.TransactionCreation creation = 9;
- * @return \Model\Messages\Gradido\TransactionCreation
- */
- public function getCreation()
- {
- return $this->readOneof(9);
- }
-
- /**
- * Generated from protobuf field .model.messages.gradido.TransactionCreation creation = 9;
- * @param \Model\Messages\Gradido\TransactionCreation $var
- * @return $this
- */
- public function setCreation($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\TransactionCreation::class);
- $this->writeOneof(9, $var);
-
- return $this;
- }
-
- /**
- * @return string
- */
- public function getData()
- {
- return $this->whichOneof("data");
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/TransactionCreation.php b/community_server/src/Model/Messages/Gradido/TransactionCreation.php
deleted file mode 100644
index ae5f86e07..000000000
--- a/community_server/src/Model/Messages/Gradido/TransactionCreation.php
+++ /dev/null
@@ -1,136 +0,0 @@
-model.messages.gradido.TransactionCreation
- */
-class TransactionCreation extends \Google\Protobuf\Internal\Message
-{
- /**
- * 40 Byte
- *
- * Generated from protobuf field .model.messages.gradido.ReceiverAmount receiverAmount = 1;
- */
- private $receiverAmount = null;
- /**
- * 4 Byte
- *
- * Generated from protobuf field sint32 ident_hash = 2;
- */
- private $ident_hash = 0;
- /**
- * 8 Byte
- *
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds target_date = 3;
- */
- private $target_date = null;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Model\Messages\Gradido\ReceiverAmount $receiverAmount
- * 40 Byte
- * @type int $ident_hash
- * 4 Byte
- * @type \Model\Messages\Gradido\TimestampSeconds $target_date
- * 8 Byte
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\TransactionCreation::initOnce();
- parent::__construct($data);
- }
-
- /**
- * 40 Byte
- *
- * Generated from protobuf field .model.messages.gradido.ReceiverAmount receiverAmount = 1;
- * @return \Model\Messages\Gradido\ReceiverAmount
- */
- public function getReceiverAmount()
- {
- return $this->receiverAmount;
- }
-
- /**
- * 40 Byte
- *
- * Generated from protobuf field .model.messages.gradido.ReceiverAmount receiverAmount = 1;
- * @param \Model\Messages\Gradido\ReceiverAmount $var
- * @return $this
- */
- public function setReceiverAmount($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\ReceiverAmount::class);
- $this->receiverAmount = $var;
-
- return $this;
- }
-
- /**
- * 4 Byte
- *
- * Generated from protobuf field sint32 ident_hash = 2;
- * @return int
- */
- public function getIdentHash()
- {
- return $this->ident_hash;
- }
-
- /**
- * 4 Byte
- *
- * Generated from protobuf field sint32 ident_hash = 2;
- * @param int $var
- * @return $this
- */
- public function setIdentHash($var)
- {
- GPBUtil::checkInt32($var);
- $this->ident_hash = $var;
-
- return $this;
- }
-
- /**
- * 8 Byte
- *
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds target_date = 3;
- * @return \Model\Messages\Gradido\TimestampSeconds
- */
- public function getTargetDate()
- {
- return $this->target_date;
- }
-
- /**
- * 8 Byte
- *
- * Generated from protobuf field .model.messages.gradido.TimestampSeconds target_date = 3;
- * @param \Model\Messages\Gradido\TimestampSeconds $var
- * @return $this
- */
- public function setTargetDate($var)
- {
- GPBUtil::checkMessage($var, \Model\Messages\Gradido\TimestampSeconds::class);
- $this->target_date = $var;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Messages/Gradido/Transfer.php b/community_server/src/Model/Messages/Gradido/Transfer.php
deleted file mode 100644
index 2c031d02b..000000000
--- a/community_server/src/Model/Messages/Gradido/Transfer.php
+++ /dev/null
@@ -1,85 +0,0 @@
-model.messages.gradido.Transfer
- */
-class Transfer extends \Google\Protobuf\Internal\Message
-{
- /**
- * Generated from protobuf field repeated .model.messages.gradido.SenderAmount senderAmounts = 1;
- */
- private $senderAmounts;
- /**
- * Generated from protobuf field repeated .model.messages.gradido.ReceiverAmount receiverAmounts = 2;
- */
- private $receiverAmounts;
-
- /**
- * Constructor.
- *
- * @param array $data {
- * Optional. Data for populating the Message object.
- *
- * @type \Model\Messages\Gradido\SenderAmount[]|\Google\Protobuf\Internal\RepeatedField $senderAmounts
- * @type \Model\Messages\Gradido\ReceiverAmount[]|\Google\Protobuf\Internal\RepeatedField $receiverAmounts
- * }
- */
- public function __construct($data = NULL) {
- \GPBMetadata\Transfer::initOnce();
- parent::__construct($data);
- }
-
- /**
- * Generated from protobuf field repeated .model.messages.gradido.SenderAmount senderAmounts = 1;
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getSenderAmounts()
- {
- return $this->senderAmounts;
- }
-
- /**
- * Generated from protobuf field repeated .model.messages.gradido.SenderAmount senderAmounts = 1;
- * @param \Model\Messages\Gradido\SenderAmount[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setSenderAmounts($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Model\Messages\Gradido\SenderAmount::class);
- $this->senderAmounts = $arr;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field repeated .model.messages.gradido.ReceiverAmount receiverAmounts = 2;
- * @return \Google\Protobuf\Internal\RepeatedField
- */
- public function getReceiverAmounts()
- {
- return $this->receiverAmounts;
- }
-
- /**
- * Generated from protobuf field repeated .model.messages.gradido.ReceiverAmount receiverAmounts = 2;
- * @param \Model\Messages\Gradido\ReceiverAmount[]|\Google\Protobuf\Internal\RepeatedField $var
- * @return $this
- */
- public function setReceiverAmounts($var)
- {
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Model\Messages\Gradido\ReceiverAmount::class);
- $this->receiverAmounts = $arr;
-
- return $this;
- }
-
-}
-
diff --git a/community_server/src/Model/Transactions/Transaction.php b/community_server/src/Model/Transactions/Transaction.php
index 40be13cd3..db7ed9e5b 100644
--- a/community_server/src/Model/Transactions/Transaction.php
+++ b/community_server/src/Model/Transactions/Transaction.php
@@ -25,7 +25,7 @@ class Transaction extends TransactionBase {
//$transactionBin = base64_decode($base64Data, true);
//if($transactionBin == false) {
//sodium_base64_VARIANT_URLSAFE_NO_PADDING
- if(is_a($base64Data, '\Proto\Gradido\Transaction')) {
+ if(is_a($base64Data, '\Proto\Gradido\GradidoTransaction')) {
$this->mProtoTransaction = $base64Data;
$this->mTransactionBody = new TransactionBody($this->mProtoTransaction->getBodyBytes());
return;
@@ -93,7 +93,11 @@ class Transaction extends TransactionBase {
return $this->mTransactionBody;
}
- public function getFirstPublic() {
+ public function getFirstPublic()
+ {
+ if(!$this->mProtoTransaction || !$this->mProtoTransaction->getSigMap()) {
+ return '';
+ }
$sigPairs = $this->mProtoTransaction->getSigMap()->getSigPair();
return $sigPairs[0]->getPubKey();
}
@@ -111,6 +115,7 @@ class Transaction extends TransactionBase {
$sigMap = $this->mProtoTransaction->getSigMap();
if(!$sigMap) {
$this->addError('Transaction', 'signature map is zero');
+ //var_dump($this->mProtoTransaction);
return false;
}
//var_dump($sigMap);
diff --git a/community_server/src/Model/Transactions/TransactionTransfer.php b/community_server/src/Model/Transactions/TransactionTransfer.php
index 4f3f4e88c..c36583c13 100644
--- a/community_server/src/Model/Transactions/TransactionTransfer.php
+++ b/community_server/src/Model/Transactions/TransactionTransfer.php
@@ -58,7 +58,7 @@ class TransactionTransfer extends TransactionBase {
//$this->addError('TransactionTransfer::validate', 'not implemented yet');
//return false;
//$time = microtime(true);
- static $functionName = 'TransactionCreation::validate';
+ static $functionName = 'TransactionTransfer::validate';
$sigPubHexs = [];
foreach($sigPairs as $sigPair)
diff --git a/community_server/src/Template/Transactions/manual_transaction.ctp b/community_server/src/Template/Transactions/manual_transaction.ctp
new file mode 100644
index 000000000..30bda1175
--- /dev/null
+++ b/community_server/src/Template/Transactions/manual_transaction.ctp
@@ -0,0 +1,63 @@
+loadHelper('Form', [
+ 'templates' => 'horizontal_form',
+]);
+$now = new \DateTime;
+?>
+ 0) : ?>
+
= __('Creation Transaction') ?>
+= __('Transfer Transaction') ?>
+