negative
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user