二期c++接口

Dependencies:   EthernetInterface mbed-rtos mbed uniqueCPUID

Fork of bcsdk by Heng Well

Order.cpp

Committer:
MrAI
Date:
2018-06-08
Revision:
17:82d09b5a9189
Parent:
12:1b24ea479a59

File content as of revision 17:82d09b5a9189:

#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;
}