mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Use controller::User in TransactionTransfer
This commit is contained in:
parent
ecae855fc0
commit
9e5bc624d9
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const std::string TransactionTransfer::mInvalidIndexMessage("invalid index");
|
const std::string TransactionTransfer::mInvalidIndexMessage("invalid index");
|
||||||
|
|
||||||
TransactionTransfer::KontoTableEntry::KontoTableEntry(User* user, google::protobuf::int64 amount, bool negativeAmount/* = false*/)
|
TransactionTransfer::KontoTableEntry::KontoTableEntry(model::table::User* user, google::protobuf::int64 amount, bool negativeAmount/* = false*/)
|
||||||
{
|
{
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
|
|
||||||
@ -80,13 +80,14 @@ int TransactionTransfer::prepare()
|
|||||||
unlock();
|
unlock();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
User user((const unsigned char*)pubkey.data());
|
//User user((const unsigned char*)pubkey.data());
|
||||||
if (user.getUserState() == USER_EMPTY) {
|
auto user = controller::User::create();
|
||||||
|
if (!user->load((const unsigned char*)pubkey.data())) {
|
||||||
sodium_bin2hex(pubkeyHexTemp, 65, (const unsigned char*)pubkey.data(), pubkey.size());
|
sodium_bin2hex(pubkeyHexTemp, 65, (const unsigned char*)pubkey.data(), pubkey.size());
|
||||||
mKontoTable.push_back(KontoTableEntry(pubkeyHexTemp, senderAmount.amount(), true));
|
mKontoTable.push_back(KontoTableEntry(pubkeyHexTemp, senderAmount.amount(), true));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mKontoTable.push_back(KontoTableEntry(&user, senderAmount.amount(), true));
|
mKontoTable.push_back(KontoTableEntry(user->getModel(), senderAmount.amount(), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < mProtoTransfer.receiveramounts_size(); i++) {
|
for (int i = 0; i < mProtoTransfer.receiveramounts_size(); i++) {
|
||||||
@ -98,13 +99,13 @@ int TransactionTransfer::prepare()
|
|||||||
unlock();
|
unlock();
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
User user((const unsigned char*)pubkey.data());
|
auto user = controller::User::create();
|
||||||
if (user.getUserState() == USER_EMPTY) {
|
if (!user->load((const unsigned char*)pubkey.data())) {
|
||||||
sodium_bin2hex(pubkeyHexTemp, 65, (const unsigned char*)pubkey.data(), pubkey.size());
|
sodium_bin2hex(pubkeyHexTemp, 65, (const unsigned char*)pubkey.data(), pubkey.size());
|
||||||
mKontoTable.push_back(KontoTableEntry(pubkeyHexTemp, receiverAmount.amount(), false));
|
mKontoTable.push_back(KontoTableEntry(pubkeyHexTemp, receiverAmount.amount(), false));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mKontoTable.push_back(KontoTableEntry(&user, receiverAmount.amount(), false));
|
mKontoTable.push_back(KontoTableEntry(user->getModel(), receiverAmount.amount(), false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (senderSum != receiverSum) {
|
if (senderSum != receiverSum) {
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#include "TransactionBase.h"
|
#include "TransactionBase.h"
|
||||||
#include "../proto/gradido/Transfer.pb.h"
|
#include "../proto/gradido/Transfer.pb.h"
|
||||||
|
|
||||||
#include "User.h"
|
#include "../controller/User.h"
|
||||||
|
|
||||||
class TransactionTransfer : public TransactionBase
|
class TransactionTransfer : public TransactionBase
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ protected:
|
|||||||
struct KontoTableEntry
|
struct KontoTableEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KontoTableEntry(User* user, google::protobuf::int64 amount, bool negativeAmount = false);
|
KontoTableEntry(model::table::User* user, google::protobuf::int64 amount, bool negativeAmount = false);
|
||||||
KontoTableEntry(const std::string& pubkeyHex, google::protobuf::int64 amount, bool negativeAmount = false);
|
KontoTableEntry(const std::string& pubkeyHex, google::protobuf::int64 amount, bool negativeAmount = false);
|
||||||
// first name, last name and email or pubkey hex if no user in db found
|
// first name, last name and email or pubkey hex if no user in db found
|
||||||
std::string kontoNameCell;
|
std::string kontoNameCell;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user