1// Create a Map to store all the data of a Customer
2Map<String, Object> customerMap = new Map<String, Object>();
3 customerMap.put('CompanyName','Breadwinner Inc');
4 customerMap.put('DisplayName','Breadwinner Inc');
5 customerMap.put('PrimaryPhone' , new Map<String, Object>{'FreeFormNumber' => '9988543562'});
6 customerMap.put('Active',true);
7
8 Map<String, Object> billingAddrFieldMap = new Map<String, Object>();
9 billingAddrFieldMap.put('City' , 'Suryapet');
10 billingAddrFieldMap.put('Country' , 'India');
11 billingAddrFieldMap.put('Line3' , 'Kodad');
12 billingAddrFieldMap.put('Line2' , 'First Lane');
13 billingAddrFieldMap.put('Line1' , '1-24');
14 billingAddrFieldMap.put('PostalCode' , '508238');
15 billingAddrFieldMap.put('CountrySubDivisionCode' , '');
16
17 customerMap.put('BillAddr' , billingAddrFieldMap);
18
19 Map<String, Object> shippingAddrFieldMap = new Map<String, Object>();
20 shippingAddrFieldMap.put('City' , 'Hyderabad');
21 shippingAddrFieldMap.put('Country' , 'India');
22 shippingAddrFieldMap.put('Line3' , '');
23 shippingAddrFieldMap.put('Line2' , 'Srinagar Colony');
24 shippingAddrFieldMap.put('Line1' , '1/78-24');
25 shippingAddrFieldMap.put('PostalCode' , '500008');
26 shippingAddrFieldMap.put('CountrySubDivisionCode' , '');
27
28 customerMap.put('ShipAddr' , shippingAddrFieldMap);
29
30// Initializing the RequestJSON Data to be passed.
31Map<String, Object> requestJSONMap = new Map<String, Object>();
32 requestJSONMap.put('customers', new List<Object>{customerMap});
33 String reqJSON = JSON.serialize(requestJSONMap);
34
35Map<String, Object> reqObj = new Map<String, Object>();
36 reqObj.put('version', '1.0');
37 reqObj.put('action', 'createCustomer');
38 reqObj.put('requestJSON', reqJSON);
39 //Required, if QuickBooks Multi-Org is enabled in Breadwinner.
40 reqObj.put('qbOrgId', '4620816365285051610');
41
42// Placing a request to Breadwinner Global API
43Map<String, Object> respMap = breadwinner_qbo.BreadwinnerQBAPI.call(reqObj);
44System.debug(respMap);