blockchain , sdchain cpp sdk and demo

Dependencies:   EthernetInterface mbed-rtos mbed uniqueCPUID

Fork of bcsdk by SDchain C Plus Plus Team

Order.cpp

Committer:
webmaster
Date:
2018-08-08
Revision:
18:ec6cd7cfe3f8
Parent:
12:1b24ea479a59

File content as of revision 18:ec6cd7cfe3f8:

#include "Order.h"
bool Order::SetJsonBody(MbedJSONValue& out, string secretIn, string typeIn, string currencypayIn, string cntpartypayIn, string valuepayIn, string currencygetIn, string cntpartygetIn, string valuegetIn)
{
	MbedJSONValue val;
	val["secret"] = secretIn;
	val["order"]["type"] = typeIn;
	val["order"]["taker_pays"]["currency"] = currencypayIn;
	val["order"]["taker_pays"]["counterparty"] = cntpartypayIn;
	val["order"]["taker_pays"]["value"] = valuepayIn;
	val["order"]["taker_gets"]["currency"] = currencygetIn;
	val["order"]["taker_gets"]["counterparty"] = cntpartygetIn;
	val["order"]["taker_gets"]["value"] = valuegetIn;
	out = val;
	return true;
}

string Order::PostOrder(MbedJSONValue& in, string sUrl, string sAddr, string sequence)
{
	string strRep = "";
	string strUrl = sUrl + sAddr + sequence;
	string strJson = in.serialize();
	client.http_post_delete(strUrl, strJson, strRep);
	string content = client.get_content(strRep);
	return content;
}