77import com .amirshiati .androidwoocommercesdk .enums .CategoryManagerType ;
88import com .amirshiati .androidwoocommercesdk .enums .OrderManageType ;
99import com .amirshiati .androidwoocommercesdk .enums .ProductManagerType ;
10- import com .amirshiati .androidwoocommercesdk .helper . ProductJsonConverter ;
10+ import com .amirshiati .androidwoocommercesdk .handler . OrderHandler ;
1111import com .amirshiati .androidwoocommercesdk .helper .UriBuilder ;
12+ import com .amirshiati .androidwoocommercesdk .helper .UriBuilderSingleton ;
1213import com .amirshiati .androidwoocommercesdk .helper .Volley ;
13- import com .amirshiati .androidwoocommercesdk .interfaces .OnGetJsonArrayFinished ;
14- import com .amirshiati .androidwoocommercesdk .interfaces .OnGetProductsFinished ;
15- import com .amirshiati .androidwoocommercesdk .model .Product ;
16- import com .android .volley .Request ;
17- import com .android .volley .VolleyError ;
18-
19- import org .json .JSONArray ;
20-
21- import java .io .UnsupportedEncodingException ;
22- import java .util .ArrayList ;
14+ import com .amirshiati .androidwoocommercesdk .interfaces .OnResponse ;
15+ import com .amirshiati .androidwoocommercesdk .interfaces .ParamBuilder ;
2316
2417public class WooSDK {
2518
@@ -31,6 +24,7 @@ public class WooSDK {
3124 private int timeOut = 10000 ;
3225
3326 private Volley volley ;
27+ private UriBuilderSingleton uriBuilderSingleton ;
3428
3529 public WooSDK (Context context , String ckKey , String csKey , String domainName ) {
3630 this .context = context ;
@@ -39,6 +33,7 @@ public WooSDK(Context context, String ckKey, String csKey, String domainName) {
3933 this .domainName = domainName ;
4034
4135 volley = new Volley (context , ckKey , csKey , timeOut );
36+ uriBuilderSingleton = UriBuilderSingleton .getInstance (domainName );
4237 }
4338
4439 public ProductManager getProducts () {
@@ -65,12 +60,14 @@ public AttributeManager getAttributes(long attributeId) {
6560 return new AttributeManager (UriBuilder .getAttribute (domainName , attributeId ), AttributeManagerType .GETATTRIBUTE , volley );
6661 }
6762
68- public OrderManager getOrders () {
69- return new OrderManager (UriBuilder .getOrders (domainName ), OrderManageType .GETORDERS , volley );
63+ public void getOrder (long id , OnResponse onResponse ) {
64+ OrderHandler orderHandler = new OrderHandler (uriBuilderSingleton , volley );
65+ orderHandler .get (id , onResponse );
7066 }
7167
72- public OrderManager getOrder (long orderId ) {
73- return new OrderManager (UriBuilder .getOrder (domainName , orderId ), OrderManageType .GETORDER , volley );
68+ public void getOrders (ParamBuilder paramBuilder , OnResponse onResponse ) {
69+ OrderHandler orderHandler = new OrderHandler (uriBuilderSingleton , volley );
70+ orderHandler .getList (paramBuilder , onResponse );
7471 }
7572
7673}
0 commit comments