This commit is contained in:
Vladimir N. Korotenko
2025-11-15 19:29:32 +03:00
parent 3544a61089
commit 4bb7533e11

View File

@@ -361,7 +361,55 @@ int Deals::Cancel() {
return 0; return 0;
} }
int Deals::Negative() { return 0; } int Deals::Negative() {
string data = CommonStatus();
string result = ExecCommand(data.c_str());
if (result.length() == 0)
return NoResponse("");
nlohmann::json jsonData = nlohmann::json::parse(result);
nlohmann::json deal = jsonData["deal"];
string message;
string sign;
if (parser.cmdOptionExists("-m") || parser.cmdOptionExists("--message"))
{
message = GetVal("-m", "--message");
}
if (parser.cmdOptionExists("-s") || parser.cmdOptionExists("--signature"))
{
sign = GetVal("-s", "--signature");
}
deal["seller"]["signature"] = sign;
deal["feedback"]["comments"] = message;
string jsf = deal.dump();
jsf = ReplaceAll(jsf, "\"", "\\\"");
data = "curl -X POST \"";
data.append(address);
data.append("/api/v1/deal/feedback\" -H \"Content-Type: application/json\" ");
data.append("-d \"");
data.append(jsf);
data.append("\"");
result = ExecCommand(data.c_str());
if (result.length() == 0)
return NoResponse("");
std::ostringstream stream;
stream << "success: " << jsonData["result"]["success"] << endl;
stream << "message: " << jsonData["result"]["message"] << endl;
string decoded = stream.str();
std::cout << decoded << endl;
if (isDebug)
ShowDebug(data, decoded, 0, result);
return 0;
}
string Deals::GetVal(const string first, const string second) string Deals::GetVal(const string first, const string second)
{ {