-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOrders.cpp
43 lines (34 loc) · 1.08 KB
/
Orders.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <fstream>
#include "../include/route4me.h"
#define KEY "11111111111111111111111111111111"
using namespace std;
int main()
{
// global init
CRoute4Me::init();
CRoute4Me route(KEY);
const char *route_id = "CA902292134DBC134EAF8363426BD247";
ifstream inf("add_order_data.json");
if(!inf.is_open())
{
cout << "cannot find a file with addresses" << endl;
return -1;
}
Json::Value body;
inf >> body;
int ret = route.add_order(body);
if (ret == 0)
cout << "Order added: " << Json::FastWriter().write(route.get_json_resp()) << endl;
else
cout << "Error adding order: " << Json::FastWriter().write(route.get_json_resp()) << endl;
Json::Value orders;
orders.append("1247");
orders.append("1248");
ret = route.remove_order(1, orders);
if (ret == 0)
cout << "Order removed: " << Json::FastWriter().write(route.get_json_resp()) << endl;
else
cout << "Error removing order: " << Json::FastWriter().write(route.get_json_resp()) << endl;
CRoute4Me::cleanup();
}