diff --git a/musen.woocommerce.iml b/musen.woocommerce.iml
new file mode 100644
index 0000000..68d54a6
--- /dev/null
+++ b/musen.woocommerce.iml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 2e0f22c..99bd633 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,17 @@
+
+
+
+
+
+
+
+
+ ]>
@@ -45,6 +58,12 @@
1.4.9
+
+
+ com.google.code.gson
+ gson
+ 2.6
+
diff --git a/src/main/java/musen/woocommerce/Client.java b/src/main/java/com/g360/woocommerce/client/Client.java
similarity index 89%
rename from src/main/java/musen/woocommerce/Client.java
rename to src/main/java/com/g360/woocommerce/client/Client.java
index 350a0b1..d600f42 100644
--- a/src/main/java/musen/woocommerce/Client.java
+++ b/src/main/java/com/g360/woocommerce/client/Client.java
@@ -1,16 +1,13 @@
-package musen.woocommerce;
+package com.g360.woocommerce.client;
import com.mashape.unirest.http.exceptions.UnirestException;
-import musen.woocommerce.httpclient.HttpClient;
-import musen.woocommerce.httpclient.Options;
+import com.g360.woocommerce.client.httpclient.HttpClient;
+import com.g360.woocommerce.client.httpclient.Options;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
-/**
- * Created by Muluneh on 8/15/2016.
- */
public class Client {
public static final String VERSION = "1.0.0";
diff --git a/src/main/java/com/g360/woocommerce/client/WooCommerceClient.java b/src/main/java/com/g360/woocommerce/client/WooCommerceClient.java
new file mode 100644
index 0000000..0038b47
--- /dev/null
+++ b/src/main/java/com/g360/woocommerce/client/WooCommerceClient.java
@@ -0,0 +1,86 @@
+package com.g360.woocommerce.client;
+
+import com.g360.woocommerce.client.domain.order.Order;
+import com.g360.woocommerce.client.domain.order.OrdersContainer;
+import com.g360.woocommerce.client.domain.product.Product;
+import com.g360.woocommerce.client.domain.product.ProductsContainer;
+import com.g360.woocommerce.client.httpclient.Options;
+import com.google.gson.Gson;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class WooCommerceClient {
+
+ private static final String PRODUCTS_END_POINT = "products";
+ private static final String ORDERS_END_POINT = "orders";
+ private Client client;
+ private Gson gson;
+
+ public static void main(String[] args) {
+ WooCommerceClient wooCommerceClient = new WooCommerceClient();
+ System.out.println(wooCommerceClient.getProducts());
+ }
+
+ public WooCommerceClient() {
+ HashMap arguments = new HashMap();
+ Options options = new Options(arguments);
+ gson = new Gson();
+
+ client = new Client(
+ "http://localhost/lomistore",
+ "ck_a8f3dd9e2a73caaaf7b6dd3131d46fae70e6b462",
+ "cs_84924f2f2f58bb0df2d4ad0ed58967865eeb30ca",
+ options
+ );
+ }
+
+ public List getOrders() {
+
+ List orders = new ArrayList();
+
+ String jsonString = "";
+
+ try {
+
+ jsonString = this.client.get(ORDERS_END_POINT);
+
+ OrdersContainer ordersContainer = gson.fromJson(jsonString, OrdersContainer.class);
+
+ orders = ordersContainer.getOrders();
+
+ } catch(Exception e) {
+
+ System.out.println("Error getting orders");
+
+ System.out.println(e.getMessage());
+ }
+
+ return orders;
+ }
+
+ public List getProducts() {
+
+ List products = new ArrayList();
+
+ String jsonString = "";
+
+ try {
+
+ jsonString = this.client.get(PRODUCTS_END_POINT);
+
+ ProductsContainer productsContainer = gson.fromJson(jsonString, ProductsContainer.class);
+
+ products = productsContainer.getProducts();
+
+ } catch(Exception e) {
+
+ System.out.println("Error getting products");
+
+ System.out.println(e.getMessage());
+ }
+
+ return products;
+ }
+}
diff --git a/src/main/java/com/g360/woocommerce/client/domain/custom/Book.java b/src/main/java/com/g360/woocommerce/client/domain/custom/Book.java
new file mode 100644
index 0000000..2582c50
--- /dev/null
+++ b/src/main/java/com/g360/woocommerce/client/domain/custom/Book.java
@@ -0,0 +1,83 @@
+package com.g360.woocommerce.client.domain.custom;
+
+import com.g360.woocommerce.client.domain.product.Download;
+import com.g360.woocommerce.client.domain.product.Product;
+import com.google.gson.Gson;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Date;
+
+public class Book extends Product {
+
+ public String getBookTitle() {
+ return this.getTitle();
+ }
+
+ public String getBookPreview() {
+ return this.getDescription();
+ }
+
+ public String getBookDownloadLink() {
+ // validate payment
+ Download download = this.getDownloads().get(0);
+ return download.getFile();
+ }
+
+ public List getBookSearchResults() {
+ List books = new ArrayList();
+ books.add(new Book());
+
+ return books;
+ }
+
+ public static List getAllBooks() {
+ List books = new ArrayList();
+ books.add(new Book());
+
+ return books;
+ }
+
+ public static List getBooksByCategory() {
+ List books = new ArrayList();
+ books.add(new Book());
+
+ return books;
+ }
+
+ public static List getFeaturedBooks() {
+ List books = new ArrayList();
+ books.add(new Book());
+
+ return books;
+ }
+
+ public static List getPopularBooks() {
+ List books = new ArrayList();
+ books.add(new Book());
+
+ return books;
+ }
+
+ public static List getRecommendedBooks() {
+ List books = new ArrayList();
+ books.add(new Book());
+
+ return books;
+ }
+
+ public static List getLomiMonthSelectBooks() {
+ List books = new ArrayList();
+ books.add(new Book());
+
+ return books;
+ }
+
+ public static List getTopSellerBooks() {
+ List books = new ArrayList();
+ books.add(new Book());
+
+ return books;
+ }
+}
diff --git a/src/main/java/com/g360/woocommerce/client/domain/order/BillingAddress.java b/src/main/java/com/g360/woocommerce/client/domain/order/BillingAddress.java
new file mode 100644
index 0000000..5e162e9
--- /dev/null
+++ b/src/main/java/com/g360/woocommerce/client/domain/order/BillingAddress.java
@@ -0,0 +1,242 @@
+package com.g360.woocommerce.client.domain.order;
+
+import javax.annotation.Generated;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+@Generated("org.jsonschema2pojo")
+public class BillingAddress {
+
+ @SerializedName("first_name")
+ @Expose
+ private String firstName;
+ @SerializedName("last_name")
+ @Expose
+ private String lastName;
+ @SerializedName("company")
+ @Expose
+ private String company;
+ @SerializedName("address_1")
+ @Expose
+ private String address1;
+ @SerializedName("address_2")
+ @Expose
+ private String address2;
+ @SerializedName("city")
+ @Expose
+ private String city;
+ @SerializedName("state")
+ @Expose
+ private String state;
+ @SerializedName("postcode")
+ @Expose
+ private String postcode;
+ @SerializedName("country")
+ @Expose
+ private String country;
+ @SerializedName("email")
+ @Expose
+ private String email;
+ @SerializedName("phone")
+ @Expose
+ private String phone;
+
+ /**
+ *
+ * @return
+ * The firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ *
+ * @param firstName
+ * The first_name
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ *
+ * @return
+ * The lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ *
+ * @param lastName
+ * The last_name
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ *
+ * @return
+ * The company
+ */
+ public String getCompany() {
+ return company;
+ }
+
+ /**
+ *
+ * @param company
+ * The company
+ */
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ /**
+ *
+ * @return
+ * The address1
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ *
+ * @param address1
+ * The address_1
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ *
+ * @return
+ * The address2
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ *
+ * @param address2
+ * The address_2
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ *
+ * @return
+ * The city
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ *
+ * @param city
+ * The city
+ */
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ /**
+ *
+ * @return
+ * The state
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ *
+ * @param state
+ * The state
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ /**
+ *
+ * @return
+ * The postcode
+ */
+ public String getPostcode() {
+ return postcode;
+ }
+
+ /**
+ *
+ * @param postcode
+ * The postcode
+ */
+ public void setPostcode(String postcode) {
+ this.postcode = postcode;
+ }
+
+ /**
+ *
+ * @return
+ * The country
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /**
+ *
+ * @param country
+ * The country
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /**
+ *
+ * @return
+ * The email
+ */
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ *
+ * @param email
+ * The email
+ */
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ /**
+ *
+ * @return
+ * The phone
+ */
+ public String getPhone() {
+ return phone;
+ }
+
+ /**
+ *
+ * @param phone
+ * The phone
+ */
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/g360/woocommerce/client/domain/order/BillingAddress_.java b/src/main/java/com/g360/woocommerce/client/domain/order/BillingAddress_.java
new file mode 100644
index 0000000..ed32de5
--- /dev/null
+++ b/src/main/java/com/g360/woocommerce/client/domain/order/BillingAddress_.java
@@ -0,0 +1,242 @@
+package com.g360.woocommerce.client.domain.order;
+
+import javax.annotation.Generated;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+@Generated("org.jsonschema2pojo")
+public class BillingAddress_ {
+
+ @SerializedName("first_name")
+ @Expose
+ private String firstName;
+ @SerializedName("last_name")
+ @Expose
+ private String lastName;
+ @SerializedName("company")
+ @Expose
+ private String company;
+ @SerializedName("address_1")
+ @Expose
+ private String address1;
+ @SerializedName("address_2")
+ @Expose
+ private String address2;
+ @SerializedName("city")
+ @Expose
+ private String city;
+ @SerializedName("state")
+ @Expose
+ private String state;
+ @SerializedName("postcode")
+ @Expose
+ private String postcode;
+ @SerializedName("country")
+ @Expose
+ private String country;
+ @SerializedName("email")
+ @Expose
+ private String email;
+ @SerializedName("phone")
+ @Expose
+ private String phone;
+
+ /**
+ *
+ * @return
+ * The firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ *
+ * @param firstName
+ * The first_name
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ *
+ * @return
+ * The lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ *
+ * @param lastName
+ * The last_name
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ *
+ * @return
+ * The company
+ */
+ public String getCompany() {
+ return company;
+ }
+
+ /**
+ *
+ * @param company
+ * The company
+ */
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ /**
+ *
+ * @return
+ * The address1
+ */
+ public String getAddress1() {
+ return address1;
+ }
+
+ /**
+ *
+ * @param address1
+ * The address_1
+ */
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ /**
+ *
+ * @return
+ * The address2
+ */
+ public String getAddress2() {
+ return address2;
+ }
+
+ /**
+ *
+ * @param address2
+ * The address_2
+ */
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ /**
+ *
+ * @return
+ * The city
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ *
+ * @param city
+ * The city
+ */
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ /**
+ *
+ * @return
+ * The state
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ *
+ * @param state
+ * The state
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ /**
+ *
+ * @return
+ * The postcode
+ */
+ public String getPostcode() {
+ return postcode;
+ }
+
+ /**
+ *
+ * @param postcode
+ * The postcode
+ */
+ public void setPostcode(String postcode) {
+ this.postcode = postcode;
+ }
+
+ /**
+ *
+ * @return
+ * The country
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /**
+ *
+ * @param country
+ * The country
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /**
+ *
+ * @return
+ * The email
+ */
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ *
+ * @param email
+ * The email
+ */
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ /**
+ *
+ * @return
+ * The phone
+ */
+ public String getPhone() {
+ return phone;
+ }
+
+ /**
+ *
+ * @param phone
+ * The phone
+ */
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/g360/woocommerce/client/domain/order/Customer.java b/src/main/java/com/g360/woocommerce/client/domain/order/Customer.java
new file mode 100644
index 0000000..af7cd54
--- /dev/null
+++ b/src/main/java/com/g360/woocommerce/client/domain/order/Customer.java
@@ -0,0 +1,137 @@
+package com.g360.woocommerce.client.domain.order;
+
+import javax.annotation.Generated;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+@Generated("org.jsonschema2pojo")
+public class Customer {
+
+ @SerializedName("id")
+ @Expose
+ private Integer id;
+ @SerializedName("email")
+ @Expose
+ private String email;
+ @SerializedName("first_name")
+ @Expose
+ private String firstName;
+ @SerializedName("last_name")
+ @Expose
+ private String lastName;
+ @SerializedName("billing_address")
+ @Expose
+ private BillingAddress_ billingAddress;
+ @SerializedName("shipping_address")
+ @Expose
+ private ShippingAddress_ shippingAddress;
+
+ /**
+ *
+ * @return
+ * The id
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ *
+ * @param id
+ * The id
+ */
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ * @return
+ * The email
+ */
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ *
+ * @param email
+ * The email
+ */
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ /**
+ *
+ * @return
+ * The firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ *
+ * @param firstName
+ * The first_name
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ *
+ * @return
+ * The lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ *
+ * @param lastName
+ * The last_name
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ *
+ * @return
+ * The billingAddress
+ */
+ public BillingAddress_ getBillingAddress() {
+ return billingAddress;
+ }
+
+ /**
+ *
+ * @param billingAddress
+ * The billing_address
+ */
+ public void setBillingAddress(BillingAddress_ billingAddress) {
+ this.billingAddress = billingAddress;
+ }
+
+ /**
+ *
+ * @return
+ * The shippingAddress
+ */
+ public ShippingAddress_ getShippingAddress() {
+ return shippingAddress;
+ }
+
+ /**
+ *
+ * @param shippingAddress
+ * The shipping_address
+ */
+ public void setShippingAddress(ShippingAddress_ shippingAddress) {
+ this.shippingAddress = shippingAddress;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/g360/woocommerce/client/domain/order/Order.java b/src/main/java/com/g360/woocommerce/client/domain/order/Order.java
new file mode 100644
index 0000000..c60f710
--- /dev/null
+++ b/src/main/java/com/g360/woocommerce/client/domain/order/Order.java
@@ -0,0 +1,685 @@
+package com.g360.woocommerce.client.domain.order;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Generated;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+@Generated("org.jsonschema2pojo")
+public class Order {
+
+ @SerializedName("id")
+ @Expose
+ private Integer id;
+ @SerializedName("order_number")
+ @Expose
+ private Integer orderNumber;
+ @SerializedName("order_key")
+ @Expose
+ private String orderKey;
+ @SerializedName("created_at")
+ @Expose
+ private String createdAt;
+ @SerializedName("updated_at")
+ @Expose
+ private String updatedAt;
+ @SerializedName("completed_at")
+ @Expose
+ private String completedAt;
+ @SerializedName("status")
+ @Expose
+ private String status;
+ @SerializedName("currency")
+ @Expose
+ private String currency;
+ @SerializedName("total")
+ @Expose
+ private String total;
+ @SerializedName("subtotal")
+ @Expose
+ private String subtotal;
+ @SerializedName("total_line_items_quantity")
+ @Expose
+ private Integer totalLineItemsQuantity;
+ @SerializedName("total_tax")
+ @Expose
+ private String totalTax;
+ @SerializedName("total_shipping")
+ @Expose
+ private String totalShipping;
+ @SerializedName("cart_tax")
+ @Expose
+ private String cartTax;
+ @SerializedName("shipping_tax")
+ @Expose
+ private String shippingTax;
+ @SerializedName("total_discount")
+ @Expose
+ private String totalDiscount;
+ @SerializedName("shipping_methods")
+ @Expose
+ private String shippingMethods;
+ @SerializedName("payment_details")
+ @Expose
+ private PaymentDetails paymentDetails;
+ @SerializedName("billing_address")
+ @Expose
+ private BillingAddress billingAddress;
+ @SerializedName("shipping_address")
+ @Expose
+ private ShippingAddress shippingAddress;
+ @SerializedName("note")
+ @Expose
+ private String note;
+ @SerializedName("customer_ip")
+ @Expose
+ private String customerIp;
+ @SerializedName("customer_user_agent")
+ @Expose
+ private String customerUserAgent;
+ @SerializedName("customer_id")
+ @Expose
+ private Integer customerId;
+ @SerializedName("view_order_url")
+ @Expose
+ private String viewOrderUrl;
+ @SerializedName("line_items")
+ @Expose
+ private List