7
7
import com .amirshiati .androidwoocommercesdk .enums .CategoryManagerType ;
8
8
import com .amirshiati .androidwoocommercesdk .enums .OrderManageType ;
9
9
import com .amirshiati .androidwoocommercesdk .enums .ProductManagerType ;
10
- import com .amirshiati .androidwoocommercesdk .helper . ProductJsonConverter ;
10
+ import com .amirshiati .androidwoocommercesdk .handler . OrderHandler ;
11
11
import com .amirshiati .androidwoocommercesdk .helper .UriBuilder ;
12
+ import com .amirshiati .androidwoocommercesdk .helper .UriBuilderSingleton ;
12
13
import 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 ;
23
16
24
17
public class WooSDK {
25
18
@@ -31,6 +24,7 @@ public class WooSDK {
31
24
private int timeOut = 10000 ;
32
25
33
26
private Volley volley ;
27
+ private UriBuilderSingleton uriBuilderSingleton ;
34
28
35
29
public WooSDK (Context context , String ckKey , String csKey , String domainName ) {
36
30
this .context = context ;
@@ -39,6 +33,7 @@ public WooSDK(Context context, String ckKey, String csKey, String domainName) {
39
33
this .domainName = domainName ;
40
34
41
35
volley = new Volley (context , ckKey , csKey , timeOut );
36
+ uriBuilderSingleton = UriBuilderSingleton .getInstance (domainName );
42
37
}
43
38
44
39
public ProductManager getProducts () {
@@ -65,12 +60,14 @@ public AttributeManager getAttributes(long attributeId) {
65
60
return new AttributeManager (UriBuilder .getAttribute (domainName , attributeId ), AttributeManagerType .GETATTRIBUTE , volley );
66
61
}
67
62
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 );
70
66
}
71
67
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 );
74
71
}
75
72
76
73
}
0 commit comments