added cart abstraction
This commit is contained in:
parent
47e5575417
commit
6591cf8f95
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@ -9,6 +9,7 @@
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/core" />
|
||||
<option value="$PROJECT_DIR$/firebasecart" />
|
||||
<option value="$PROJECT_DIR$/woodroid" />
|
||||
</set>
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.21'
|
||||
|
||||
ext.kotlin_version = '1.3.31'
|
||||
ext.kotlin_version = '1.3.31'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.0-alpha08'
|
||||
@ -24,7 +22,7 @@ allprojects {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url 'https://jitpack.io' }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
core/.gitignore
vendored
Normal file
1
core/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
34
core/build.gradle
Normal file
34
core/build.gradle
Normal file
@ -0,0 +1,34 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
}
|
||||
21
core/proguard-rules.pro
vendored
Normal file
21
core/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,24 @@
|
||||
package me.gilo.woodroid.core
|
||||
|
||||
import android.support.test.InstrumentationRegistry
|
||||
import android.support.test.runner.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("me.gilo.woodroid.core.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
2
core/src/main/AndroidManifest.xml
Normal file
2
core/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="me.gilo.woodroid.core"/>
|
||||
@ -0,0 +1,5 @@
|
||||
package me.gilo.woodroid.core.cart
|
||||
|
||||
class CartFilter(var cart_item_key: String) {
|
||||
var quantity: Int = 0
|
||||
}
|
||||
13
core/src/main/java/me/gilo/woodroid/core/cart/CartItem.kt
Normal file
13
core/src/main/java/me/gilo/woodroid/core/cart/CartItem.kt
Normal file
@ -0,0 +1,13 @@
|
||||
package me.gilo.woodroid.core.cart
|
||||
|
||||
import me.gilo.woodroid.models.Product
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
* Created by gilo on 2/18/16.
|
||||
*/
|
||||
class CartItem {
|
||||
lateinit var product: Product
|
||||
lateinit var options: ArrayList<Option>
|
||||
var qty: Int = 0
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package me.gilo.woodroid.core.cart
|
||||
|
||||
import android.arch.lifecycle.LiveData
|
||||
import me.gilo.woodroid.models.LineItem
|
||||
|
||||
|
||||
abstract class CartRepository{
|
||||
|
||||
abstract fun clear(): LiveData<String>
|
||||
abstract fun count(id: Int): LiveData<Int>
|
||||
abstract fun cart(): LiveData<List<LineItem>>
|
||||
abstract fun addToCart(lineItem: LineItem): LiveData<LineItem>
|
||||
abstract fun delete(cartId: String): LiveData<String>
|
||||
abstract fun restore(cartId: String): LiveData<String>
|
||||
abstract fun update(cartId: String, quantity: Int): LiveData<LineItem>
|
||||
|
||||
}
|
||||
5
core/src/main/java/me/gilo/woodroid/core/cart/Option.kt
Normal file
5
core/src/main/java/me/gilo/woodroid/core/cart/Option.kt
Normal file
@ -0,0 +1,5 @@
|
||||
package me.gilo.woodroid.core.cart
|
||||
|
||||
class Option {
|
||||
var size: Array<String>? = null
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import android.os.Parcel
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
class AttributeTerm : Serializable {
|
||||
var id: Int = 0
|
||||
var name: String? = null
|
||||
var slug: String? = null
|
||||
lateinit var description: String
|
||||
var menu_order: Int = 0
|
||||
var count: Int = 0
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class BillingAddress : Serializable {
|
||||
var id: Int = 0
|
||||
@SerializedName("first_name")
|
||||
lateinit var firstName: String
|
||||
@SerializedName("last_name")
|
||||
lateinit var lastName: String
|
||||
lateinit var company: String
|
||||
@SerializedName("address_1")
|
||||
lateinit var address1: String
|
||||
@SerializedName("address_2")
|
||||
lateinit var address2: String
|
||||
lateinit var city: String
|
||||
lateinit var state: String
|
||||
lateinit var postcode: String
|
||||
lateinit var country: String
|
||||
lateinit var email: String
|
||||
lateinit var phone: String
|
||||
|
||||
override fun toString(): String {
|
||||
return (firstName + " " + lastName + "\n"
|
||||
+ address1 + " " + address2 + "\n"
|
||||
+ city + ", " + state + " " + postcode + "\n"
|
||||
+ country + "\n"
|
||||
+ phone)
|
||||
}
|
||||
}
|
||||
15
core/src/main/java/me/gilo/woodroid/core/models/Category.kt
Normal file
15
core/src/main/java/me/gilo/woodroid/core/models/Category.kt
Normal file
@ -0,0 +1,15 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Category : Serializable {
|
||||
var id: Int = 0
|
||||
var name: String? = null
|
||||
var slug: String? = null
|
||||
var parent: Int = 0
|
||||
lateinit var description: String
|
||||
lateinit var display: String
|
||||
lateinit var image: Image
|
||||
var menu_order: Int = 0
|
||||
var count: Int = 0
|
||||
}
|
||||
34
core/src/main/java/me/gilo/woodroid/core/models/Coupon.kt
Normal file
34
core/src/main/java/me/gilo/woodroid/core/models/Coupon.kt
Normal file
@ -0,0 +1,34 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Coupon : Serializable {
|
||||
|
||||
var usage_limit: Int = 0
|
||||
var code: String? = null
|
||||
var free_shipping: String? = null
|
||||
var description: String? = null
|
||||
var minimum_amount: String? = null
|
||||
var email_restrictions: Array<String>? = null
|
||||
var exclude_sale_items: String? = null
|
||||
var excluded_product_ids: Array<String>? = null
|
||||
var usage_count: String? = null
|
||||
var individual_use: String? = null
|
||||
var usage_limit_per_user: Int = 0
|
||||
var limit_usage_to_x_items: Int = 0
|
||||
var meta_data: Array<String>? = null
|
||||
var id: Int = 0
|
||||
var date_modified_gmt: String? = null
|
||||
var amount: String? = null
|
||||
var date_created: String? = null
|
||||
var date_created_gmt: String? = null
|
||||
var maximum_amount: String? = null
|
||||
var discount_type: String? = null
|
||||
var used_by: Array<String>? = null
|
||||
var date_modified: String? = null
|
||||
var product_ids: Array<String>? = null
|
||||
var product_categories: Array<String>? = null
|
||||
var date_expires: String? = null
|
||||
var excluded_product_categories: Array<String>? = null
|
||||
var date_expires_gmt: String? = null
|
||||
}
|
||||
48
core/src/main/java/me/gilo/woodroid/core/models/Customer.kt
Normal file
48
core/src/main/java/me/gilo/woodroid/core/models/Customer.kt
Normal file
@ -0,0 +1,48 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
class Customer : Serializable {
|
||||
var id: Int = 0
|
||||
|
||||
@SerializedName("created_at")
|
||||
lateinit var createdAt: String
|
||||
|
||||
lateinit var email: String
|
||||
|
||||
@SerializedName("first_name")
|
||||
lateinit var firstName: String
|
||||
|
||||
@SerializedName("last_name")
|
||||
lateinit var lastName: String
|
||||
|
||||
lateinit var username: String
|
||||
lateinit var password: String
|
||||
lateinit var role: String
|
||||
|
||||
@SerializedName("last_order_id")
|
||||
lateinit var lastOrderId: String
|
||||
|
||||
@SerializedName("last_order_date")
|
||||
lateinit var lastOrderDate: String
|
||||
|
||||
@SerializedName("orders_count")
|
||||
var ordersCount: Int = 0
|
||||
|
||||
@SerializedName("total_spent")
|
||||
lateinit var totalSpent: String
|
||||
|
||||
@SerializedName("avatar_url")
|
||||
lateinit var avatarUrl: String
|
||||
|
||||
@SerializedName("billing")
|
||||
lateinit var billingAddress: BillingAddress
|
||||
|
||||
@SerializedName("shipping")
|
||||
lateinit var shippingAddress: ShippingAddress
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
import java.io.Serializable
|
||||
import java.util.ArrayList
|
||||
|
||||
|
||||
class CustomerPost : Serializable {
|
||||
@SerializedName("data")
|
||||
lateinit var datas: ArrayList<Data>
|
||||
}
|
||||
5
core/src/main/java/me/gilo/woodroid/core/models/Data.kt
Normal file
5
core/src/main/java/me/gilo/woodroid/core/models/Data.kt
Normal file
@ -0,0 +1,5 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class Data {
|
||||
lateinit var customer: Customer
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import android.os.Parcel
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class DefaultAttribute : Serializable {
|
||||
var id: Int = 0
|
||||
lateinit var name: String
|
||||
lateinit var option: String
|
||||
}
|
||||
22
core/src/main/java/me/gilo/woodroid/core/models/Dimension.kt
Normal file
22
core/src/main/java/me/gilo/woodroid/core/models/Dimension.kt
Normal file
@ -0,0 +1,22 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import android.os.Parcel
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
class Dimension protected constructor(`in`: Parcel) : Serializable {
|
||||
|
||||
var length: String? = null
|
||||
var width: String? = null
|
||||
var height: String? = null
|
||||
var unit: String? = null
|
||||
|
||||
init {
|
||||
length = `in`.readString()
|
||||
width = `in`.readString()
|
||||
height = `in`.readString()
|
||||
unit = `in`.readString()
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Download : Serializable {
|
||||
lateinit var id: String
|
||||
lateinit var name: String
|
||||
lateinit var file: String
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
|
||||
class FeeLine
|
||||
18
core/src/main/java/me/gilo/woodroid/core/models/Image.kt
Normal file
18
core/src/main/java/me/gilo/woodroid/core/models/Image.kt
Normal file
@ -0,0 +1,18 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import android.os.Parcel
|
||||
|
||||
import java.io.Serializable
|
||||
import java.util.Date
|
||||
|
||||
class Image : Serializable {
|
||||
var id: Int = 0
|
||||
var date_created: String? = null
|
||||
var date_created_gmt: String? = null
|
||||
var date_modified: String? = null
|
||||
var date_modified_gmt: String? = null
|
||||
var src: String? = null
|
||||
var name: String? = null
|
||||
var alt: String? = null
|
||||
var position: Int = 0
|
||||
}
|
||||
26
core/src/main/java/me/gilo/woodroid/core/models/LineItem.kt
Normal file
26
core/src/main/java/me/gilo/woodroid/core/models/LineItem.kt
Normal file
@ -0,0 +1,26 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
|
||||
class LineItem {
|
||||
|
||||
lateinit var subtotal: String
|
||||
@SerializedName("subtotal_tax")
|
||||
lateinit var subtotalTax: String
|
||||
lateinit var total: String
|
||||
lateinit var totalTax: String
|
||||
lateinit var price: String
|
||||
var quantity: Int = 0
|
||||
lateinit var taxClass: Any
|
||||
lateinit var name: String
|
||||
|
||||
@SerializedName("product_id")
|
||||
var productId: Int = 0
|
||||
|
||||
lateinit var sku: String
|
||||
lateinit var variations: String
|
||||
var meta: List<Metum> = ArrayList()
|
||||
}
|
||||
25
core/src/main/java/me/gilo/woodroid/core/models/Meta.kt
Normal file
25
core/src/main/java/me/gilo/woodroid/core/models/Meta.kt
Normal file
@ -0,0 +1,25 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
/**
|
||||
* Created by gilo on 1/19/16.
|
||||
*/
|
||||
class Meta {
|
||||
|
||||
var thousand_separator: String? = null
|
||||
var decimal_separator: String? = null
|
||||
var currency_position: String? = null
|
||||
var weight_unit: String? = null
|
||||
var currency: String? = null
|
||||
var timezone: String? = null
|
||||
var isGenerate_password: Boolean = false
|
||||
var price_num_decimals: Int = 0
|
||||
var isTax_included: Boolean = false
|
||||
var isSsl_enabled: Boolean = false
|
||||
var isPermalinks_enabled: Boolean = false
|
||||
var dimension_unit: String? = null
|
||||
var currency_format: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "ClassPojo [thousand_separator = $thousand_separator, decimal_separator = $decimal_separator, currency_position = $currency_position, weight_unit = $weight_unit, currency = $currency, timezone = $timezone, generate_password = $isGenerate_password, price_num_decimals = $price_num_decimals, tax_included = $isTax_included, ssl_enabled = $isSsl_enabled, permalinks_enabled = $isPermalinks_enabled, dimension_unit = $dimension_unit, currency_format = $currency_format]"
|
||||
}
|
||||
}
|
||||
10
core/src/main/java/me/gilo/woodroid/core/models/Metadata.kt
Normal file
10
core/src/main/java/me/gilo/woodroid/core/models/Metadata.kt
Normal file
@ -0,0 +1,10 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Metadata : Serializable {
|
||||
var id: Int = 0
|
||||
lateinit var key: String
|
||||
|
||||
|
||||
}
|
||||
8
core/src/main/java/me/gilo/woodroid/core/models/Metum.kt
Normal file
8
core/src/main/java/me/gilo/woodroid/core/models/Metum.kt
Normal file
@ -0,0 +1,8 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
|
||||
class Metum {
|
||||
var key: String? = null
|
||||
var label: String? = null
|
||||
var value: String? = null
|
||||
}
|
||||
73
core/src/main/java/me/gilo/woodroid/core/models/Order.kt
Normal file
73
core/src/main/java/me/gilo/woodroid/core/models/Order.kt
Normal file
@ -0,0 +1,73 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.Date
|
||||
|
||||
|
||||
class Order {
|
||||
var id: Int = 0
|
||||
@SerializedName("number")
|
||||
lateinit var orderNumber: String
|
||||
@SerializedName("created_at")
|
||||
lateinit var createdAt: String
|
||||
|
||||
@SerializedName("date_created")
|
||||
lateinit var dateCreated: Date
|
||||
|
||||
@SerializedName("updated_at")
|
||||
lateinit var updatedAt: String
|
||||
@SerializedName("completed_at")
|
||||
lateinit var completedAt: String
|
||||
lateinit var status: String
|
||||
lateinit var currency: String
|
||||
lateinit var total: String
|
||||
lateinit var subtotal: String
|
||||
@SerializedName("total_line_items_quantity")
|
||||
var totalLineItemsQuantity: Int = 0
|
||||
@SerializedName("total_tax")
|
||||
lateinit var totalTax: String
|
||||
@SerializedName("total_shipping")
|
||||
lateinit var totalShipping: String
|
||||
@SerializedName("cart_tax")
|
||||
lateinit var cartTax: String
|
||||
@SerializedName("shipping_tax")
|
||||
lateinit var shippingTax: String
|
||||
@SerializedName("total_discount")
|
||||
lateinit var totalDiscount: String
|
||||
@SerializedName("shipping_methods")
|
||||
lateinit var shippingMethods: String
|
||||
@SerializedName("payment_details")
|
||||
lateinit var paymentDetails: PaymentDetails
|
||||
@SerializedName("billing")
|
||||
lateinit var billingAddress: BillingAddress
|
||||
@SerializedName("shipping")
|
||||
lateinit var shippingAddress: ShippingAddress
|
||||
lateinit var note: String
|
||||
@SerializedName("customer_ip")
|
||||
lateinit var customerIp: String
|
||||
@SerializedName("customer_user_agent")
|
||||
lateinit var customerUserAgent: String
|
||||
@SerializedName("customer_id")
|
||||
var customerId: Int? = null
|
||||
@SerializedName("view_order_url")
|
||||
lateinit var viewOrderUrl: String
|
||||
@SerializedName("line_items")
|
||||
var lineItems: MutableList<LineItem> = ArrayList()
|
||||
@SerializedName("shipping_lines")
|
||||
var shippingLines: List<ShippingLine> = ArrayList()
|
||||
@SerializedName("tax_lines")
|
||||
var taxLines: List<TaxLine> = ArrayList()
|
||||
@SerializedName("fee_lines")
|
||||
var feeLines: List<FeeLine> = ArrayList()
|
||||
@SerializedName("coupon_lines")
|
||||
var couponLines: List<Any> = ArrayList()
|
||||
lateinit var customer: Customer
|
||||
|
||||
|
||||
fun addLineItem(lineItem: LineItem) {
|
||||
lineItems.add(lineItem)
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class OrderData {
|
||||
lateinit var order: Order
|
||||
}
|
||||
15
core/src/main/java/me/gilo/woodroid/core/models/OrderNote.kt
Normal file
15
core/src/main/java/me/gilo/woodroid/core/models/OrderNote.kt
Normal file
@ -0,0 +1,15 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
|
||||
class OrderNote {
|
||||
var id: Int = 0
|
||||
lateinit var author: String
|
||||
lateinit var date_created: String
|
||||
lateinit var date_created_gmt: String
|
||||
lateinit var note: String
|
||||
var isCustomer_note: Boolean = false
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
|
||||
class PaymentDetails {
|
||||
@SerializedName("method_id")
|
||||
lateinit var methodId: String
|
||||
@SerializedName("method_title")
|
||||
lateinit var methodTitle: String
|
||||
var paid: Boolean? = null
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class PaymentGateway {
|
||||
|
||||
lateinit var id: String
|
||||
lateinit var title: String
|
||||
lateinit var description: String
|
||||
var order: Int = 0
|
||||
var isEnabled: Boolean = false
|
||||
lateinit var method_title: String
|
||||
lateinit var method_description: String
|
||||
lateinit var method_supports: Array<String>
|
||||
lateinit var settings: Map<String, PaymentGatewaySetting>
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
class PaymentGatewaySetting {
|
||||
|
||||
lateinit var id: String
|
||||
lateinit var label: String
|
||||
lateinit var description: String
|
||||
lateinit var type: String
|
||||
lateinit var value: String
|
||||
@JsonProperty("default")
|
||||
lateinit var default_value: String
|
||||
lateinit var tip: String
|
||||
lateinit var placeholder: String
|
||||
}
|
||||
73
core/src/main/java/me/gilo/woodroid/core/models/Product.kt
Normal file
73
core/src/main/java/me/gilo/woodroid/core/models/Product.kt
Normal file
@ -0,0 +1,73 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.io.Serializable
|
||||
import java.util.ArrayList
|
||||
import java.util.Date
|
||||
|
||||
|
||||
class Product : Serializable {
|
||||
|
||||
var id: Int = 0
|
||||
lateinit var name: String
|
||||
var slug: String? = null
|
||||
var permalink: String? = null
|
||||
var type: String? = null
|
||||
lateinit var status: String
|
||||
var isFeatured: Boolean = false
|
||||
lateinit var catalog_visibility: String
|
||||
lateinit var description: String
|
||||
lateinit var short_description: String
|
||||
lateinit var sku: String
|
||||
lateinit var price: String
|
||||
lateinit var regular_price: String
|
||||
lateinit var sale_price: String
|
||||
lateinit var date_on_sale_from: Date
|
||||
lateinit var date_on_sale_from_gmt: Date
|
||||
lateinit var date_on_sale_to: Date
|
||||
lateinit var date_on_sale_to_gmt: Date
|
||||
lateinit var price_html: String
|
||||
var isOn_sale: Boolean = false
|
||||
var isPurchasable: Boolean = false
|
||||
var total_sales: Int = 0
|
||||
var isVirtual: Boolean = false
|
||||
var isDownloadable: Boolean = false
|
||||
lateinit var downloads: ArrayList<Download>
|
||||
var download_limit: Int = 0
|
||||
var download_expiry: Int = 0
|
||||
lateinit var external_url: String
|
||||
lateinit var button_text: String
|
||||
lateinit var tax_status: String
|
||||
lateinit var tax_class: String
|
||||
var isManage_stock: Boolean = false
|
||||
var stock_quantity: Int = 0
|
||||
var isIn_stock: Boolean = false
|
||||
lateinit var backorders: String
|
||||
var isBackorders_allowed: Boolean = false
|
||||
var isBackordered: Boolean = false
|
||||
var isSold_individually: Boolean = false
|
||||
lateinit var weight: String
|
||||
lateinit var dimensions: Any
|
||||
var isShipping_required: Boolean = false
|
||||
var isShipping_taxable: Boolean = false
|
||||
lateinit var shipping_class: String
|
||||
var shipping_class_id: Int = 0
|
||||
var isReviews_allowed: Boolean = false
|
||||
lateinit var average_rating: String
|
||||
var rating_count: Int = 0
|
||||
lateinit var related_ids: ArrayList<Int>
|
||||
lateinit var upsell_ids: ArrayList<Int>
|
||||
lateinit var cross_sell_ids: ArrayList<Int>
|
||||
var parent_id: Int = 0
|
||||
lateinit var purchase_note: String
|
||||
lateinit var categories: ArrayList<Category>
|
||||
lateinit var tags: ArrayList<Tag>
|
||||
lateinit var productAttributes: ArrayList<ProductAttribute>
|
||||
lateinit var default_attributes: ArrayList<DefaultAttribute>
|
||||
lateinit var variations: ArrayList<Int>
|
||||
lateinit var grouped_products: ArrayList<Int>
|
||||
var menu_order: Int = 0
|
||||
lateinit var meta_data: ArrayList<Metadata>
|
||||
lateinit var images: ArrayList<Image>
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ package me.gilo.woodroid.models
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Attribute : Serializable {
|
||||
class ProductAttribute : Serializable {
|
||||
var id: Int = 0
|
||||
var name: String? = null
|
||||
var slug: String? = null
|
||||
@ -0,0 +1,20 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.io.Serializable
|
||||
import java.util.Date
|
||||
|
||||
|
||||
class ProductReview : Serializable {
|
||||
var id: Int = 0
|
||||
var date_created: Date? = null
|
||||
var date_created_gmt: Date? = null
|
||||
var product_id: Int = 0
|
||||
lateinit var reviewer: String
|
||||
lateinit var reviewer_email: String
|
||||
|
||||
lateinit var reviewer_avatar_urls: Map<String, String>
|
||||
|
||||
var review: String? = null
|
||||
var rating: Int = 0
|
||||
var isVerified: Boolean = false
|
||||
}
|
||||
17
core/src/main/java/me/gilo/woodroid/core/models/Refund.kt
Normal file
17
core/src/main/java/me/gilo/woodroid/core/models/Refund.kt
Normal file
@ -0,0 +1,17 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class Refund {
|
||||
|
||||
var refunded_by: String? = null
|
||||
var reason: String? = null
|
||||
var amount: String? = null
|
||||
var date_created: String? = null
|
||||
var meta_data: Array<Metadata>? = null
|
||||
var date_created_gmt: String? = null
|
||||
var id: String? = null
|
||||
var line_items: Array<LineItem>? = null
|
||||
var refunded_payment: String? = null
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class SettingGroup {
|
||||
|
||||
internal var id: String? = null
|
||||
internal var label: String? = null
|
||||
internal var description: String? = null
|
||||
internal var parent_id: String? = null
|
||||
internal var sub_groups: List<String>? = null
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
class SettingOption {
|
||||
|
||||
lateinit var id: String
|
||||
lateinit var label: String
|
||||
lateinit var description: String
|
||||
lateinit var value: String
|
||||
|
||||
@JsonProperty("default")
|
||||
lateinit var default_value: String
|
||||
lateinit var tip: String
|
||||
lateinit var placeholder: String
|
||||
lateinit var type: String
|
||||
lateinit var options: Map<String, String>
|
||||
lateinit var group_id: String
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class ShippingAddress {
|
||||
var id: Int = 0
|
||||
@SerializedName("first_name")
|
||||
lateinit var firstName: String
|
||||
@SerializedName("last_name")
|
||||
lateinit var lastName: String
|
||||
lateinit var company: String
|
||||
@SerializedName("address_1")
|
||||
lateinit var address1: String
|
||||
@SerializedName("address_2")
|
||||
lateinit var address2: String
|
||||
lateinit var city: String
|
||||
lateinit var state: String
|
||||
lateinit var postcode: String
|
||||
lateinit var country: String
|
||||
|
||||
override fun toString(): String {
|
||||
return (firstName + " " + lastName + "\n" +
|
||||
address1 + " " + address2 + "\n"
|
||||
+ city + ", " + state + " " + postcode + "\n"
|
||||
+ country)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class ShippingClass {
|
||||
var id: Int = 0
|
||||
lateinit var name: String
|
||||
lateinit var slug: String
|
||||
lateinit var description: String
|
||||
var count: Int = 0
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
|
||||
class ShippingLine {
|
||||
@SerializedName("method_id")
|
||||
var id: String? = null
|
||||
@SerializedName("method_title")
|
||||
var methodTitle: String? = null
|
||||
var total: Int = 0
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
|
||||
class ShippingMethod {
|
||||
var id: String? = null
|
||||
var title: String? = null
|
||||
var descriptioon: String? = null
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class ShippingZone {
|
||||
var id: Int = 0
|
||||
var name: String? = null
|
||||
var order: Int = 0
|
||||
}
|
||||
20
core/src/main/java/me/gilo/woodroid/core/models/Store.kt
Normal file
20
core/src/main/java/me/gilo/woodroid/core/models/Store.kt
Normal file
@ -0,0 +1,20 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
/**
|
||||
* Created by gilo on 1/19/16.
|
||||
*/
|
||||
class Store {
|
||||
|
||||
var wc_version: String? = null
|
||||
var description: String? = null
|
||||
var name: String? = null
|
||||
var url: String? = null
|
||||
var meta: Meta? = null
|
||||
|
||||
var version: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "ClassPojo [wc_version = $wc_version, description = $description, name = $name, URL = $url, meta = $meta, version = $version]"
|
||||
}
|
||||
|
||||
}
|
||||
9
core/src/main/java/me/gilo/woodroid/core/models/Tag.kt
Normal file
9
core/src/main/java/me/gilo/woodroid/core/models/Tag.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Tag : Serializable {
|
||||
var id: Int = 0
|
||||
var name: String? = null
|
||||
var slug: String? = null
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class TaxClass {
|
||||
lateinit var slug: String
|
||||
lateinit var name: String
|
||||
}
|
||||
11
core/src/main/java/me/gilo/woodroid/core/models/TaxLine.kt
Normal file
11
core/src/main/java/me/gilo/woodroid/core/models/TaxLine.kt
Normal file
@ -0,0 +1,11 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
|
||||
class TaxLine {
|
||||
var id: Int = 0
|
||||
var rate_id: Int = 0
|
||||
var code: String? = null
|
||||
var title: String? = null
|
||||
var total: Double = 0.toDouble()
|
||||
var isCompound: Boolean = false
|
||||
}
|
||||
15
core/src/main/java/me/gilo/woodroid/core/models/TaxRate.kt
Normal file
15
core/src/main/java/me/gilo/woodroid/core/models/TaxRate.kt
Normal file
@ -0,0 +1,15 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class TaxRate {
|
||||
var id: Int = 0
|
||||
var country: String? = null
|
||||
var city: String? = null
|
||||
var postcode: String? = null
|
||||
var priority: Int = 0
|
||||
var isCompound: Boolean = false
|
||||
var isShipping: Boolean = false
|
||||
var rate: String? = null
|
||||
var name: String? = null
|
||||
var state: String? = null
|
||||
var order: Int = 0
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class TopSellers {
|
||||
var title: String? = null
|
||||
var product_id: Int = 0
|
||||
var quantity: Int = 0
|
||||
}
|
||||
86
core/src/main/java/me/gilo/woodroid/core/models/Variation.kt
Normal file
86
core/src/main/java/me/gilo/woodroid/core/models/Variation.kt
Normal file
@ -0,0 +1,86 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.Date
|
||||
|
||||
class Variation {
|
||||
|
||||
var id: Int = 0
|
||||
internal lateinit var title: String
|
||||
internal lateinit var name: String
|
||||
lateinit var slug: String
|
||||
lateinit var permalink: String
|
||||
lateinit var type: String
|
||||
lateinit var status: String
|
||||
var isFeatured: Boolean = false
|
||||
lateinit var catalog_visibility: String
|
||||
lateinit var description: String
|
||||
lateinit var short_description: String
|
||||
lateinit var sku: String
|
||||
lateinit var price: String
|
||||
lateinit var regular_price: String
|
||||
lateinit var sale_price: String
|
||||
lateinit var date_on_sale_from: Date
|
||||
lateinit var date_on_sale_from_gmt: Date
|
||||
lateinit var date_on_sale_to: Date
|
||||
lateinit var date_on_sale_to_gmt: Date
|
||||
lateinit var price_html: String
|
||||
var isOn_sale: Boolean = false
|
||||
var isPurchasable: Boolean = false
|
||||
var total_sales: Int = 0
|
||||
var isVirtual: Boolean = false
|
||||
var isDownloadable: Boolean = false
|
||||
lateinit var downloads: ArrayList<Download>
|
||||
var download_limit: Int = 0
|
||||
var download_expiry: Int = 0
|
||||
lateinit var external_url: String
|
||||
lateinit var button_text: String
|
||||
lateinit var tax_status: String
|
||||
lateinit var tax_class: String
|
||||
var isManage_stock: Boolean = false
|
||||
var stock_quantity: Int = 0
|
||||
var isIn_stock: Boolean = false
|
||||
lateinit var backorders: String
|
||||
var isBackorders_allowed: Boolean = false
|
||||
var isBackordered: Boolean = false
|
||||
var isSold_individually: Boolean = false
|
||||
lateinit var weight: String
|
||||
lateinit var dimensions: Any
|
||||
var isShipping_required: Boolean = false
|
||||
var isShipping_taxable: Boolean = false
|
||||
lateinit var shipping_class: String
|
||||
var shipping_class_id: Int = 0
|
||||
var isReviews_allowed: Boolean = false
|
||||
lateinit var average_rating: String
|
||||
var rating_count: Int = 0
|
||||
lateinit var related_ids: ArrayList<Int>
|
||||
lateinit var upsell_ids: ArrayList<Int>
|
||||
lateinit var cross_sell_ids: ArrayList<Int>
|
||||
var parent_id: Int = 0
|
||||
lateinit var purchase_note: String
|
||||
lateinit var categories: ArrayList<Category>
|
||||
lateinit var tags: ArrayList<Tag>
|
||||
lateinit var productAttributes: ArrayList<ProductAttribute>
|
||||
lateinit var default_attributes: ArrayList<DefaultAttribute>
|
||||
lateinit var grouped_products: ArrayList<Int>
|
||||
var menu_order: Int = 0
|
||||
lateinit var meta_data: ArrayList<Metadata>
|
||||
lateinit var images: ArrayList<Image>
|
||||
|
||||
fun getTitle(): String {
|
||||
return name
|
||||
}
|
||||
|
||||
fun setTitle(title: String) {
|
||||
this.title = title
|
||||
}
|
||||
|
||||
fun getName(): String {
|
||||
return name
|
||||
}
|
||||
|
||||
fun setName(name: String) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
}
|
||||
19
core/src/main/java/me/gilo/woodroid/core/models/Webhook.kt
Normal file
19
core/src/main/java/me/gilo/woodroid/core/models/Webhook.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.util.Date
|
||||
|
||||
class Webhook {
|
||||
var id: Int = 0
|
||||
lateinit var name: String
|
||||
lateinit var status: String
|
||||
lateinit var topic: String
|
||||
lateinit var resource: String
|
||||
lateinit var event: String
|
||||
lateinit var hooks: Array<String>
|
||||
lateinit var delivery_url: String
|
||||
lateinit var secret: String
|
||||
lateinit var date_created: Date
|
||||
lateinit var date_created_gmt: Date
|
||||
lateinit var date_modified: Date
|
||||
lateinit var date_modified_gmt: Date
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
import java.util.Date
|
||||
|
||||
class WebhookDelivery {
|
||||
|
||||
var id: Int = 0
|
||||
lateinit var duration: String
|
||||
lateinit var summary: String
|
||||
lateinit var request_url: String
|
||||
lateinit var request_headers: Map<String, String>
|
||||
lateinit var request_body: String
|
||||
lateinit var response_code: String
|
||||
lateinit var response_message: String
|
||||
lateinit var response_headers: Map<String, String>
|
||||
lateinit var response_body: String
|
||||
lateinit var date_created: Date
|
||||
lateinit var date_created_gmt: Date
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class CouponFilter : ListFilter() {
|
||||
|
||||
internal lateinit var code: String
|
||||
|
||||
fun getCode(): String {
|
||||
return code
|
||||
}
|
||||
|
||||
fun setCode(code: String) {
|
||||
this.code = code
|
||||
addFilter("code", code)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class CustomerFilter : ListFilter() {
|
||||
|
||||
private lateinit var email: String
|
||||
private lateinit var role: String
|
||||
|
||||
//all, administrator, editor, author, contributor, subscriber, customer and shop_manager
|
||||
|
||||
fun getEmail(): String {
|
||||
return email
|
||||
}
|
||||
|
||||
fun setEmail(email: String) {
|
||||
this.email = email
|
||||
addFilter("email", email)
|
||||
}
|
||||
|
||||
fun getRole(): String {
|
||||
return role
|
||||
}
|
||||
|
||||
fun setRole(role: String) {
|
||||
this.role = role
|
||||
addFilter("role", role)
|
||||
}
|
||||
|
||||
fun setRole(role: Role) {
|
||||
this.role = role.toString()
|
||||
addFilter("role", role.toString())
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
open class Filter {
|
||||
|
||||
internal lateinit var context: String
|
||||
|
||||
internal var filters: MutableMap<String, String> = HashMap()
|
||||
|
||||
fun getContext(): String {
|
||||
return context
|
||||
}
|
||||
|
||||
fun setContext(context: String) {
|
||||
this.context = context
|
||||
|
||||
addFilter("context", context)
|
||||
}
|
||||
|
||||
fun addFilter(filter: String, value: Any) {
|
||||
filters[filter] = value.toString()
|
||||
}
|
||||
|
||||
fun getFilters(): Map<String, String> {
|
||||
return filters
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,171 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
import me.gilo.woodroid.utils.Converter
|
||||
|
||||
import java.util.*
|
||||
|
||||
open class ListFilter {
|
||||
|
||||
internal lateinit var context: String
|
||||
internal var page: Int = 0
|
||||
internal var per_page: Int = 0
|
||||
internal lateinit var search: String
|
||||
internal lateinit var after: String
|
||||
internal lateinit var before: String
|
||||
internal lateinit var exclude: IntArray
|
||||
internal lateinit var include: IntArray
|
||||
internal var offset: Int = 0
|
||||
internal lateinit var order: String
|
||||
internal lateinit var orderby: String
|
||||
|
||||
|
||||
internal var filters: MutableMap<String, String> = HashMap()
|
||||
|
||||
fun getContext(): String {
|
||||
return context
|
||||
}
|
||||
|
||||
fun setContext(context: String) {
|
||||
this.context = context
|
||||
|
||||
addFilter("context", context)
|
||||
}
|
||||
|
||||
fun getPage(): Int {
|
||||
return page
|
||||
}
|
||||
|
||||
fun setPage(page: Int) {
|
||||
this.page = page
|
||||
|
||||
addFilter("page", page)
|
||||
}
|
||||
|
||||
fun getPer_page(): Int {
|
||||
return per_page
|
||||
}
|
||||
|
||||
fun setPer_page(per_page: Int) {
|
||||
this.per_page = per_page
|
||||
|
||||
addFilter("per_page", per_page)
|
||||
}
|
||||
|
||||
fun getSearch(): String {
|
||||
return search
|
||||
}
|
||||
|
||||
fun setSearch(search: String) {
|
||||
this.search = search
|
||||
|
||||
addFilter("search", search)
|
||||
}
|
||||
|
||||
fun getAfter(): String {
|
||||
return after
|
||||
}
|
||||
|
||||
fun setAfter(after: String) {
|
||||
this.after = after
|
||||
|
||||
addFilter("after", after)
|
||||
}
|
||||
|
||||
fun getBefore(): String {
|
||||
return before
|
||||
}
|
||||
|
||||
fun setAfter(date: Date) {
|
||||
setAfter(Converter.getDateString(date))
|
||||
}
|
||||
|
||||
fun setBefore(date: Date) {
|
||||
setBefore(Converter.getDateString(date))
|
||||
}
|
||||
|
||||
fun setBefore(before: String) {
|
||||
this.before = before
|
||||
|
||||
addFilter("before", before)
|
||||
}
|
||||
|
||||
fun getExclude(): IntArray {
|
||||
return exclude
|
||||
}
|
||||
|
||||
fun setExclude(exclude: IntArray) {
|
||||
this.exclude = exclude
|
||||
|
||||
addFilter("exclude", exclude)
|
||||
}
|
||||
|
||||
fun getInclude(): IntArray {
|
||||
return include
|
||||
}
|
||||
|
||||
fun setInclude(include: IntArray) {
|
||||
this.include = include
|
||||
|
||||
addFilter("include", include)
|
||||
}
|
||||
|
||||
fun getOffset(): Int {
|
||||
return offset
|
||||
}
|
||||
|
||||
fun setOffset(offset: Int) {
|
||||
this.offset = offset
|
||||
|
||||
addFilter("offset", offset)
|
||||
}
|
||||
|
||||
fun getOrder(): String {
|
||||
return order
|
||||
}
|
||||
|
||||
fun setOrder(order: String) {
|
||||
this.order = order
|
||||
|
||||
addFilter("order", order)
|
||||
}
|
||||
|
||||
fun setOrder(order: Sort) {
|
||||
setOrder(order.toString())
|
||||
}
|
||||
|
||||
fun getOrderby(): String {
|
||||
return orderby
|
||||
}
|
||||
|
||||
fun setOrderby(orderby: String) {
|
||||
this.orderby = orderby
|
||||
|
||||
addFilter("orderby", orderby)
|
||||
}
|
||||
|
||||
fun addFilter(filter: String, value: Any) {
|
||||
if (value.javaClass.isArray) {
|
||||
if (value is IntArray) {
|
||||
var values = ""
|
||||
for (item in value) {
|
||||
values += "$item,"
|
||||
}
|
||||
|
||||
filters[filter] = "" + values.substring(0, values.length - 1)
|
||||
|
||||
} else {
|
||||
val list = Arrays.asList(value)
|
||||
for (item in list) {
|
||||
filters[filter] = item.toString()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
filters[filter] = value.toString()
|
||||
}
|
||||
}
|
||||
|
||||
fun getFilters(): Map<String, String> {
|
||||
return filters
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class OrderFilter : ListFilter() {
|
||||
|
||||
var parent: IntArray? = null
|
||||
set(parent) {
|
||||
field = parent
|
||||
if (parent != null) {
|
||||
addFilter("parent", parent)
|
||||
}
|
||||
}
|
||||
var parent_exclude: IntArray? = null
|
||||
set(parent_exclude) {
|
||||
field = parent_exclude
|
||||
|
||||
if (parent_exclude != null) {
|
||||
addFilter("parent_exclude", parent_exclude)
|
||||
}
|
||||
}
|
||||
|
||||
internal lateinit var status: String
|
||||
|
||||
internal var customer: Int = 0
|
||||
internal var product: Int = 0
|
||||
internal var dp: Int = 0
|
||||
|
||||
fun getStatus(): String {
|
||||
return status
|
||||
}
|
||||
|
||||
fun setStatus(status: String) {
|
||||
this.status = status
|
||||
|
||||
addFilter("status", status)
|
||||
}
|
||||
|
||||
fun getCustomer(): Int {
|
||||
return customer
|
||||
}
|
||||
|
||||
fun setCustomer(customer: Int) {
|
||||
this.customer = customer
|
||||
|
||||
addFilter("customer", customer)
|
||||
}
|
||||
|
||||
fun getProduct(): Int {
|
||||
return product
|
||||
}
|
||||
|
||||
fun setProduct(product: Int) {
|
||||
this.product = product
|
||||
|
||||
addFilter("product", product)
|
||||
}
|
||||
|
||||
fun getDp(): Int {
|
||||
return dp
|
||||
}
|
||||
|
||||
fun setDp(dp: Int) {
|
||||
this.dp = dp
|
||||
addFilter("dp", dp)
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
class OrderNoteFilter : Filter() {
|
||||
|
||||
internal lateinit var type: String
|
||||
|
||||
fun getType(): String {
|
||||
return type
|
||||
}
|
||||
|
||||
fun setType(type: String) {
|
||||
this.type = type
|
||||
|
||||
addFilter("type", type)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
class ProductAttributeFilter {
|
||||
|
||||
internal lateinit var context: String
|
||||
|
||||
internal var filters: MutableMap<String, String> = HashMap()
|
||||
|
||||
fun getContext(): String {
|
||||
return context
|
||||
}
|
||||
|
||||
fun setContext(context: String) {
|
||||
this.context = context
|
||||
|
||||
addFilter("context", context)
|
||||
}
|
||||
|
||||
fun addFilter(filter: String, value: Any) {
|
||||
filters[filter] = value.toString()
|
||||
}
|
||||
|
||||
fun getFilters(): Map<String, String> {
|
||||
return filters
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class ProductAttributeTermFilter : ListFilter() {
|
||||
internal var product: Int = 0
|
||||
internal var hide_empty: Boolean = false
|
||||
internal lateinit var slug: String
|
||||
|
||||
var isHide_empty: Boolean
|
||||
get() = hide_empty
|
||||
set(hide_empty) {
|
||||
this.hide_empty = hide_empty
|
||||
addFilter("hide_empty", hide_empty)
|
||||
}
|
||||
|
||||
fun getProduct(): Int {
|
||||
return product
|
||||
}
|
||||
|
||||
fun setProduct(product: Int) {
|
||||
this.product = product
|
||||
addFilter("product", product)
|
||||
}
|
||||
|
||||
fun getSlug(): String {
|
||||
return slug
|
||||
}
|
||||
|
||||
fun setSlug(slug: String) {
|
||||
this.slug = slug
|
||||
addFilter("slug", slug)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class ProductCategoryFilter : ListFilter() {
|
||||
var parent: IntArray? = null
|
||||
set(parent) {
|
||||
field = parent
|
||||
if (parent != null) {
|
||||
addFilter("parent", parent)
|
||||
}
|
||||
}
|
||||
internal var product: Int = 0
|
||||
internal var hide_empty: Boolean = false
|
||||
internal lateinit var slug: String
|
||||
|
||||
var isHide_empty: Boolean
|
||||
get() = hide_empty
|
||||
set(hide_empty) {
|
||||
this.hide_empty = hide_empty
|
||||
addFilter("hide_empty", hide_empty)
|
||||
}
|
||||
|
||||
fun getProduct(): Int {
|
||||
return product
|
||||
}
|
||||
|
||||
fun setProduct(product: Int) {
|
||||
this.product = product
|
||||
addFilter("product", product)
|
||||
}
|
||||
|
||||
fun getSlug(): String {
|
||||
return slug
|
||||
}
|
||||
|
||||
fun setSlug(slug: String) {
|
||||
this.slug = slug
|
||||
addFilter("slug", slug)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class ProductFilter : ListFilter() {
|
||||
var parent: IntArray? = null
|
||||
set(parent) {
|
||||
field = parent
|
||||
|
||||
if (parent != null) {
|
||||
addFilter("parent", parent)
|
||||
}
|
||||
|
||||
}
|
||||
var parent_exclude: IntArray? = null
|
||||
set(parent_exclude) {
|
||||
field = parent_exclude
|
||||
|
||||
if (parent_exclude != null) {
|
||||
addFilter("parent_exclude", parent_exclude)
|
||||
}
|
||||
|
||||
}
|
||||
var slug: String? = null
|
||||
set(slug) {
|
||||
field = slug
|
||||
|
||||
if (slug != null) {
|
||||
addFilter("slug", slug)
|
||||
}
|
||||
|
||||
}
|
||||
var status: String? = null
|
||||
set(status) {
|
||||
field = status
|
||||
|
||||
if (status != null) {
|
||||
addFilter("status", status)
|
||||
}
|
||||
|
||||
}
|
||||
var type: String? = null
|
||||
set(type) {
|
||||
field = type
|
||||
|
||||
if (type != null) {
|
||||
addFilter("type", type)
|
||||
}
|
||||
}
|
||||
var sku: String? = null
|
||||
set(sku) {
|
||||
field = sku
|
||||
|
||||
if (sku != null) {
|
||||
addFilter("sku", sku)
|
||||
}
|
||||
}
|
||||
var isFeatured: Boolean = false
|
||||
set(featured) {
|
||||
field = featured
|
||||
|
||||
addFilter("featured", featured)
|
||||
}
|
||||
var category: Int = 0
|
||||
set(category) {
|
||||
field = category
|
||||
|
||||
addFilter("category", category)
|
||||
}
|
||||
var tag: String? = null
|
||||
set(tag) {
|
||||
field = tag
|
||||
|
||||
if (tag != null) {
|
||||
addFilter("tag", tag)
|
||||
}
|
||||
}
|
||||
var shipping_class: String? = null
|
||||
set(shipping_class) {
|
||||
field = shipping_class
|
||||
|
||||
if (shipping_class != null) {
|
||||
addFilter("shipping_class", shipping_class)
|
||||
}
|
||||
}
|
||||
var attribute: String? = null
|
||||
set(attribute) {
|
||||
field = attribute
|
||||
|
||||
if (attribute != null) {
|
||||
addFilter("attribute", attribute)
|
||||
}
|
||||
}
|
||||
var attribute_term: String? = null
|
||||
set(attribute_term) {
|
||||
field = attribute_term
|
||||
|
||||
if (attribute_term != null) {
|
||||
addFilter("attribute_term", attribute_term)
|
||||
}
|
||||
}
|
||||
var tax_class: String? = null
|
||||
set(tax_class) {
|
||||
field = tax_class
|
||||
|
||||
if (tax_class != null) {
|
||||
addFilter("tax_class", tax_class)
|
||||
}
|
||||
}
|
||||
var isOn_sale: Boolean = false
|
||||
set(on_sale) {
|
||||
field = on_sale
|
||||
|
||||
addFilter("on_sale", on_sale)
|
||||
}
|
||||
var min_price: String? = null
|
||||
set(min_price) {
|
||||
field = min_price
|
||||
|
||||
if (min_price != null) {
|
||||
addFilter("min_price", min_price)
|
||||
}
|
||||
}
|
||||
var max_price: String? = null
|
||||
set(max_price) {
|
||||
field = max_price
|
||||
|
||||
if (max_price != null) {
|
||||
addFilter("max_price", max_price)
|
||||
}
|
||||
}
|
||||
var stock_status: String? = null
|
||||
set(stock_status) {
|
||||
field = stock_status
|
||||
|
||||
if (stock_status != null) {
|
||||
addFilter("stock_status", stock_status)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class ProductReviewFilter : ListFilter() {
|
||||
|
||||
internal lateinit var reviewer: IntArray
|
||||
internal lateinit var reviewer_exclude: IntArray
|
||||
internal lateinit var reviewer_email: Array<String>
|
||||
|
||||
internal lateinit var product: IntArray
|
||||
internal lateinit var status: String
|
||||
|
||||
fun getReviewer(): IntArray {
|
||||
return reviewer
|
||||
}
|
||||
|
||||
fun setReviewer(reviewer: IntArray) {
|
||||
this.reviewer = reviewer
|
||||
|
||||
addFilter("reviewer", reviewer)
|
||||
}
|
||||
|
||||
fun getReviewer_exclude(): IntArray {
|
||||
return reviewer_exclude
|
||||
}
|
||||
|
||||
fun setReviewer_exclude(reviewer_exclude: IntArray) {
|
||||
this.reviewer_exclude = reviewer_exclude
|
||||
|
||||
addFilter("reviewer_exclude", reviewer_exclude)
|
||||
}
|
||||
|
||||
fun getReviewer_email(): Array<String> {
|
||||
return reviewer_email
|
||||
}
|
||||
|
||||
fun setReviewer_email(reviewer_email: Array<String>) {
|
||||
this.reviewer_email = reviewer_email
|
||||
|
||||
addFilter("reviewer_email", reviewer_email)
|
||||
}
|
||||
|
||||
fun getProduct(): IntArray {
|
||||
return product
|
||||
}
|
||||
|
||||
fun setProduct(product: IntArray) {
|
||||
this.product = product
|
||||
|
||||
addFilter("product", product)
|
||||
}
|
||||
|
||||
fun getStatus(): String {
|
||||
return status
|
||||
}
|
||||
|
||||
fun setStatus(status: String) {
|
||||
this.status = status
|
||||
|
||||
addFilter("status", status)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class ProductTagFilter : ListFilter() {
|
||||
|
||||
internal var product: Int = 0
|
||||
internal var hide_empty: Boolean = false
|
||||
internal lateinit var slug: String
|
||||
|
||||
var isHide_empty: Boolean
|
||||
get() = hide_empty
|
||||
set(hide_empty) {
|
||||
this.hide_empty = hide_empty
|
||||
addFilter("hide_empty", hide_empty)
|
||||
}
|
||||
|
||||
|
||||
fun getProduct(): Int {
|
||||
return product
|
||||
}
|
||||
|
||||
fun setProduct(product: Int) {
|
||||
this.product = product
|
||||
addFilter("product", product)
|
||||
}
|
||||
|
||||
fun getSlug(): String {
|
||||
return slug
|
||||
}
|
||||
|
||||
fun setSlug(slug: String) {
|
||||
this.slug = slug
|
||||
addFilter("slug", slug)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,140 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class ProductVariationFilter : ListFilter() {
|
||||
var parent: IntArray? = null
|
||||
set(parent) {
|
||||
field = parent
|
||||
|
||||
if (parent != null) {
|
||||
addFilter("parent", parent)
|
||||
}
|
||||
|
||||
}
|
||||
var parent_exclude: IntArray? = null
|
||||
set(parent_exclude) {
|
||||
field = parent_exclude
|
||||
|
||||
if (parent_exclude != null) {
|
||||
addFilter("parent_exclude", parent_exclude)
|
||||
}
|
||||
|
||||
}
|
||||
var slug: String? = null
|
||||
set(slug) {
|
||||
field = slug
|
||||
|
||||
if (slug != null) {
|
||||
addFilter("slug", slug)
|
||||
}
|
||||
|
||||
}
|
||||
var status: String? = null
|
||||
set(status) {
|
||||
field = status
|
||||
|
||||
if (status != null) {
|
||||
addFilter("status", status)
|
||||
}
|
||||
|
||||
}
|
||||
var type: String? = null
|
||||
set(type) {
|
||||
field = type
|
||||
|
||||
if (type != null) {
|
||||
addFilter("type", type)
|
||||
}
|
||||
}
|
||||
var sku: String? = null
|
||||
set(sku) {
|
||||
field = sku
|
||||
|
||||
if (sku != null) {
|
||||
addFilter("sku", sku)
|
||||
}
|
||||
}
|
||||
var isFeatured: Boolean = false
|
||||
set(featured) {
|
||||
field = featured
|
||||
|
||||
addFilter("featured", featured)
|
||||
}
|
||||
var category: String? = null
|
||||
set(category) {
|
||||
field = category
|
||||
|
||||
if (category != null) {
|
||||
addFilter("category", category)
|
||||
}
|
||||
}
|
||||
var tag: String? = null
|
||||
set(tag) {
|
||||
field = tag
|
||||
|
||||
if (tag != null) {
|
||||
addFilter("tag", tag)
|
||||
}
|
||||
}
|
||||
var shipping_class: String? = null
|
||||
set(shipping_class) {
|
||||
field = shipping_class
|
||||
|
||||
if (shipping_class != null) {
|
||||
addFilter("shipping_class", shipping_class)
|
||||
}
|
||||
}
|
||||
var attribute: String? = null
|
||||
set(attribute) {
|
||||
field = attribute
|
||||
|
||||
if (attribute != null) {
|
||||
addFilter("attribute", attribute)
|
||||
}
|
||||
}
|
||||
var attribute_term: String? = null
|
||||
set(attribute_term) {
|
||||
field = attribute_term
|
||||
|
||||
if (attribute_term != null) {
|
||||
addFilter("attribute_term", attribute_term)
|
||||
}
|
||||
}
|
||||
var tax_class: String? = null
|
||||
set(tax_class) {
|
||||
field = tax_class
|
||||
|
||||
if (tax_class != null) {
|
||||
addFilter("tax_class", tax_class)
|
||||
}
|
||||
}
|
||||
var isOn_sale: Boolean = false
|
||||
set(on_sale) {
|
||||
field = on_sale
|
||||
|
||||
addFilter("on_sale", on_sale)
|
||||
}
|
||||
var min_price: String? = null
|
||||
set(min_price) {
|
||||
field = min_price
|
||||
|
||||
if (min_price != null) {
|
||||
addFilter("min_price", min_price)
|
||||
}
|
||||
}
|
||||
var max_price: String? = null
|
||||
set(max_price) {
|
||||
field = max_price
|
||||
|
||||
if (max_price != null) {
|
||||
addFilter("max_price", max_price)
|
||||
}
|
||||
}
|
||||
var stock_status: String? = null
|
||||
set(stock_status) {
|
||||
field = stock_status
|
||||
|
||||
if (stock_status != null) {
|
||||
addFilter("stock_status", stock_status)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class RefundFilter : ListFilter() {
|
||||
|
||||
var parent: IntArray? = null
|
||||
set(parent) {
|
||||
field = parent
|
||||
if (parent != null) {
|
||||
addFilter("parent", parent)
|
||||
}
|
||||
}
|
||||
var parent_exclude: IntArray? = null
|
||||
set(parent_exclude) {
|
||||
field = parent_exclude
|
||||
|
||||
if (parent_exclude != null) {
|
||||
addFilter("parent_exclude", parent_exclude)
|
||||
}
|
||||
}
|
||||
|
||||
internal var dp: Int = 0
|
||||
|
||||
fun getDp(): Int {
|
||||
return dp
|
||||
}
|
||||
|
||||
fun setDp(dp: Int) {
|
||||
this.dp = dp
|
||||
addFilter("dp", dp)
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class ReportsDateFilter : Filter() {
|
||||
|
||||
internal lateinit var period: String
|
||||
internal lateinit var date_min: String
|
||||
internal lateinit var date_max: String
|
||||
|
||||
fun getPeriod(): String {
|
||||
return period
|
||||
}
|
||||
|
||||
fun setPeriod(period: String) {
|
||||
this.period = period
|
||||
|
||||
addFilter("period", period)
|
||||
}
|
||||
|
||||
fun getDate_min(): String {
|
||||
return date_min
|
||||
}
|
||||
|
||||
fun setDate_min(date_min: String) {
|
||||
this.date_min = date_min
|
||||
|
||||
addFilter("date_min", date_min)
|
||||
}
|
||||
|
||||
fun getDate_max(): String {
|
||||
return date_max
|
||||
}
|
||||
|
||||
fun setDate_max(date_max: String) {
|
||||
this.date_max = date_max
|
||||
|
||||
addFilter("date_max", date_max)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
enum class Role {
|
||||
ALL {
|
||||
override fun toString(): String {
|
||||
return "all"
|
||||
}
|
||||
},
|
||||
ADMINISTRATOR {
|
||||
override fun toString(): String {
|
||||
return "administrator"
|
||||
}
|
||||
},
|
||||
EDITOR {
|
||||
override fun toString(): String {
|
||||
return "editor"
|
||||
}
|
||||
},
|
||||
|
||||
AUTHOR {
|
||||
override fun toString(): String {
|
||||
return "author"
|
||||
}
|
||||
},
|
||||
|
||||
CONTRIBUTOR {
|
||||
override fun toString(): String {
|
||||
return "contributor"
|
||||
}
|
||||
},
|
||||
|
||||
SUBSCRIBER {
|
||||
override fun toString(): String {
|
||||
return "subscriber"
|
||||
}
|
||||
},
|
||||
|
||||
CUSTOMER {
|
||||
override fun toString(): String {
|
||||
return "customer"
|
||||
}
|
||||
},
|
||||
|
||||
SHOP_MANAGER {
|
||||
override fun toString(): String {
|
||||
return "shop_manager"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class ShippingClassesFilter : ListFilter() {
|
||||
|
||||
internal var product: Int = 0
|
||||
internal var hide_empty: Boolean = false
|
||||
internal lateinit var slug: String
|
||||
|
||||
var isHide_empty: Boolean
|
||||
get() = hide_empty
|
||||
set(hide_empty) {
|
||||
this.hide_empty = hide_empty
|
||||
addFilter("hide_empty", hide_empty)
|
||||
}
|
||||
|
||||
|
||||
fun getProduct(): Int {
|
||||
return product
|
||||
}
|
||||
|
||||
fun setProduct(product: Int) {
|
||||
this.product = product
|
||||
addFilter("product", product)
|
||||
}
|
||||
|
||||
fun getSlug(): String {
|
||||
return slug
|
||||
}
|
||||
|
||||
fun setSlug(slug: String) {
|
||||
this.slug = slug
|
||||
addFilter("slug", slug)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
enum class Sort {
|
||||
|
||||
ASCENDING {
|
||||
override fun toString(): String {
|
||||
return "asc"
|
||||
}
|
||||
},
|
||||
DESCENDING {
|
||||
override fun toString(): String {
|
||||
return "desc"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package me.gilo.woodroid.models.filters
|
||||
|
||||
class WebhookFilter : ListFilter() {
|
||||
|
||||
internal lateinit var status: String
|
||||
|
||||
fun getStatus(): String {
|
||||
return status
|
||||
}
|
||||
|
||||
fun setStatus(status: String) {
|
||||
this.status = status
|
||||
addFilter("status", status)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package me.gilo.woodroid.models.report
|
||||
|
||||
class CouponsTotal {
|
||||
|
||||
lateinit var slug: String
|
||||
lateinit var name: String
|
||||
lateinit var total: String
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package me.gilo.woodroid.models.report
|
||||
|
||||
class CustomersTotal {
|
||||
|
||||
lateinit var slug: String
|
||||
lateinit var name: String
|
||||
lateinit var total: String
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package me.gilo.woodroid.models.report
|
||||
|
||||
class OrdersTotal {
|
||||
|
||||
lateinit var slug: String
|
||||
lateinit var name: String
|
||||
lateinit var total: String
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package me.gilo.woodroid.models.report
|
||||
|
||||
class ProductsTotal {
|
||||
|
||||
lateinit var slug: String
|
||||
lateinit var name: String
|
||||
lateinit var total: String
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package me.gilo.woodroid.models.report
|
||||
|
||||
class ReviewsTotal {
|
||||
|
||||
lateinit var slug: String
|
||||
lateinit var name: String
|
||||
lateinit var total: String
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package me.gilo.woodroid.models.report
|
||||
|
||||
class SalesPeriodTotal {
|
||||
|
||||
private val shipping: String? = null
|
||||
private val discount: String? = null
|
||||
private val orders: Int = 0
|
||||
private val tax: String? = null
|
||||
private val customers: Int = 0
|
||||
private val items: Int = 0
|
||||
private val sales: String? = null
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package me.gilo.woodroid.models.report
|
||||
|
||||
class SalesTotal {
|
||||
|
||||
var total_discount: Int = 0
|
||||
var net_sales: String? = null
|
||||
var total_customers: String? = null
|
||||
var totals: Map<String, SalesPeriodTotal>? = null
|
||||
var total_orders: Int = 0
|
||||
var total_tax: String? = null
|
||||
var total_items: Int = 0
|
||||
var totals_grouped_by: String? = null
|
||||
var total_shipping: String? = null
|
||||
var average_sales: String? = null
|
||||
var total_sales: String? = null
|
||||
var total_refunds: Int = 0
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package me.gilo.woodroid.models.report
|
||||
|
||||
class TopSellerProducts {
|
||||
|
||||
lateinit var title: String
|
||||
var product_id: Int = 0
|
||||
var quantity: Int = 0
|
||||
}
|
||||
3
core/src/main/res/values/strings.xml
Normal file
3
core/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">core</string>
|
||||
</resources>
|
||||
17
core/src/test/java/me/gilo/woodroid/core/ExampleUnitTest.kt
Normal file
17
core/src/test/java/me/gilo/woodroid/core/ExampleUnitTest.kt
Normal file
@ -0,0 +1,17 @@
|
||||
package me.gilo.woodroid.core
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -31,4 +36,17 @@ dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
compile project(path: ':core')
|
||||
|
||||
implementation 'com.google.firebase:firebase-database:18.0.0'
|
||||
implementation 'com.google.firebase:firebase-auth:18.0.0'
|
||||
implementation 'com.google.firebase:firebase-core:17.0.0'
|
||||
implementation 'com.google.firebase:firebase-firestore:20.1.0'
|
||||
implementation 'com.google.firebase:firebase-storage:18.0.0'
|
||||
implementation 'com.google.firebase:firebase-messaging:19.0.1'
|
||||
|
||||
|
||||
implementation "android.arch.paging:runtime:1.0.1"
|
||||
|
||||
implementation 'android.arch.lifecycle:livedata:1.1.1'
|
||||
}
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package me.gilo.woodroid.firebasecart
|
||||
|
||||
|
||||
import android.arch.lifecycle.LiveData
|
||||
import com.google.firebase.auth.FirebaseAuth
|
||||
import com.google.firebase.firestore.CollectionReference
|
||||
import com.google.firebase.firestore.FirebaseFirestore
|
||||
import me.gilo.woodroid.core.cart.CartRepository
|
||||
import me.gilo.woodroid.models.LineItem
|
||||
|
||||
|
||||
open class FirebaseCartRepository : CartRepository() {
|
||||
override fun cart(): LiveData<List<LineItem>> {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun clear(): LiveData<String> {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun count(id: Int): LiveData<Int> {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun addToCart(lineItem: LineItem): LiveData<LineItem> {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun delete(cartId: String): LiveData<String> {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun restore(cartId: String): LiveData<String> {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun update(cartId: String, quantity: Int): LiveData<LineItem> {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
|
||||
private val cart: CollectionReference = FirebaseFirestore.getInstance()
|
||||
.collection("users")
|
||||
.document(FirebaseAuth.getInstance().currentUser?.uid ?: "0")
|
||||
.collection("cart")
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package me.gilo.woodroid.firebasecart.common;
|
||||
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import android.support.annotation.NonNull;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.firestore.DocumentReference;
|
||||
|
||||
|
||||
public final class CompletionDocLiveData extends LiveData<Resource<Boolean>> implements OnCompleteListener<DocumentReference> {
|
||||
|
||||
|
||||
public CompletionDocLiveData() {
|
||||
setValue(new Resource<>(Status.LOADING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onComplete(@NonNull Task<DocumentReference> task) {
|
||||
if (task.isSuccessful()) {
|
||||
setValue(new Resource<>(true));
|
||||
} else {
|
||||
setValue(new Resource<>(task.getException()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package me.gilo.woodroid.app.common
|
||||
|
||||
import android.arch.lifecycle.LiveData
|
||||
import com.google.android.gms.tasks.OnCompleteListener
|
||||
import com.google.android.gms.tasks.Task
|
||||
|
||||
|
||||
class CompletionGenericLiveData<T> : LiveData<Resource<T>>(), OnCompleteListener<T> {
|
||||
init {
|
||||
value = Resource(Status.LOADING)
|
||||
}
|
||||
|
||||
override fun onComplete(task: Task<T>) {
|
||||
if (task.isSuccessful) {
|
||||
setValue(Resource(task.result!!))
|
||||
} else {
|
||||
setValue(Resource(task.exception!!))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package me.gilo.woodroid.firebasecart.common;
|
||||
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import android.support.annotation.NonNull;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
|
||||
|
||||
public final class CompletionLiveData extends LiveData<Resource<Boolean>> implements OnCompleteListener<Void> {
|
||||
|
||||
|
||||
public CompletionLiveData() {
|
||||
setValue(new Resource<>(Status.LOADING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onComplete(@NonNull Task<Void> task) {
|
||||
if (task.isSuccessful()) {
|
||||
setValue(new Resource<>(true));
|
||||
} else {
|
||||
setValue(new Resource<>(task.getException()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package me.gilo.woodroid.firebasecart.common;
|
||||
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import com.google.firebase.firestore.*;
|
||||
|
||||
|
||||
public class DocumentLiveData<T> extends LiveData<Resource<T>>
|
||||
implements EventListener<DocumentSnapshot> {
|
||||
private final Class<T> type;
|
||||
private ListenerRegistration registration;
|
||||
private final DocumentReference ref;
|
||||
|
||||
public DocumentLiveData(DocumentReference ref, Class<T> type) {
|
||||
this.ref = ref;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(DocumentSnapshot snapshot, FirebaseFirestoreException e) {
|
||||
if (e != null) {
|
||||
setValue(new Resource<>(e));
|
||||
return;
|
||||
}
|
||||
setValue(new Resource<>(snapshot.toObject(type)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActive() {
|
||||
super.onActive();
|
||||
registration = ref.addSnapshotListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInactive() {
|
||||
super.onInactive();
|
||||
if (registration != null) {
|
||||
registration.remove();
|
||||
registration = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package me.gilo.woodroid.firebasecart.common;
|
||||
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import android.support.annotation.NonNull;
|
||||
import com.google.firebase.firestore.*;
|
||||
import me.gilo.woodroid.firebasecart.models.Model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public final class QueryLiveData<T extends Model>
|
||||
extends LiveData<Resource<List<T>>> implements EventListener<QuerySnapshot> {
|
||||
|
||||
private final Query query;
|
||||
private final Class<T> type;
|
||||
private ListenerRegistration registration;
|
||||
|
||||
public QueryLiveData(Query query, Class<T> type) {
|
||||
this.query = query;
|
||||
this.type = type;
|
||||
|
||||
setValue(new Resource<>(Status.LOADING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(QuerySnapshot snapshots, FirebaseFirestoreException e) {
|
||||
if (e != null) {
|
||||
setValue(new Resource<>(e));
|
||||
return;
|
||||
}
|
||||
setValue(new Resource<>(documentToList(snapshots)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActive() {
|
||||
super.onActive();
|
||||
registration = query.addSnapshotListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInactive() {
|
||||
super.onInactive();
|
||||
if (registration != null) {
|
||||
registration.remove();
|
||||
registration = null;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private List<T> documentToList(QuerySnapshot snapshots) {
|
||||
final List<T> retList = new ArrayList<>();
|
||||
if (snapshots.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
|
||||
for (DocumentSnapshot document : snapshots.getDocuments()) {
|
||||
retList.add(document.toObject(type).withId(document.getId()));
|
||||
}
|
||||
|
||||
return retList;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package me.gilo.woodroid.firebasecart.common;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@SuppressWarnings({"WeakerAccess", "ConstantConditions"})
|
||||
public final class Resource<T> {
|
||||
@Nullable
|
||||
private final T data;
|
||||
@Nullable
|
||||
private final Exception error;
|
||||
Status status = Status.LOADING;
|
||||
|
||||
public Resource(@NonNull T data) {
|
||||
this(data, null);
|
||||
}
|
||||
|
||||
public Resource(@NonNull Status status) {
|
||||
this(null, null);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Resource(@NonNull Exception exception) {
|
||||
this(null, exception);
|
||||
this.status = Status.ERROR;
|
||||
}
|
||||
|
||||
private Resource(@Nullable T value, @Nullable Exception error) {
|
||||
this.data = value;
|
||||
this.error = error;
|
||||
|
||||
if (error != null){
|
||||
status = Status.ERROR;
|
||||
}else if (data != null){
|
||||
if (data instanceof List){
|
||||
if (((List) data).size() == 0){
|
||||
status = Status.EMPTY;
|
||||
}else {
|
||||
status = status.SUCCESS;
|
||||
}
|
||||
}else {
|
||||
status = Status.SUCCESS;
|
||||
}
|
||||
}else {
|
||||
status = Status.LOADING;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSuccessful() {
|
||||
return data != null && error == null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public T data() {
|
||||
if (error != null) {
|
||||
throw new IllegalStateException("error is not null. Call isSuccessful() first.");
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Exception error() {
|
||||
if (data != null) {
|
||||
throw new IllegalStateException("data is not null. Call isSuccessful() first.");
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Status status() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package me.gilo.woodroid.firebasecart.common;
|
||||
|
||||
public enum Status {
|
||||
EMPTY,
|
||||
SUCCESS,
|
||||
ERROR,
|
||||
LOADING;
|
||||
|
||||
public Status isLoading(){
|
||||
return LOADING;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package me.gilo.woodroid.firebasecart.models;
|
||||
|
||||
import me.gilo.woodroid.models.Product;
|
||||
|
||||
|
||||
public class CartLineItem extends Model{
|
||||
|
||||
public float price;
|
||||
public int quantity;
|
||||
public int productId;
|
||||
|
||||
Product product;
|
||||
|
||||
String name;
|
||||
String imageUrl;
|
||||
String priceString;
|
||||
|
||||
public float getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(float price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public int getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(int productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
public void setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public String getPriceString() {
|
||||
return priceString;
|
||||
}
|
||||
|
||||
public void setPriceString(String priceString) {
|
||||
this.priceString = priceString;
|
||||
}
|
||||
|
||||
public void setProduct(Product product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public Product getProduct() {
|
||||
return product;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package me.gilo.woodroid.firebasecart.models;
|
||||
|
||||
import com.google.firebase.firestore.Exclude;
|
||||
|
||||
/**
|
||||
* Represents an object that can be uniquely identified among other objects of the same type
|
||||
* by using an UID.
|
||||
*
|
||||
* @param <TKey> type of the unique key (UID) this object is uniquely identified by. The type needs
|
||||
* a correct implementation of its equals() method or the behaviour of code using this
|
||||
* interface will be undefined.
|
||||
*/
|
||||
public interface Identifiable<TKey> {
|
||||
|
||||
@Exclude
|
||||
TKey getEntityKey();
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package me.gilo.woodroid.firebasecart.models;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import com.google.firebase.firestore.IgnoreExtraProperties;
|
||||
import com.google.firebase.firestore.ServerTimestamp;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* A Base Model to be extended by other models to add ids.
|
||||
*/
|
||||
|
||||
@IgnoreExtraProperties
|
||||
public class Model implements Serializable {
|
||||
|
||||
public String id;
|
||||
|
||||
@ServerTimestamp
|
||||
private Date date_created = null;
|
||||
|
||||
|
||||
public <T extends Model> T withId(@NonNull final String id) {
|
||||
this.id = id;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package me.gilo.woodroid.firebasecart.models;
|
||||
|
||||
import com.google.android.gms.tasks.Task;
|
||||
|
||||
/**
|
||||
* Manages data access for POJOs that are uniquely identifiable by a key, such as POJOs implementing {@link Identifiable}.
|
||||
*/
|
||||
public interface Repository<TEntity extends Identifiable<TKey>, TKey> {
|
||||
|
||||
/**
|
||||
* Checks the repository for a given id and returns a boolean representing its existence.
|
||||
* @param id the unique id of an entity.
|
||||
* @return A {@link Task} for a boolean which is 'true' if the entity for the given id exists, 'false' otherwise.
|
||||
*/
|
||||
Task<Boolean> exists(TKey id);
|
||||
|
||||
/**
|
||||
* Queries the repository for an uniquely identified entity and returns it. If the entity does
|
||||
* not exist in the repository, a new instance is returned.
|
||||
* @param id the unique id of an entity.
|
||||
* @return A {@link Task} for an entity implementing {@link Identifiable}.
|
||||
*/
|
||||
Task<TEntity> get(TKey id);
|
||||
|
||||
/**
|
||||
* Stores an entity in the repository so it is accessible via its unique id.
|
||||
* @param entity the entity implementing {@link Identifiable} to be stored.
|
||||
* @return An {@link Task} to be notified of failures.
|
||||
*/
|
||||
Task<Void> create(TEntity entity);
|
||||
|
||||
/**
|
||||
* Updates an entity in the repository
|
||||
* @param entity the new entity to be stored.
|
||||
* @return A {@link Task} to be notified of failures.
|
||||
*/
|
||||
Task<Void> update(TEntity entity);
|
||||
|
||||
/**
|
||||
* Deletes an entity from the repository.
|
||||
* @param id uniquely identifying the entity.
|
||||
* @return A {@link Task} to be notified of failures.
|
||||
*/
|
||||
Task<Void> delete(TKey id);
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package me.gilo.woodroid.firebasecart.models;
|
||||
|
||||
public class User{
|
||||
String id;
|
||||
private String middlename;
|
||||
private String email;
|
||||
private String dob;
|
||||
private String gender;
|
||||
private String surname;
|
||||
private String firstname;
|
||||
private String lastname;
|
||||
private String password;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMiddlename() {
|
||||
return middlename;
|
||||
}
|
||||
|
||||
public void setMiddlename(String middlename) {
|
||||
this.middlename = middlename;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getDob() {
|
||||
return dob;
|
||||
}
|
||||
|
||||
public void setDob(String dob) {
|
||||
this.dob = dob;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getSurname() {
|
||||
return surname;
|
||||
}
|
||||
|
||||
public void setSurname(String surname) {
|
||||
this.surname = surname;
|
||||
}
|
||||
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
}
|
||||
|
||||
public void setFirstname(String firstname) {
|
||||
this.firstname = firstname;
|
||||
}
|
||||
|
||||
public String getLastname() {
|
||||
return lastname;
|
||||
}
|
||||
|
||||
public void setLastname(String lastname) {
|
||||
this.lastname = lastname;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
@ -1 +1 @@
|
||||
include ':app', ':woodroid', ':firebasecart'
|
||||
include ':app', ':woodroid', ':firebasecart', ':core'
|
||||
|
||||
@ -1,36 +1,36 @@
|
||||
package me.gilo.woodroid.data.api
|
||||
|
||||
|
||||
import me.gilo.woodroid.models.Attribute
|
||||
import me.gilo.woodroid.models.ProductAttribute
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.*
|
||||
|
||||
interface ProductAttributeAPI {
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("products/attributes")
|
||||
fun create(@Body body: Attribute): Call<Attribute>
|
||||
@POST("products/productAttributes")
|
||||
fun create(@Body body: ProductAttribute): Call<ProductAttribute>
|
||||
|
||||
@GET("products/attributes/{id}")
|
||||
fun view(@Path("id") id: Int): Call<Attribute>
|
||||
@GET("products/productAttributes/{id}")
|
||||
fun view(@Path("id") id: Int): Call<ProductAttribute>
|
||||
|
||||
@GET("products/attributes")
|
||||
fun list(): Call<List<Attribute>>
|
||||
@GET("products/productAttributes")
|
||||
fun list(): Call<List<ProductAttribute>>
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@PUT("products/attributes/{id}")
|
||||
fun update(@Path("id") id: Int, @Body body: Attribute): Call<Attribute>
|
||||
@PUT("products/productAttributes/{id}")
|
||||
fun update(@Path("id") id: Int, @Body body: ProductAttribute): Call<ProductAttribute>
|
||||
|
||||
@DELETE("products/attributes/{id}")
|
||||
fun delete(@Path("id") id: Int): Call<Attribute>
|
||||
@DELETE("products/productAttributes/{id}")
|
||||
fun delete(@Path("id") id: Int): Call<ProductAttribute>
|
||||
|
||||
@DELETE("products/attributes/{id}")
|
||||
fun delete(@Path("id") id: Int, @Query("force") force: Boolean): Call<Attribute>
|
||||
@DELETE("products/productAttributes/{id}")
|
||||
fun delete(@Path("id") id: Int, @Query("force") force: Boolean): Call<ProductAttribute>
|
||||
|
||||
@POST("products/attributes/batch")
|
||||
fun batch(@Body body: Attribute): Call<String>
|
||||
@POST("products/productAttributes/batch")
|
||||
fun batch(@Body body: ProductAttribute): Call<String>
|
||||
|
||||
@GET("products/attributes")
|
||||
fun filter(@QueryMap filter: Map<String, String>): Call<List<Attribute>>
|
||||
@GET("products/productAttributes")
|
||||
fun filter(@QueryMap filter: Map<String, String>): Call<List<ProductAttribute>>
|
||||
|
||||
}
|
||||
@ -8,29 +8,29 @@ import retrofit2.http.*
|
||||
interface ProductAttributeTermAPI {
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("products/attributes/{id}/terms")
|
||||
@POST("products/productAttributes/{id}/terms")
|
||||
fun create(@Path("id") attribute_id: Int, @Body body: AttributeTerm): Call<AttributeTerm>
|
||||
|
||||
@GET("products/attributes/{id}/terms/[term_id]")
|
||||
@GET("products/productAttributes/{id}/terms/[term_id]")
|
||||
fun view(@Path("id") attribute_id: Int, @Path("term_id") term_id: Int): Call<AttributeTerm>
|
||||
|
||||
@GET("products/attributes/{id}/terms")
|
||||
@GET("products/productAttributes/{id}/terms")
|
||||
fun list(@Path("id") attribute_id: Int): Call<List<AttributeTerm>>
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@PUT("products/attributes/{id}/terms/[term_id]")
|
||||
@PUT("products/productAttributes/{id}/terms/[term_id]")
|
||||
fun update(@Path("id") attribute_id: Int, @Path("term_id") term_id: Int, @Body body: AttributeTerm): Call<AttributeTerm>
|
||||
|
||||
@DELETE("products/attributes/{id}/terms/[term_id]")
|
||||
@DELETE("products/productAttributes/{id}/terms/[term_id]")
|
||||
fun delete(@Path("id") attribute_id: Int, @Path("term_id") term_id: Int): Call<AttributeTerm>
|
||||
|
||||
@DELETE("products/attributes/{id}/terms/[term_id]")
|
||||
@DELETE("products/productAttributes/{id}/terms/[term_id]")
|
||||
fun delete(@Path("id") attribute_id: Int, @Path("term_id") term_id: Int, @Query("force") force: Boolean): Call<AttributeTerm>
|
||||
|
||||
@POST("products/attributes/batch")
|
||||
@POST("products/productAttributes/batch")
|
||||
fun batch(@Body body: AttributeTerm): Call<String>
|
||||
|
||||
@GET("products/attributes/{id}/terms")
|
||||
@GET("products/productAttributes/{id}/terms")
|
||||
fun filter(@Path("id") attribute_id: Int, @QueryMap filter: Map<String, String>): Call<List<AttributeTerm>>
|
||||
|
||||
}
|
||||
@ -7,28 +7,40 @@ import java.io.Serializable
|
||||
|
||||
class Customer : Serializable {
|
||||
var id: Int = 0
|
||||
|
||||
@SerializedName("created_at")
|
||||
lateinit var createdAt: String
|
||||
|
||||
lateinit var email: String
|
||||
|
||||
@SerializedName("first_name")
|
||||
lateinit var firstName: String
|
||||
|
||||
@SerializedName("last_name")
|
||||
lateinit var lastName: String
|
||||
|
||||
lateinit var username: String
|
||||
lateinit var password: String
|
||||
lateinit var role: String
|
||||
|
||||
@SerializedName("last_order_id")
|
||||
lateinit var lastOrderId: String
|
||||
|
||||
@SerializedName("last_order_date")
|
||||
lateinit var lastOrderDate: String
|
||||
|
||||
@SerializedName("orders_count")
|
||||
var ordersCount: Int = 0
|
||||
|
||||
@SerializedName("total_spent")
|
||||
lateinit var totalSpent: String
|
||||
|
||||
@SerializedName("avatar_url")
|
||||
lateinit var avatarUrl: String
|
||||
|
||||
@SerializedName("billing")
|
||||
lateinit var billingAddress: BillingAddress
|
||||
|
||||
@SerializedName("shipping")
|
||||
lateinit var shippingAddress: ShippingAddress
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user