-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAddOrder.cpp
40 lines (32 loc) · 960 Bytes
/
AddOrder.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
#include <iostream>
#include <fstream>
#include "../include/route4me.h"
#define KEY "11111111111111111111111111111111"
using namespace std;
int main()
{
ifstream inf("add_order_to_route_data.json");
if(!inf.is_open())
{
cout << "cannot find a file with addresses" << endl;
return -1;
}
// global init
CRoute4Me::init();
CRoute4Me route(KEY);
const char *route_id = "CA902292134DBC134EAF8363426BD247";
if(route.get_route_by_id(route_id) == 0)
{
cout << "Route " << route_id << " info by ID:" << endl << Json::FastWriter().write(route.get_json_resp()) << endl;
Json::Value order;
inf >> order;
int ret = route.add_order_to_route(route_id, order);
if (ret == 0)
cout << "Order added to route" << route_id << endl;
else
cout << "Error adding order" << endl;
}
// global cleanup
CRoute4Me::cleanup();
return 0;
}