mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
cross group transfer
This commit is contained in:
parent
5bbc7cace5
commit
cb3d5a6f0a
@ -656,76 +656,86 @@ void CheckTransactionPage::handleRequest(Poco::Net::HTTPServerRequest& request,
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t";
|
||||
#line 242 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(((i+1) % 2) == 0 && transferTransaction->getTargetGroupAlias() != "") { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t (";
|
||||
#line 243 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( transferTransaction->getTargetGroupAlias() );
|
||||
responseStream << ")\n";
|
||||
responseStream << "\t\t\t\t\t\t";
|
||||
#line 244 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t";
|
||||
#line 245 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( transferTransaction->getAmountCell(i) );
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t</div>\n";
|
||||
responseStream << "\t\t\t ";
|
||||
#line 244 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 247 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t</div>\n";
|
||||
responseStream << "\t\t\t ";
|
||||
#line 246 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 249 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} else if(PAGE_TRANSACTION_CREATION == state) {
|
||||
auto creationTransaction = transaction_body->getCreationTransaction();
|
||||
auto transactionUser = creationTransaction->getUser();
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t<p>";
|
||||
#line 250 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 253 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Schöpfung") );
|
||||
responseStream << "</p>\n";
|
||||
responseStream << "\t\t\t\t<div class=\"content-table\">\n";
|
||||
responseStream << "\t\t\t\t <div class=\"content-row content-row-header\">\n";
|
||||
responseStream << "\t\t\t\t\t<span class=\"content-cell\">";
|
||||
#line 253 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 256 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Konto") );
|
||||
responseStream << "</span>\n";
|
||||
responseStream << "\t\t\t\t\t<span class=\"content-cell\">";
|
||||
#line 254 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 257 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Zieldatum") );
|
||||
responseStream << "</span>\n";
|
||||
responseStream << "\t\t\t\t\t<span class=\"content-cell\">";
|
||||
#line 255 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 258 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Gradido") );
|
||||
responseStream << "</span>\n";
|
||||
responseStream << "\t\t\t\t </div>\n";
|
||||
responseStream << "\t\t\t\t <div class=\"content-row content-row-bg\">\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 258 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 261 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(!transactionUser.isNull()) {
|
||||
auto user_model = transactionUser->getModel();
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t<span class=\"content-cell\">";
|
||||
#line 261 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 264 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( user_model->getFirstName() );
|
||||
responseStream << " ";
|
||||
#line 261 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 264 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( user_model->getLastName() );
|
||||
responseStream << " <";
|
||||
#line 261 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 264 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( user_model->getEmail() );
|
||||
responseStream << "></span>\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 262 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 265 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} else { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t<span class=\"content-cell\">0x";
|
||||
#line 263 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 266 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( creationTransaction->getPublicHex() );
|
||||
responseStream << "</span>\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 264 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 267 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t<span class=\"content-cell\">";
|
||||
#line 265 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 268 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( creationTransaction->getTargetDateString() );
|
||||
responseStream << "</span>\n";
|
||||
responseStream << "\t\t\t\t\t<span class=\"content-cell success-color\">";
|
||||
#line 266 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 269 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( creationTransaction->getAmountString() );
|
||||
responseStream << " GDD</span>\n";
|
||||
responseStream << "\t\t\t\t </div>\n";
|
||||
responseStream << "\t\t\t\t</div>\n";
|
||||
responseStream << "\t\t ";
|
||||
#line 269 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 272 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} else if(PAGE_TRANSACTION_GROUP_ADD_MEMBER == state) {
|
||||
auto groupMemberUpdateTransaction = transaction_body->getGroupMemberUpdate();
|
||||
auto groups = controller::Group::load(groupMemberUpdateTransaction->getTargetGroupAlias());
|
||||
@ -740,112 +750,112 @@ void CheckTransactionPage::handleRequest(Poco::Net::HTTPServerRequest& request,
|
||||
}
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t <p>";
|
||||
#line 282 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 285 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Benutzer zu einer Gruppe hinzufügen") );
|
||||
responseStream << "</p>\n";
|
||||
responseStream << "\t\t\t <div class=\"content-table\">\n";
|
||||
responseStream << "\t\t\t\t<p>";
|
||||
#line 284 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 287 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(!user.isNull()) { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t<b>Benutzer:</b> ";
|
||||
#line 285 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 288 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( user->getEmailWithNames() );
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t";
|
||||
#line 286 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 289 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} else { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t<b>Account public key:</b> ";
|
||||
#line 287 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 290 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( groupMemberUpdateTransaction->getPublicKeyHex() );
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t";
|
||||
#line 288 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 291 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "</p>\n";
|
||||
responseStream << "\t\t\t\t";
|
||||
#line 289 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 292 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(!group_model.isNull()) { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t<p><b>";
|
||||
#line 290 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 293 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Gruppe") );
|
||||
responseStream << ":</b></p>\n";
|
||||
responseStream << "\t\t\t\t\t<ul>\n";
|
||||
responseStream << "\t\t\t\t\t\t<li>";
|
||||
#line 292 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 295 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Name") );
|
||||
responseStream << ": ";
|
||||
#line 292 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 295 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( group_model->getName() );
|
||||
responseStream << "</li>\n";
|
||||
responseStream << "\t\t\t\t\t\t<li>";
|
||||
#line 293 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 296 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Alias") );
|
||||
responseStream << ": ";
|
||||
#line 293 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 296 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( group_model->getAlias() );
|
||||
responseStream << "</li>\n";
|
||||
responseStream << "\t\t\t\t\t\t<li>";
|
||||
#line 294 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 297 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Url") );
|
||||
responseStream << ": <a href=\"";
|
||||
#line 294 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 297 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( group_model->getUrl() );
|
||||
responseStream << "/pages/visitor\" target=\"_blank\">";
|
||||
#line 294 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 297 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( group_model->getUrl() );
|
||||
responseStream << "</a></li>\n";
|
||||
responseStream << "\t\t\t\t\t\t<li>";
|
||||
#line 295 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 298 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( group_model->getDescription() );
|
||||
responseStream << "</li>\n";
|
||||
responseStream << "\t\t\t\t\t</ul>\n";
|
||||
responseStream << "\t\t\t\t";
|
||||
#line 297 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 300 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} else { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 298 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 301 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Unbekannte Gruppe") );
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t";
|
||||
#line 299 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 302 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t\t";
|
||||
#line 300 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 303 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Es haben bereits ") );
|
||||
#line 300 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 303 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( std::to_string(transaction->getSignCount()) );
|
||||
#line 300 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 303 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext(" unterzeichnet") );
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t </div>\n";
|
||||
responseStream << "\t\t\t \n";
|
||||
responseStream << "\t\t\t ";
|
||||
#line 303 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 306 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} else if(PAGE_USER_DATA_CORRUPTED == state) { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t<p class=\"alert-color\">";
|
||||
#line 304 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 307 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Es gibt ein Problem mit deinen gespeicherten Daten, bitte wende dich an den"));
|
||||
responseStream << "<a href=\"mailto:";
|
||||
#line 304 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 307 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( em->getAdminReceiver());
|
||||
responseStream << "?subject=Corrupt User Data&body=Hallo Dario,%0D%0A%0D%0Ameine Benutzer Daten sind korrupt.%0D%0Akannst du das prüfen?%0D%0A%0D%0AMit freundlichen Grüßen%0D%0A\">";
|
||||
#line 304 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 307 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << (gettext("Support") );
|
||||
responseStream << "</a></p>\n";
|
||||
responseStream << "\t\t\t ";
|
||||
#line 305 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 308 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t ";
|
||||
#line 306 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 309 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(PAGE_NO_TRANSACTIONS == state) { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t<a href=\"";
|
||||
#line 307 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 310 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( ServerConfig::g_php_serverPath );
|
||||
responseStream << "\">";
|
||||
#line 307 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 310 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Zurück") );
|
||||
responseStream << "</a>\n";
|
||||
responseStream << "\t\t\t ";
|
||||
#line 308 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 311 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} else { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t<div class=\"content-table\">\n";
|
||||
responseStream << "\t\t\t\t <div class=\"content-row content-row-header\">\n";
|
||||
@ -853,7 +863,7 @@ void CheckTransactionPage::handleRequest(Poco::Net::HTTPServerRequest& request,
|
||||
responseStream << "\t\t\t\t </div>\n";
|
||||
responseStream << "\t\t\t\t <div class=\"content-row\">\n";
|
||||
responseStream << "\t\t\t\t\t<span class=\"content-cell\">";
|
||||
#line 314 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 317 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( user_model->getNameWithEmailHtml() );
|
||||
responseStream << "</span>\n";
|
||||
responseStream << "\t\t\t\t </div>\n";
|
||||
@ -864,62 +874,62 @@ void CheckTransactionPage::handleRequest(Poco::Net::HTTPServerRequest& request,
|
||||
responseStream << "\t\t\t\t </div>\n";
|
||||
responseStream << "\t\t\t\t <div class=\"content-row content-row-bg\">\n";
|
||||
responseStream << "\t\t\t\t\t<span class=\"content-cell\">";
|
||||
#line 322 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 325 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( memo );
|
||||
responseStream << "</span>\n";
|
||||
responseStream << "\t\t\t\t </div>\n";
|
||||
responseStream << "\t\t\t\t</div>\n";
|
||||
responseStream << "\t\t\t\t<form>\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 326 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 329 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(transaction) { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t<input type=\"hidden\" name=\"pending-task-id\" value=\"";
|
||||
#line 327 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 330 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( transaction->getModel()->getID() );
|
||||
responseStream << "\">\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 328 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 331 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t<input type=\"hidden\" name=\"skip-count\" value=\"";
|
||||
#line 329 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 332 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( skip_count );
|
||||
responseStream << "\">\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 330 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 333 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(!account_user->hasPassword()) { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t <div class=\"form-group\">\n";
|
||||
responseStream << "\t\t\t\t\t\t <label for=\"sign-password\">";
|
||||
#line 332 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 335 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Ich brauche nochmal dein Passwort") );
|
||||
responseStream << "</label>\n";
|
||||
responseStream << "\t\t\t\t\t\t <input type=\"password\" class=\"form-control\" id=\"sign-password\" name=\"sign-password\" placeholder=\"";
|
||||
#line 333 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 336 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Passwort") );
|
||||
responseStream << "\">\n";
|
||||
responseStream << "\t\t\t\t\t </div>\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 335 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 338 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 336 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 339 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(enableSign && !hasErrors) { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t<button type=\"submit\" class=\"form-button\" name=\"ok\" value=\"ok\">\n";
|
||||
responseStream << "\t\t\t\t\t\t\t<i class=\"material-icons-outlined\">verified_user</i>\n";
|
||||
responseStream << "\t\t\t\t\t\t\t";
|
||||
#line 339 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 342 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Transaktion unterzeichnen") );
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t</button>\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 341 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 344 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 342 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 345 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
if(transaction_removeable) { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t<button type=\"submit\" class=\"form-button button-cancel\" name=\"abort\" value=\"abort\">\n";
|
||||
responseStream << "\t\t\t\t\t\t\t<i class=\"material-icons-outlined\">delete</i>\n";
|
||||
responseStream << "\t\t\t\t\t\t\t";
|
||||
#line 345 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 348 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Transaktion verwerfen") );
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t</button>\n";
|
||||
@ -936,21 +946,21 @@ void CheckTransactionPage::handleRequest(Poco::Net::HTTPServerRequest& request,
|
||||
responseStream << "\t\t\t</form>\n";
|
||||
responseStream << "\t\t\t\t\t\t</button>\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 347 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 350 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} else { responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t<button type=\"submit\" class=\"form-button button-cancel\" name=\"skip\" value=\"skip\">\n";
|
||||
responseStream << "\t\t\t\t\t\t\t<i class=\"material-icons-outlined\">debug-step-over</i>\n";
|
||||
responseStream << "\t\t\t\t\t\t\t";
|
||||
#line 350 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 353 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
responseStream << ( gettext("Transaktion überspringen") );
|
||||
responseStream << "\n";
|
||||
responseStream << "\t\t\t\t\t\t</button>\n";
|
||||
responseStream << "\t\t\t\t\t";
|
||||
#line 352 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 355 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t\t\t</form>\n";
|
||||
responseStream << "\t\t\t";
|
||||
#line 354 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
#line 357 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkTransaction.cpsp"
|
||||
} responseStream << "\n";
|
||||
responseStream << "\t\t</div>\n";
|
||||
responseStream << "\t</div>\n";
|
||||
|
||||
@ -67,7 +67,7 @@ void LoginPage::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::
|
||||
if(!form.empty()) {
|
||||
|
||||
caller_uri = form.get("caller_uri", "");
|
||||
printf("form.get: caller_uri: %s\n", caller_uri.data());
|
||||
//printf("form.get: caller_uri: %s\n", caller_uri.data());
|
||||
|
||||
bool langUpdatedByBtn = false;
|
||||
auto langBtn = form.get("lang", "");
|
||||
@ -116,11 +116,12 @@ void LoginPage::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::
|
||||
} else {
|
||||
langCatalog = mSession->getLanguageCatalog();
|
||||
*/
|
||||
if(mSession) {
|
||||
|
||||
/*if(mSession) {
|
||||
printf("start with session: %d\n", mSession->getHandle());
|
||||
} else {
|
||||
printf("start without session\n");
|
||||
}
|
||||
}*/
|
||||
|
||||
if(!mSession) {
|
||||
mSession = sm->getNewSession();
|
||||
@ -147,7 +148,7 @@ void LoginPage::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::
|
||||
}
|
||||
}
|
||||
|
||||
printf("after session: caller_uri: %s\n", caller_uri.data());
|
||||
//printf("after session: caller_uri: %s\n", caller_uri.data());
|
||||
|
||||
|
||||
if(email != "" && password != "") {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "../../Crypto/KeyPairEd25519.h"
|
||||
#include "../../controller/Group.h"
|
||||
#include "../../SingletonManager/SessionManager.h"
|
||||
#include "../../lib/JsonRequest.h"
|
||||
|
||||
namespace model {
|
||||
namespace gradido {
|
||||
@ -125,6 +126,9 @@ namespace model {
|
||||
// write new group_id in user table
|
||||
user_model->setGroupId(group_model->getID());
|
||||
user_model->updateIntoDB("group_id", group_model->getID());
|
||||
|
||||
JsonRequest request(group_model->getUrl(), 443);
|
||||
request.request("addUser", user->getJson());
|
||||
|
||||
printf("[GroupMemberUpdate::transactionAccepted] finished\n");
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ namespace model {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<Poco::AutoPtr<Transaction>> Transaction::createTransfer(Poco::AutoPtr<controller::User> sender, const MemoryBin* receiverPubkey, Poco::AutoPtr<controller::Group> receiverGroup, Poco::UInt32 amount, const std::string& memo)
|
||||
std::vector<Poco::AutoPtr<Transaction>> Transaction::createTransfer(Poco::AutoPtr<controller::User> sender, const MemoryBin* receiverPubkey, Poco::AutoPtr<controller::Group> receiverGroup, Poco::UInt32 amount, const std::string& memo, bool inbound/* = true*/)
|
||||
{
|
||||
std::vector<Poco::AutoPtr<Transaction>> results;
|
||||
auto em = ErrorManager::getInstance();
|
||||
@ -140,12 +140,13 @@ namespace model {
|
||||
Poco::AutoPtr<controller::Group> topic_group;
|
||||
// default constructor set it to now
|
||||
Poco::Timestamp pairedTransactionId;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (0 == i) {
|
||||
// create only inbound transaction, and outbound before sending to hedera
|
||||
//for (int i = 0; i < 1; i++) {
|
||||
if (inbound) {
|
||||
transaction_group = receiverGroup;
|
||||
topic_group = sender_group;
|
||||
}
|
||||
else {
|
||||
else if(!inbound) {
|
||||
transaction_group = sender_group;
|
||||
topic_group = receiverGroup;
|
||||
}
|
||||
@ -157,7 +158,7 @@ namespace model {
|
||||
return results;
|
||||
}
|
||||
if (transaction_group.isNull()) {
|
||||
em->addError(new ParamError(function_name, "transaction group is zero, i:", i));
|
||||
em->addError(new ParamError(function_name, "transaction group is zero, inbound", inbound));
|
||||
em->sendErrorsAsEmail();
|
||||
return results;
|
||||
}
|
||||
@ -166,12 +167,14 @@ namespace model {
|
||||
Poco::AutoPtr<Transaction> transaction = new Transaction(body);
|
||||
transaction->getModel()->setHederaId(topic_id->getModel()->getID());
|
||||
results.push_back(transaction);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
for (auto it = results.begin(); it != results.end(); it++) {
|
||||
(*it)->insertPendingTaskIntoDB(sender, model::table::TASK_TYPE_TRANSFER);
|
||||
PendingTasksManager::getInstance()->addTask(*it);
|
||||
}
|
||||
|
||||
return results;
|
||||
|
||||
}
|
||||
@ -308,6 +311,13 @@ namespace model {
|
||||
// check if enough signatures exist for next step
|
||||
if (getSignCount() >= mTransactionBody->getTransactionBase()->getMinSignatureCount())
|
||||
{
|
||||
if (getTransactionBody()->isTransfer()) {
|
||||
auto transfer = getTransactionBody()->getTransferTransaction();
|
||||
if (transfer->isInbound()) {
|
||||
auto transaction = transfer->createOutbound(getTransactionBody()->getMemo());
|
||||
transaction->sign(user);
|
||||
}
|
||||
}
|
||||
UniLib::controller::TaskPtr transaction_send_task(new SendTransactionTask(Poco::AutoPtr<Transaction>(this, true)));
|
||||
transaction_send_task->scheduleTask(transaction_send_task);
|
||||
}
|
||||
@ -657,7 +667,22 @@ namespace model {
|
||||
|
||||
int SendTransactionTask::run()
|
||||
{
|
||||
auto result = mTransaction->runSendTransaction();
|
||||
int result = 1;
|
||||
// if transfer inbound, create also transfer outbound
|
||||
/*if (mTransaction->getTransactionBody()->isTransfer()) {
|
||||
auto transfer = mTransaction->getTransactionBody()->getTransferTransaction();
|
||||
if (transfer->isInbound()) {
|
||||
auto outbound = transfer->createOutbound(mTransaction->getTransactionBody()->getMemo());
|
||||
if (outbound.isNull()) { result = -1;}
|
||||
|
||||
result = outbound->runSendTransaction();
|
||||
}
|
||||
}
|
||||
if (result != 1) {
|
||||
mTransaction->deleteFromDB();
|
||||
return 0;
|
||||
}*/
|
||||
result = mTransaction->runSendTransaction();
|
||||
printf("[SendTransactionTask::run] result: %d\n", result);
|
||||
// delete because of error
|
||||
if (-1 == result) {
|
||||
|
||||
@ -30,7 +30,7 @@ namespace model {
|
||||
static Poco::AutoPtr<Transaction> createGroupMemberUpdate(Poco::AutoPtr<controller::User> user, Poco::AutoPtr<controller::Group> group);
|
||||
//! \brief transfer
|
||||
//! \return for cross group transaction return two transactions
|
||||
static std::vector<Poco::AutoPtr<Transaction>> createTransfer(Poco::AutoPtr<controller::User> sender, const MemoryBin* receiverPubkey, Poco::AutoPtr<controller::Group> receiverGroup, Poco::UInt32 amount, const std::string& memo);
|
||||
static std::vector<Poco::AutoPtr<Transaction>> createTransfer(Poco::AutoPtr<controller::User> sender, const MemoryBin* receiverPubkey, Poco::AutoPtr<controller::Group> receiverGroup, Poco::UInt32 amount, const std::string& memo, bool inbound = true);
|
||||
//! \brief creation transaction
|
||||
static Poco::AutoPtr<Transaction> createCreation(Poco::AutoPtr<controller::User> receiver, Poco::UInt32 amount, Poco::DateTime targetDate, const std::string& memo);
|
||||
static Poco::AutoPtr<Transaction> load(model::table::PendingTask* dbModel);
|
||||
@ -60,6 +60,7 @@ namespace model {
|
||||
|
||||
std::string getTransactionAsJson(bool replaceBase64WithHex = false);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "TransactionTransfer.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
namespace model {
|
||||
namespace gradido {
|
||||
@ -65,61 +66,61 @@ namespace model {
|
||||
Poco::ScopedLock<Poco::Mutex> _lock(mWorkMutex);
|
||||
const static char functionName[] = { "TransactionTransfer::prepare" };
|
||||
|
||||
mKontoTable.reserve(2);
|
||||
mKontoTable.reserve(2);
|
||||
|
||||
//auto receiverAmount = mProtoTransfer.receiveramount();
|
||||
//auto senderAmount
|
||||
proto::gradido::TransferAmount* sender = nullptr;
|
||||
std::string* receiver_pubkey = nullptr;
|
||||
if (mProtoTransfer.has_local()) {
|
||||
auto local_transfer = mProtoTransfer.local();
|
||||
sender = local_transfer.mutable_sender();
|
||||
receiver_pubkey = local_transfer.mutable_receiver();
|
||||
return prepare(sender, receiver_pubkey);
|
||||
}
|
||||
else if (mProtoTransfer.has_inbound()) {
|
||||
auto inbound_transfer = mProtoTransfer.inbound();
|
||||
sender = inbound_transfer.mutable_sender();
|
||||
receiver_pubkey = inbound_transfer.mutable_receiver();
|
||||
return prepare(sender, receiver_pubkey);
|
||||
}
|
||||
else if (mProtoTransfer.has_outbound()) {
|
||||
auto outbound_transfer = mProtoTransfer.outbound();
|
||||
sender = outbound_transfer.mutable_sender();
|
||||
receiver_pubkey = outbound_transfer.mutable_receiver();
|
||||
return prepare(sender, receiver_pubkey);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int TransactionTransfer::prepare(proto::gradido::TransferAmount* sender, std::string* receiver_pubkey)
|
||||
{
|
||||
assert(sender && receiver_pubkey);
|
||||
|
||||
char pubkeyHexTemp[65];
|
||||
auto sender_pubkey = sender->pubkey();
|
||||
auto amount = sender->amount();
|
||||
auto sender_user = controller::User::create();
|
||||
auto receiver_user = controller::User::create();
|
||||
|
||||
if (mProtoTransfer.has_local())
|
||||
{
|
||||
auto local_transfer = mProtoTransfer.local();
|
||||
auto sender = local_transfer.sender();
|
||||
auto sender_pubkey = sender.pubkey();
|
||||
auto receiver_pubkey = local_transfer.receiver();
|
||||
auto amount = sender.amount();
|
||||
auto sender_user = controller::User::create();
|
||||
auto receiver_user = controller::User::create();
|
||||
|
||||
if (!sender_user->load((const unsigned char*)sender_pubkey.data())) {
|
||||
sodium_bin2hex(pubkeyHexTemp, 65, (const unsigned char*)sender_pubkey.data(), sender_pubkey.size());
|
||||
mKontoTable.push_back(KontoTableEntry(pubkeyHexTemp, amount, true));
|
||||
}
|
||||
else {
|
||||
mKontoTable.push_back(KontoTableEntry(sender_user->getModel(), amount, true));
|
||||
}
|
||||
|
||||
if (!receiver_user->load((const unsigned char*)receiver_pubkey.data())) {
|
||||
sodium_bin2hex(pubkeyHexTemp, 65, (const unsigned char*)receiver_pubkey.data(), receiver_pubkey.size());
|
||||
mKontoTable.push_back(KontoTableEntry(pubkeyHexTemp, amount, false));
|
||||
}
|
||||
else {
|
||||
mKontoTable.push_back(KontoTableEntry(receiver_user->getModel(), amount, false));
|
||||
}
|
||||
mMinSignatureCount = 1;
|
||||
auto mm = MemoryManager::getInstance();
|
||||
auto pubkey_copy = mm->getFreeMemory(KeyPairEd25519::getPublicKeySize());
|
||||
memcpy(*pubkey_copy, sender_pubkey.data(), KeyPairEd25519::getPublicKeySize());
|
||||
mRequiredSignPublicKeys.push_back(pubkey_copy);
|
||||
}
|
||||
|
||||
|
||||
// TODO: add version for group transfer
|
||||
|
||||
|
||||
/*
|
||||
mReceiverUser = new User(receiverPublic.data());
|
||||
getErrors(mReceiverUser);
|
||||
if (mReceiverUser->getUserState() == USER_EMPTY) {
|
||||
sodium_bin2hex(mReceiverPublicHex, 65, (const unsigned char*)receiverPublic.data(), receiverPublic.size());
|
||||
delete mReceiverUser;
|
||||
mReceiverUser = nullptr;
|
||||
if (!sender_user->load((const unsigned char*)sender_pubkey.data())) {
|
||||
sodium_bin2hex(pubkeyHexTemp, 65, (const unsigned char*)sender_pubkey.data(), sender_pubkey.size());
|
||||
mKontoTable.push_back(KontoTableEntry(pubkeyHexTemp, amount, true));
|
||||
}
|
||||
else {
|
||||
memcpy(mReceiverPublicHex, mReceiverUser->getPublicKeyHex().data(), 64);
|
||||
mKontoTable.push_back(KontoTableEntry(sender_user->getModel(), amount, true));
|
||||
}
|
||||
//*/
|
||||
|
||||
if (!receiver_user->load((const unsigned char*)receiver_pubkey->data())) {
|
||||
sodium_bin2hex(pubkeyHexTemp, 65, (const unsigned char*)receiver_pubkey->data(), receiver_pubkey->size());
|
||||
mKontoTable.push_back(KontoTableEntry(pubkeyHexTemp, amount, false));
|
||||
}
|
||||
else {
|
||||
mKontoTable.push_back(KontoTableEntry(receiver_user->getModel(), amount, false));
|
||||
}
|
||||
mMinSignatureCount = 1;
|
||||
auto mm = MemoryManager::getInstance();
|
||||
auto pubkey_copy = mm->getFreeMemory(KeyPairEd25519::getPublicKeySize());
|
||||
memcpy(*pubkey_copy, sender_pubkey.data(), KeyPairEd25519::getPublicKeySize());
|
||||
mRequiredSignPublicKeys.push_back(pubkey_copy);
|
||||
|
||||
mIsPrepared = true;
|
||||
return 0;
|
||||
@ -127,12 +128,42 @@ namespace model {
|
||||
|
||||
TransactionValidation TransactionTransfer::validate()
|
||||
{
|
||||
Poco::ScopedLock<Poco::Mutex> _lock(mWorkMutex);
|
||||
static const char function_name[] = "TransactionTransfer::validate";
|
||||
if (!mProtoTransfer.has_local()) {
|
||||
/*if (!mProtoTransfer.has_local()) {
|
||||
addError(new Error(function_name, "only local currently implemented"));
|
||||
return TRANSACTION_VALID_CODE_ERROR;
|
||||
}*/
|
||||
proto::gradido::TransferAmount* sender = nullptr;
|
||||
std::string* receiver_pubkey = nullptr;
|
||||
if (mProtoTransfer.has_local()) {
|
||||
auto local_transfer = mProtoTransfer.local();
|
||||
sender = local_transfer.mutable_sender();
|
||||
receiver_pubkey = local_transfer.mutable_receiver();
|
||||
return validate(sender, receiver_pubkey);
|
||||
}
|
||||
auto amount = mProtoTransfer.local().sender().amount();
|
||||
else if (mProtoTransfer.has_inbound()) {
|
||||
auto inbound_transfer = mProtoTransfer.inbound();
|
||||
sender = inbound_transfer.mutable_sender();
|
||||
receiver_pubkey = inbound_transfer.mutable_receiver();
|
||||
return validate(sender, receiver_pubkey);
|
||||
}
|
||||
else if (mProtoTransfer.has_outbound()) {
|
||||
auto outbound_transfer = mProtoTransfer.outbound();
|
||||
sender = outbound_transfer.mutable_sender();
|
||||
receiver_pubkey = outbound_transfer.mutable_receiver();
|
||||
return validate(sender, receiver_pubkey);
|
||||
}
|
||||
|
||||
return TRANSACTION_VALID_CODE_ERROR;
|
||||
}
|
||||
|
||||
TransactionValidation TransactionTransfer::validate(proto::gradido::TransferAmount* sender, std::string* receiver_pubkey)
|
||||
{
|
||||
assert(sender && receiver_pubkey);
|
||||
|
||||
static const char function_name[] = "TransactionTransfer::validate";
|
||||
auto amount = sender->amount();
|
||||
if (0 == amount) {
|
||||
addError(new Error(function_name, "amount is empty"));
|
||||
return TRANSACTION_VALID_INVALID_AMOUNT;
|
||||
@ -141,15 +172,56 @@ namespace model {
|
||||
addError(new Error(function_name, "negative amount"));
|
||||
return TRANSACTION_VALID_INVALID_AMOUNT;
|
||||
}
|
||||
if (mProtoTransfer.local().receiver().size() != KeyPairEd25519::getPublicKeySize()) {
|
||||
if (receiver_pubkey->size() != KeyPairEd25519::getPublicKeySize()) {
|
||||
addError(new Error(function_name, "invalid size of receiver pubkey"));
|
||||
return TRANSCATION_VALID_INVALID_PUBKEY;
|
||||
}
|
||||
if (mProtoTransfer.local().sender().pubkey().size() != KeyPairEd25519::getPublicKeySize()) {
|
||||
if (sender->pubkey().size() != KeyPairEd25519::getPublicKeySize()) {
|
||||
addError(new Error(function_name, "invalid size of sender pubkey"));
|
||||
return TRANSCATION_VALID_INVALID_PUBKEY;
|
||||
}
|
||||
return TRANSACTION_VALID_OK;
|
||||
}
|
||||
|
||||
std::string TransactionTransfer::getTargetGroupAlias()
|
||||
{
|
||||
Poco::ScopedLock<Poco::Mutex> _lock(mWorkMutex);
|
||||
if (mProtoTransfer.has_local()) {
|
||||
return "";
|
||||
}
|
||||
else if (mProtoTransfer.has_inbound()) {
|
||||
auto inbound_transfer = mProtoTransfer.inbound();
|
||||
return inbound_transfer.other_group();
|
||||
}
|
||||
else if (mProtoTransfer.has_outbound()) {
|
||||
auto outbound_transfer = mProtoTransfer.outbound();
|
||||
return outbound_transfer.other_group();
|
||||
}
|
||||
}
|
||||
|
||||
Poco::AutoPtr<Transaction> TransactionTransfer::createOutbound(const std::string& memo)
|
||||
{
|
||||
const char* function_name = "TransactionTransfer::createOutbound";
|
||||
auto mm = MemoryManager::getInstance();
|
||||
if (!mProtoTransfer.has_inbound()) {
|
||||
return nullptr;
|
||||
}
|
||||
// Poco::AutoPtr<controller::User> sender, const MemoryBin* receiverPubkey, Poco::AutoPtr<controller::Group> receiverGroup, Poco::UInt32 amount, const std::string& memo
|
||||
//Transaction::createTransfer()
|
||||
auto inbound = mProtoTransfer.inbound();
|
||||
auto sender = controller::User::create();
|
||||
if (1 != sender->load((const unsigned char*)inbound.sender().pubkey().data())) {
|
||||
return nullptr;
|
||||
}
|
||||
auto receiver_pubkey = mm->getFreeMemory(inbound.receiver().size());
|
||||
memcpy(*receiver_pubkey, inbound.receiver().data(), inbound.receiver().size());
|
||||
auto groups = controller::Group::load(inbound.other_group());
|
||||
if (1 != groups.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
auto transaction = Transaction::createTransfer(sender, receiver_pubkey, groups[0], inbound.sender().amount(), memo, false);
|
||||
mm->releaseMemory(receiver_pubkey);
|
||||
return transaction[0];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#pragma warning(disable:4800)
|
||||
|
||||
#include "TransactionBase.h"
|
||||
//#include "Transaction.h"
|
||||
#include "../proto/gradido/GradidoTransfer.pb.h"
|
||||
|
||||
#include "../controller/User.h"
|
||||
@ -19,6 +20,8 @@
|
||||
namespace model {
|
||||
namespace gradido {
|
||||
|
||||
class Transaction;
|
||||
|
||||
class TransactionTransfer : public TransactionBase
|
||||
{
|
||||
public:
|
||||
@ -32,11 +35,18 @@ namespace model {
|
||||
const std::string& getKontoNameCell(int index);
|
||||
const std::string& getAmountCell(int index);
|
||||
|
||||
std::string getTargetGroupAlias();
|
||||
bool isInbound() { return mProtoTransfer.has_inbound(); }
|
||||
Poco::AutoPtr<Transaction> createOutbound(const std::string& memo);
|
||||
|
||||
void transactionAccepted(Poco::AutoPtr<controller::User> user);
|
||||
|
||||
protected:
|
||||
const static std::string mInvalidIndexMessage;
|
||||
|
||||
int prepare(proto::gradido::TransferAmount* sender, std::string* receiver_pubkey);
|
||||
TransactionValidation validate(proto::gradido::TransferAmount* sender, std::string* receiver_pubkey);
|
||||
|
||||
struct KontoTableEntry
|
||||
{
|
||||
public:
|
||||
|
||||
@ -142,9 +142,11 @@ namespace model
|
||||
|
||||
select << "SELECT id FROM " << getTableName()
|
||||
<< " WHERE user_id = ? "
|
||||
<< " AND hedera_id = ? "
|
||||
<< " AND request = ?"
|
||||
<< " AND TIMESTAMPDIFF(SECOND, created, ?) = 0 "
|
||||
<< " AND task_type_id = ? "
|
||||
, into(mID), use(mUserId), use(mCreated), use(mTaskTypeId);
|
||||
, into(mID), use(mUserId), use(mHederaId), use(mRequest), use(mCreated), use(mTaskTypeId);
|
||||
|
||||
return select;
|
||||
}
|
||||
|
||||
@ -339,6 +339,9 @@ enum PageState {
|
||||
<div class="content-row content-row-bg">
|
||||
<% } %>
|
||||
<%= transferTransaction->getKontoNameCell(i) %>
|
||||
<% if(((i+1) % 2) == 0 && transferTransaction->getTargetGroupAlias() != "") { %>
|
||||
(<%= transferTransaction->getTargetGroupAlias() %>)
|
||||
<% } %>
|
||||
<%= transferTransaction->getAmountCell(i) %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
if(!form.empty()) {
|
||||
|
||||
caller_uri = form.get("caller_uri", "");
|
||||
printf("form.get: caller_uri: %s\n", caller_uri.data());
|
||||
//printf("form.get: caller_uri: %s\n", caller_uri.data());
|
||||
|
||||
bool langUpdatedByBtn = false;
|
||||
auto langBtn = form.get("lang", "");
|
||||
@ -93,11 +93,11 @@
|
||||
langCatalog = mSession->getLanguageCatalog();
|
||||
*/
|
||||
|
||||
if(mSession) {
|
||||
/*if(mSession) {
|
||||
printf("start with session: %d\n", mSession->getHandle());
|
||||
} else {
|
||||
printf("start without session\n");
|
||||
}
|
||||
}*/
|
||||
|
||||
if(!mSession) {
|
||||
mSession = sm->getNewSession();
|
||||
@ -124,7 +124,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
printf("after session: caller_uri: %s\n", caller_uri.data());
|
||||
//printf("after session: caller_uri: %s\n", caller_uri.data());
|
||||
|
||||
|
||||
if(email != "" && password != "") {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user