updated to kotlin
This commit is contained in:
parent
51e651de76
commit
f3deac9ea0
@ -17,7 +17,7 @@ class CouponViewHolder(val context: Context, itemView: View) :
|
||||
val tvTitle = itemView.findViewById<TextView>(R.id.tvTitle)
|
||||
val tvDescription = itemView.findViewById<TextView>(R.id.tvDescription)
|
||||
|
||||
tvTitle.text = coupon.code.toUpperCase()
|
||||
tvTitle.text = coupon.code?.toUpperCase()
|
||||
tvDescription.text = Html.fromHtml(coupon.description)
|
||||
|
||||
itemView.setOnClickListener{
|
||||
|
||||
@ -17,57 +17,57 @@ constructor() {
|
||||
|
||||
fun create(customer: Customer): WooLiveData<Customer> {
|
||||
val callBack = WooLiveData<Customer>()
|
||||
woocommerce!!.CustomerRepository().create(customer).enqueue(callBack)
|
||||
woocommerce.CustomerRepository().create(customer).enqueue(callBack)
|
||||
return callBack
|
||||
}
|
||||
|
||||
fun currentCustomer(): WooLiveData<List<Customer>> {
|
||||
val callBack = WooLiveData<List<Customer>>()
|
||||
val customerFilter = CustomerFilter()
|
||||
customerFilter.email = FirebaseAuth.getInstance().currentUser!!.email
|
||||
customerFilter.setEmail(FirebaseAuth.getInstance().currentUser!!.email!!)
|
||||
|
||||
woocommerce!!.CustomerRepository().customers(customerFilter).enqueue(callBack)
|
||||
woocommerce.CustomerRepository().customers(customerFilter).enqueue(callBack)
|
||||
return callBack
|
||||
}
|
||||
|
||||
|
||||
fun customer(id: Int): WooLiveData<Customer> {
|
||||
val callBack = WooLiveData<Customer>()
|
||||
woocommerce!!.CustomerRepository().customer(id).enqueue(callBack)
|
||||
woocommerce.CustomerRepository().customer(id).enqueue(callBack)
|
||||
return callBack
|
||||
}
|
||||
|
||||
fun customers(): WooLiveData<List<Customer>> {
|
||||
val callBack = WooLiveData<List<Customer>>()
|
||||
|
||||
woocommerce!!.CustomerRepository().customers().enqueue(callBack)
|
||||
woocommerce.CustomerRepository().customers().enqueue(callBack)
|
||||
|
||||
return callBack
|
||||
}
|
||||
|
||||
fun customers(customerFilter: CustomerFilter): WooLiveData<List<Customer>> {
|
||||
val callBack = WooLiveData<List<Customer>>()
|
||||
woocommerce!!.CustomerRepository().customers(customerFilter).enqueue(callBack)
|
||||
woocommerce.CustomerRepository().customers(customerFilter).enqueue(callBack)
|
||||
return callBack
|
||||
}
|
||||
|
||||
fun update(id: Int, customer: Customer): WooLiveData<Customer> {
|
||||
val callBack = WooLiveData<Customer>()
|
||||
woocommerce!!.CustomerRepository().update(id, customer).enqueue(callBack)
|
||||
woocommerce.CustomerRepository().update(id, customer).enqueue(callBack)
|
||||
|
||||
return callBack
|
||||
}
|
||||
|
||||
fun delete(id: Int): WooLiveData<Customer> {
|
||||
val callBack = WooLiveData<Customer>()
|
||||
woocommerce!!.CustomerRepository().delete(id).enqueue(callBack)
|
||||
woocommerce.CustomerRepository().delete(id).enqueue(callBack)
|
||||
|
||||
return callBack
|
||||
}
|
||||
|
||||
fun delete(id: Int, force: Boolean): WooLiveData<Customer> {
|
||||
val callBack = WooLiveData<Customer>()
|
||||
woocommerce!!.CustomerRepository().delete(id, force).enqueue(callBack)
|
||||
woocommerce.CustomerRepository().delete(id, force).enqueue(callBack)
|
||||
|
||||
return callBack
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ class CouponActivity : BaseActivity() {
|
||||
override fun onResponse(call: Call<Coupon>, response: Response<Coupon>) {
|
||||
val coupon = response.body()!!
|
||||
|
||||
etCode.setText(coupon.code.toUpperCase())
|
||||
etCode.setText(coupon.code?.toUpperCase())
|
||||
etDescription.setText(coupon.description)
|
||||
|
||||
stopShowingLoading()
|
||||
@ -70,7 +70,7 @@ class CouponActivity : BaseActivity() {
|
||||
if (response.isSuccessful) {
|
||||
val coupon = response.body()!!
|
||||
|
||||
etCode.setText(coupon.code.toUpperCase())
|
||||
etCode.setText(coupon.code?.toUpperCase())
|
||||
etDescription.setText(coupon.description)
|
||||
|
||||
finish()
|
||||
@ -95,7 +95,7 @@ class CouponActivity : BaseActivity() {
|
||||
override fun onResponse(call: Call<Coupon>, response: Response<Coupon>) {
|
||||
val coupon = response.body()!!
|
||||
|
||||
etCode.setText(coupon.code.toUpperCase())
|
||||
etCode.setText(coupon.code?.toUpperCase())
|
||||
etDescription.setText(coupon.description)
|
||||
|
||||
stopShowingLoading()
|
||||
|
||||
@ -48,7 +48,7 @@ class CouponsActivity : BaseActivity() {
|
||||
//Not best practise, but works for purposes of demo
|
||||
private fun coupons() {
|
||||
val filter = CouponFilter()
|
||||
filter.search = "FEB"
|
||||
filter.setSearch("FEB")
|
||||
|
||||
woocommerce.CouponRepository().coupons(filter).enqueue(object : Callback<List<Coupon>> {
|
||||
override fun onResponse(call: Call<List<Coupon>>, response: Response<List<Coupon>>) {
|
||||
|
||||
@ -106,7 +106,7 @@ class BillingAddressActivity : WooDroidActivity<CustomerViewModel>() {
|
||||
customer.billingAddress.country = country
|
||||
customer.billingAddress.phone = phone
|
||||
|
||||
customer.billingAddress.email = FirebaseAuth.getInstance().currentUser!!.email
|
||||
customer.billingAddress.email = FirebaseAuth.getInstance().currentUser!!.email!!
|
||||
|
||||
viewModel.update(customer.id, customer).observe(this, Observer {
|
||||
response->
|
||||
|
||||
@ -62,7 +62,7 @@ class CategoryFragment : Fragment() {
|
||||
private fun categories() {
|
||||
|
||||
val filter = ProductCategoryFilter()
|
||||
filter.per_page = 50
|
||||
filter.setPer_page(50)
|
||||
|
||||
viewModel.categories(filter).observe(this, android.arch.lifecycle.Observer { response ->
|
||||
when (response!!.status()) {
|
||||
|
||||
@ -173,10 +173,10 @@ class CartActivity : WooDroidActivity<CartViewModel>() {
|
||||
lineItem.productId = cartitem.productId
|
||||
lineItem.quantity = cartitem.quantity
|
||||
|
||||
lineitems.add(lineItem);
|
||||
lineitems.add(lineItem)
|
||||
}
|
||||
|
||||
order.setLineItems(lineitems);
|
||||
order.lineItems = lineitems
|
||||
order.billingAddress = customer.billingAddress
|
||||
order.shippingAddress = customer.shippingAddress
|
||||
order.customer = customer
|
||||
|
||||
@ -78,7 +78,7 @@ class ShopActivity : BaseActivity() {
|
||||
val filter = ProductFilter()
|
||||
|
||||
if (etSearch.text.toString().isNotEmpty()){
|
||||
filter.search = etSearch.text.toString()
|
||||
filter.setSearch(etSearch.text.toString())
|
||||
}
|
||||
|
||||
if (etMinPrice.text.toString().isNotEmpty()){
|
||||
|
||||
@ -67,7 +67,7 @@ class RelatedProductsFragment : Fragment() {
|
||||
rvShop.adapter = adapter
|
||||
|
||||
val filter = ProductFilter()
|
||||
filter.include = product.related_ids.toIntArray()
|
||||
filter.setInclude(product.related_ids.toIntArray())
|
||||
|
||||
viewModel.products(filter).observe(this, android.arch.lifecycle.Observer { response ->
|
||||
when (response!!.status()) {
|
||||
|
||||
140
woodroid/src/main/java/me/gilo/woodroid/Woocommerce.java
Normal file
140
woodroid/src/main/java/me/gilo/woodroid/Woocommerce.java
Normal file
@ -0,0 +1,140 @@
|
||||
package me.gilo.woodroid;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import me.gilo.woodroid.data.ApiVersion;
|
||||
import me.gilo.woodroid.models.PaymentGateway;
|
||||
import me.gilo.woodroid.repo.*;
|
||||
import me.gilo.woodroid.repo.order.OrderNoteRepository;
|
||||
import me.gilo.woodroid.repo.order.RefundRepository;
|
||||
import me.gilo.woodroid.repo.product.*;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class Woocommerce {
|
||||
|
||||
public static final ApiVersion API_V1 = ApiVersion.API_VERSION1;
|
||||
public static final ApiVersion API_V2 = ApiVersion.API_VERSION2;
|
||||
public static final ApiVersion API_V3 = ApiVersion.API_VERSION3;
|
||||
|
||||
private final OrderNoteRepository orderNoteRepository;
|
||||
private final RefundRepository refundRepository;
|
||||
private final AttributeRepository attributeRepository;
|
||||
private final AttributeTermRepository attributeTermRepository;
|
||||
private final CategoryRepository categoryRepository;
|
||||
private final ShippingClassRepository shippingClassRepository;
|
||||
private final TagRepository tagRepository;
|
||||
private final VariationRepository variationRepository;
|
||||
private final CouponRepository couponRepository;
|
||||
private final CustomerRepository customerRepository;
|
||||
private final OrderRepository orderRepository;
|
||||
private final ProductRepository productRepository;
|
||||
private final ReviewRepository reviewRepository;
|
||||
private final ReportsRepository reportsRepository;
|
||||
private final CartRepository cartRepository;
|
||||
private final PaymentGatewayRepository paymentGatewayRepository;
|
||||
private final SettingsRepository settingsRepository;
|
||||
private final ShippingMethodRepository shippingMethodRepository;
|
||||
|
||||
public static Builder Builder(){
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Woocommerce(String siteUrl, ApiVersion apiVerion, String consumerKey, String consumerSecret) {
|
||||
String baseUrl = siteUrl + "/wp-json/wc/v" + apiVerion + "/";
|
||||
String cartBaseUrl = siteUrl + "/wp-json/wc/v" + 2 + "/";
|
||||
|
||||
orderNoteRepository = new OrderNoteRepository(baseUrl, consumerKey, consumerSecret);
|
||||
refundRepository = new RefundRepository(baseUrl, consumerKey, consumerSecret);
|
||||
attributeRepository = new AttributeRepository(baseUrl, consumerKey, consumerSecret);
|
||||
attributeTermRepository = new AttributeTermRepository(baseUrl, consumerKey, consumerSecret);
|
||||
categoryRepository = new CategoryRepository(baseUrl, consumerKey, consumerSecret);
|
||||
shippingClassRepository = new ShippingClassRepository(baseUrl, consumerKey, consumerSecret);
|
||||
tagRepository = new TagRepository(baseUrl, consumerKey, consumerSecret);
|
||||
variationRepository = new VariationRepository(baseUrl, consumerKey, consumerSecret);
|
||||
couponRepository = new CouponRepository(baseUrl, consumerKey, consumerSecret);
|
||||
customerRepository = new CustomerRepository(baseUrl, consumerKey, consumerSecret);
|
||||
orderRepository = new OrderRepository(baseUrl, consumerKey, consumerSecret);
|
||||
productRepository = new ProductRepository(baseUrl, consumerKey, consumerSecret);
|
||||
reportsRepository = new ReportsRepository(baseUrl, consumerKey, consumerSecret);
|
||||
cartRepository = new CartRepository(cartBaseUrl, consumerKey, consumerSecret);
|
||||
reviewRepository = new ReviewRepository(baseUrl, consumerKey, consumerSecret);
|
||||
paymentGatewayRepository = new PaymentGatewayRepository(baseUrl, consumerKey, consumerSecret);
|
||||
settingsRepository = new SettingsRepository(baseUrl, consumerKey, consumerSecret);
|
||||
shippingMethodRepository = new ShippingMethodRepository(baseUrl, consumerKey, consumerSecret);
|
||||
|
||||
}
|
||||
|
||||
public OrderNoteRepository OrderNoteRepository() {
|
||||
return orderNoteRepository;
|
||||
}
|
||||
|
||||
public RefundRepository RefundRepository() {
|
||||
return refundRepository;
|
||||
}
|
||||
|
||||
public AttributeRepository AttributeRepository() {
|
||||
return attributeRepository;
|
||||
}
|
||||
|
||||
public AttributeTermRepository AttributeTermRepository() {
|
||||
return attributeTermRepository;
|
||||
}
|
||||
|
||||
public CategoryRepository CategoryRepository() {
|
||||
return categoryRepository;
|
||||
}
|
||||
|
||||
public ShippingClassRepository ShippingClassRepository() {
|
||||
return shippingClassRepository;
|
||||
}
|
||||
|
||||
public TagRepository TagRepository() {
|
||||
return tagRepository;
|
||||
}
|
||||
|
||||
public VariationRepository VariationRepository() {
|
||||
return variationRepository;
|
||||
}
|
||||
|
||||
public CouponRepository CouponRepository() {
|
||||
return couponRepository;
|
||||
}
|
||||
|
||||
public CustomerRepository CustomerRepository() {
|
||||
return customerRepository;
|
||||
}
|
||||
|
||||
public OrderRepository OrderRepository() {
|
||||
return orderRepository;
|
||||
}
|
||||
|
||||
public ProductRepository ProductRepository() {
|
||||
return productRepository;
|
||||
}
|
||||
|
||||
public ReviewRepository ReviewRepository() {
|
||||
return reviewRepository;
|
||||
}
|
||||
|
||||
public ReportsRepository ReportsRepository() {
|
||||
return reportsRepository;
|
||||
}
|
||||
|
||||
public PaymentGatewayRepository PaymentGatewayRepository() {
|
||||
return paymentGatewayRepository;
|
||||
}
|
||||
|
||||
public SettingsRepository SettingsRepository() {
|
||||
return settingsRepository;
|
||||
}
|
||||
|
||||
public ShippingMethodRepository ShippingMethodRepository() {
|
||||
return shippingMethodRepository;
|
||||
}
|
||||
|
||||
public CartRepository CartRepository(Context context) {
|
||||
cartRepository.turnOnCookies(context);
|
||||
return cartRepository;
|
||||
}
|
||||
}
|
||||
@ -1,143 +0,0 @@
|
||||
package me.gilo.woodroid
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import me.gilo.woodroid.data.ApiVersion
|
||||
import me.gilo.woodroid.models.PaymentGateway
|
||||
import me.gilo.woodroid.repo.*
|
||||
import me.gilo.woodroid.repo.order.OrderNoteRepository
|
||||
import me.gilo.woodroid.repo.order.RefundRepository
|
||||
import me.gilo.woodroid.repo.product.*
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
|
||||
class Woocommerce(siteUrl: String, apiVerion: ApiVersion, consumerKey: String, consumerSecret: String) {
|
||||
|
||||
private val orderNoteRepository: OrderNoteRepository
|
||||
private val refundRepository: RefundRepository
|
||||
private val attributeRepository: AttributeRepository
|
||||
private val attributeTermRepository: AttributeTermRepository
|
||||
private val categoryRepository: CategoryRepository
|
||||
private val shippingClassRepository: ShippingClassRepository
|
||||
private val tagRepository: TagRepository
|
||||
private val variationRepository: VariationRepository
|
||||
private val couponRepository: CouponRepository
|
||||
private val customerRepository: CustomerRepository
|
||||
private val orderRepository: OrderRepository
|
||||
private val productRepository: ProductRepository
|
||||
private val reviewRepository: ReviewRepository
|
||||
private val reportsRepository: ReportsRepository
|
||||
private val cartRepository: CartRepository
|
||||
private val paymentGatewayRepository: PaymentGatewayRepository
|
||||
private val settingsRepository: SettingsRepository
|
||||
private val shippingMethodRepository: ShippingMethodRepository
|
||||
|
||||
init {
|
||||
val baseUrl = "$siteUrl/wp-json/wc/v$apiVerion/"
|
||||
val cartBaseUrl = "$siteUrl/wp-json/wc/v2/"
|
||||
|
||||
orderNoteRepository = OrderNoteRepository(baseUrl, consumerKey, consumerSecret)
|
||||
refundRepository = RefundRepository(baseUrl, consumerKey, consumerSecret)
|
||||
attributeRepository = AttributeRepository(baseUrl, consumerKey, consumerSecret)
|
||||
attributeTermRepository = AttributeTermRepository(baseUrl, consumerKey, consumerSecret)
|
||||
categoryRepository = CategoryRepository(baseUrl, consumerKey, consumerSecret)
|
||||
shippingClassRepository = ShippingClassRepository(baseUrl, consumerKey, consumerSecret)
|
||||
tagRepository = TagRepository(baseUrl, consumerKey, consumerSecret)
|
||||
variationRepository = VariationRepository(baseUrl, consumerKey, consumerSecret)
|
||||
couponRepository = CouponRepository(baseUrl, consumerKey, consumerSecret)
|
||||
customerRepository = CustomerRepository(baseUrl, consumerKey, consumerSecret)
|
||||
orderRepository = OrderRepository(baseUrl, consumerKey, consumerSecret)
|
||||
productRepository = ProductRepository(baseUrl, consumerKey, consumerSecret)
|
||||
reportsRepository = ReportsRepository(baseUrl, consumerKey, consumerSecret)
|
||||
cartRepository = CartRepository(cartBaseUrl, consumerKey, consumerSecret)
|
||||
reviewRepository = ReviewRepository(baseUrl, consumerKey, consumerSecret)
|
||||
paymentGatewayRepository = PaymentGatewayRepository(baseUrl, consumerKey, consumerSecret)
|
||||
settingsRepository = SettingsRepository(baseUrl, consumerKey, consumerSecret)
|
||||
shippingMethodRepository = ShippingMethodRepository(baseUrl, consumerKey, consumerSecret)
|
||||
|
||||
}
|
||||
|
||||
fun OrderNoteRepository(): OrderNoteRepository {
|
||||
return orderNoteRepository
|
||||
}
|
||||
|
||||
fun RefundRepository(): RefundRepository {
|
||||
return refundRepository
|
||||
}
|
||||
|
||||
fun AttributeRepository(): AttributeRepository {
|
||||
return attributeRepository
|
||||
}
|
||||
|
||||
fun AttributeTermRepository(): AttributeTermRepository {
|
||||
return attributeTermRepository
|
||||
}
|
||||
|
||||
fun CategoryRepository(): CategoryRepository {
|
||||
return categoryRepository
|
||||
}
|
||||
|
||||
fun ShippingClassRepository(): ShippingClassRepository {
|
||||
return shippingClassRepository
|
||||
}
|
||||
|
||||
fun TagRepository(): TagRepository {
|
||||
return tagRepository
|
||||
}
|
||||
|
||||
fun VariationRepository(): VariationRepository {
|
||||
return variationRepository
|
||||
}
|
||||
|
||||
fun CouponRepository(): CouponRepository {
|
||||
return couponRepository
|
||||
}
|
||||
|
||||
fun CustomerRepository(): CustomerRepository {
|
||||
return customerRepository
|
||||
}
|
||||
|
||||
fun OrderRepository(): OrderRepository {
|
||||
return orderRepository
|
||||
}
|
||||
|
||||
fun ProductRepository(): ProductRepository {
|
||||
return productRepository
|
||||
}
|
||||
|
||||
fun ReviewRepository(): ReviewRepository {
|
||||
return reviewRepository
|
||||
}
|
||||
|
||||
fun ReportsRepository(): ReportsRepository {
|
||||
return reportsRepository
|
||||
}
|
||||
|
||||
fun PaymentGatewayRepository(): PaymentGatewayRepository {
|
||||
return paymentGatewayRepository
|
||||
}
|
||||
|
||||
fun SettingsRepository(): SettingsRepository {
|
||||
return settingsRepository
|
||||
}
|
||||
|
||||
fun ShippingMethodRepository(): ShippingMethodRepository {
|
||||
return shippingMethodRepository
|
||||
}
|
||||
|
||||
fun CartRepository(context: Context): CartRepository {
|
||||
cartRepository.turnOnCookies(context)
|
||||
return cartRepository
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
val API_V1 = ApiVersion.API_VERSION1
|
||||
val API_V2 = ApiVersion.API_VERSION2
|
||||
val API_V3 = ApiVersion.API_VERSION3
|
||||
|
||||
fun Builder(): Builder {
|
||||
return Builder()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ class Resource<T> private constructor(private val data: T?, private val error: E
|
||||
if ((data as List<*>).size == 0) {
|
||||
status = Status.EMPTY
|
||||
} else {
|
||||
status = status.SUCCESS
|
||||
status = Status.SUCCESS
|
||||
}
|
||||
} else {
|
||||
status = Status.SUCCESS
|
||||
@ -38,14 +38,14 @@ class Resource<T> private constructor(private val data: T?, private val error: E
|
||||
}
|
||||
}
|
||||
|
||||
fun data(): T {
|
||||
fun data(): T? {
|
||||
if (error != null) {
|
||||
throw IllegalStateException("error is not null. Call isSuccessful() first.")
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
fun error(): Exception {
|
||||
fun error(): Exception? {
|
||||
if (data != null) {
|
||||
throw IllegalStateException("data is not null. Call isSuccessful() first.")
|
||||
}
|
||||
|
||||
@ -7,20 +7,20 @@ import java.io.Serializable
|
||||
class BillingAddress : Serializable {
|
||||
var id: Int = 0
|
||||
@SerializedName("first_name")
|
||||
var firstName: String
|
||||
lateinit var firstName: String
|
||||
@SerializedName("last_name")
|
||||
var lastName: String
|
||||
var company: String
|
||||
lateinit var lastName: String
|
||||
lateinit var company: String
|
||||
@SerializedName("address_1")
|
||||
var address1: String
|
||||
lateinit var address1: String
|
||||
@SerializedName("address_2")
|
||||
var address2: String
|
||||
var city: String
|
||||
var state: String
|
||||
var postcode: String
|
||||
var country: String
|
||||
var email: String
|
||||
var phone: String
|
||||
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"
|
||||
|
||||
@ -7,20 +7,20 @@ import java.util.ArrayList
|
||||
|
||||
class LineItem {
|
||||
|
||||
var subtotal: String
|
||||
lateinit var subtotal: String
|
||||
@SerializedName("subtotal_tax")
|
||||
var subtotalTax: String
|
||||
var total: String
|
||||
var totalTax: String
|
||||
var price: String
|
||||
lateinit var subtotalTax: String
|
||||
lateinit var total: String
|
||||
lateinit var totalTax: String
|
||||
lateinit var price: String
|
||||
var quantity: Int = 0
|
||||
var taxClass: Any
|
||||
var name: String
|
||||
lateinit var taxClass: Any
|
||||
lateinit var name: String
|
||||
|
||||
@SerializedName("product_id")
|
||||
var productId: Int = 0
|
||||
|
||||
var sku: String
|
||||
var variations: String
|
||||
lateinit var sku: String
|
||||
lateinit var variations: String
|
||||
var meta: List<Metum> = ArrayList()
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import java.io.Serializable
|
||||
|
||||
class Metadata : Serializable {
|
||||
var id: Int = 0
|
||||
var key: String
|
||||
lateinit var key: String
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -9,50 +9,50 @@ import java.util.Date
|
||||
class Order {
|
||||
var id: Int = 0
|
||||
@SerializedName("number")
|
||||
var orderNumber: String
|
||||
lateinit var orderNumber: String
|
||||
@SerializedName("created_at")
|
||||
var createdAt: String
|
||||
lateinit var createdAt: String
|
||||
|
||||
@SerializedName("date_created")
|
||||
var dateCreated: Date
|
||||
lateinit var dateCreated: Date
|
||||
|
||||
@SerializedName("updated_at")
|
||||
var updatedAt: String
|
||||
lateinit var updatedAt: String
|
||||
@SerializedName("completed_at")
|
||||
var completedAt: String
|
||||
var status: String
|
||||
var currency: String
|
||||
var total: String
|
||||
var subtotal: String
|
||||
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")
|
||||
var totalTax: String
|
||||
lateinit var totalTax: String
|
||||
@SerializedName("total_shipping")
|
||||
var totalShipping: String
|
||||
lateinit var totalShipping: String
|
||||
@SerializedName("cart_tax")
|
||||
var cartTax: String
|
||||
lateinit var cartTax: String
|
||||
@SerializedName("shipping_tax")
|
||||
var shippingTax: String
|
||||
lateinit var shippingTax: String
|
||||
@SerializedName("total_discount")
|
||||
var totalDiscount: String
|
||||
lateinit var totalDiscount: String
|
||||
@SerializedName("shipping_methods")
|
||||
var shippingMethods: String
|
||||
lateinit var shippingMethods: String
|
||||
@SerializedName("payment_details")
|
||||
var paymentDetails: PaymentDetails
|
||||
lateinit var paymentDetails: PaymentDetails
|
||||
@SerializedName("billing")
|
||||
var billingAddress: BillingAddress
|
||||
lateinit var billingAddress: BillingAddress
|
||||
@SerializedName("shipping")
|
||||
var shippingAddress: ShippingAddress
|
||||
var note: String
|
||||
lateinit var shippingAddress: ShippingAddress
|
||||
lateinit var note: String
|
||||
@SerializedName("customer_ip")
|
||||
var customerIp: String
|
||||
lateinit var customerIp: String
|
||||
@SerializedName("customer_user_agent")
|
||||
var customerUserAgent: String
|
||||
lateinit var customerUserAgent: String
|
||||
@SerializedName("customer_id")
|
||||
var customerId: Int? = null
|
||||
@SerializedName("view_order_url")
|
||||
var viewOrderUrl: String
|
||||
lateinit var viewOrderUrl: String
|
||||
@SerializedName("line_items")
|
||||
var lineItems: MutableList<LineItem> = ArrayList()
|
||||
@SerializedName("shipping_lines")
|
||||
@ -63,31 +63,8 @@ class Order {
|
||||
var feeLines: List<FeeLine> = ArrayList()
|
||||
@SerializedName("coupon_lines")
|
||||
var couponLines: List<Any> = ArrayList()
|
||||
var customer: Customer
|
||||
lateinit var customer: Customer
|
||||
|
||||
fun getId(): Int? {
|
||||
return id
|
||||
}
|
||||
|
||||
fun setId(id: Int?) {
|
||||
this.id = id!!
|
||||
}
|
||||
|
||||
fun getTotalLineItemsQuantity(): Int? {
|
||||
return totalLineItemsQuantity
|
||||
}
|
||||
|
||||
fun setTotalLineItemsQuantity(totalLineItemsQuantity: Int?) {
|
||||
this.totalLineItemsQuantity = totalLineItemsQuantity!!
|
||||
}
|
||||
|
||||
fun getLineItems(): List<LineItem> {
|
||||
return lineItems
|
||||
}
|
||||
|
||||
fun setLineItems(lineItems: MutableList<LineItem>) {
|
||||
this.lineItems = lineItems
|
||||
}
|
||||
|
||||
fun addLineItem(lineItem: LineItem) {
|
||||
lineItems.add(lineItem)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class OrderData {
|
||||
var order: Order
|
||||
lateinit var order: Order
|
||||
}
|
||||
|
||||
@ -7,9 +7,9 @@ import java.util.ArrayList
|
||||
|
||||
class OrderNote {
|
||||
var id: Int = 0
|
||||
var author: String
|
||||
var date_created: String
|
||||
var date_created_gmt: String
|
||||
var note: String
|
||||
lateinit var author: String
|
||||
lateinit var date_created: String
|
||||
lateinit var date_created_gmt: String
|
||||
lateinit var note: String
|
||||
var isCustomer_note: Boolean = false
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@ import com.google.gson.annotations.SerializedName
|
||||
|
||||
class PaymentDetails {
|
||||
@SerializedName("method_id")
|
||||
var methodId: String
|
||||
lateinit var methodId: String
|
||||
@SerializedName("method_title")
|
||||
var methodTitle: String
|
||||
lateinit var methodTitle: String
|
||||
var paid: Boolean? = null
|
||||
}
|
||||
|
||||
@ -2,13 +2,13 @@ package me.gilo.woodroid.models
|
||||
|
||||
class PaymentGateway {
|
||||
|
||||
var id: String
|
||||
var title: String
|
||||
var description: String
|
||||
lateinit var id: String
|
||||
lateinit var title: String
|
||||
lateinit var description: String
|
||||
var order: Int = 0
|
||||
var isEnabled: Boolean = false
|
||||
var method_title: String
|
||||
var method_description: String
|
||||
var method_supports: Array<String>
|
||||
var settings: Map<String, PaymentGatewaySetting>
|
||||
lateinit var method_title: String
|
||||
lateinit var method_description: String
|
||||
lateinit var method_supports: Array<String>
|
||||
lateinit var settings: Map<String, PaymentGatewaySetting>
|
||||
}
|
||||
|
||||
@ -4,13 +4,13 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
class PaymentGatewaySetting {
|
||||
|
||||
var id: String
|
||||
var label: String
|
||||
var description: String
|
||||
var type: String
|
||||
var value: String
|
||||
lateinit var id: String
|
||||
lateinit var label: String
|
||||
lateinit var description: String
|
||||
lateinit var type: String
|
||||
lateinit var value: String
|
||||
@JsonProperty("default")
|
||||
var default_value: String
|
||||
var tip: String
|
||||
var placeholder: String
|
||||
lateinit var default_value: String
|
||||
lateinit var tip: String
|
||||
lateinit var placeholder: String
|
||||
}
|
||||
|
||||
@ -8,66 +8,66 @@ import java.util.Date
|
||||
class Product : Serializable {
|
||||
|
||||
var id: Int = 0
|
||||
var name: String
|
||||
lateinit var name: String
|
||||
var slug: String? = null
|
||||
var permalink: String? = null
|
||||
var type: String? = null
|
||||
var status: String
|
||||
lateinit var status: String
|
||||
var isFeatured: Boolean = false
|
||||
var catalog_visibility: String
|
||||
var description: String
|
||||
var short_description: String
|
||||
var sku: String
|
||||
var price: String
|
||||
var regular_price: String
|
||||
var sale_price: String
|
||||
var date_on_sale_from: Date
|
||||
var date_on_sale_from_gmt: Date
|
||||
var date_on_sale_to: Date
|
||||
var date_on_sale_to_gmt: Date
|
||||
var price_html: String
|
||||
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
|
||||
var downloads: ArrayList<Download>
|
||||
lateinit var downloads: ArrayList<Download>
|
||||
var download_limit: Int = 0
|
||||
var download_expiry: Int = 0
|
||||
var external_url: String
|
||||
var button_text: String
|
||||
var tax_status: String
|
||||
var tax_class: String
|
||||
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
|
||||
var backorders: String
|
||||
lateinit var backorders: String
|
||||
var isBackorders_allowed: Boolean = false
|
||||
var isBackordered: Boolean = false
|
||||
var isSold_individually: Boolean = false
|
||||
var weight: String
|
||||
var dimensions: Any
|
||||
lateinit var weight: String
|
||||
lateinit var dimensions: Any
|
||||
var isShipping_required: Boolean = false
|
||||
var isShipping_taxable: Boolean = false
|
||||
var shipping_class: String
|
||||
lateinit var shipping_class: String
|
||||
var shipping_class_id: Int = 0
|
||||
var isReviews_allowed: Boolean = false
|
||||
var average_rating: String
|
||||
lateinit var average_rating: String
|
||||
var rating_count: Int = 0
|
||||
var related_ids: ArrayList<Int>
|
||||
var upsell_ids: ArrayList<Int>
|
||||
var cross_sell_ids: ArrayList<Int>
|
||||
lateinit var related_ids: ArrayList<Int>
|
||||
lateinit var upsell_ids: ArrayList<Int>
|
||||
lateinit var cross_sell_ids: ArrayList<Int>
|
||||
var parent_id: Int = 0
|
||||
var purchase_note: String
|
||||
var categories: ArrayList<Category>
|
||||
var tags: ArrayList<Tag>
|
||||
var attributes: ArrayList<Attribute>
|
||||
var default_attributes: ArrayList<DefaultAttribute>
|
||||
var variations: ArrayList<Int>
|
||||
var grouped_products: ArrayList<Int>
|
||||
lateinit var purchase_note: String
|
||||
lateinit var categories: ArrayList<Category>
|
||||
lateinit var tags: ArrayList<Tag>
|
||||
lateinit var attributes: ArrayList<Attribute>
|
||||
lateinit var default_attributes: ArrayList<DefaultAttribute>
|
||||
lateinit var variations: ArrayList<Int>
|
||||
lateinit var grouped_products: ArrayList<Int>
|
||||
var menu_order: Int = 0
|
||||
var meta_data: ArrayList<Metadata>
|
||||
var images: ArrayList<Image>
|
||||
lateinit var meta_data: ArrayList<Metadata>
|
||||
lateinit var images: ArrayList<Image>
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,10 +9,10 @@ class ProductReview : Serializable {
|
||||
var date_created: Date? = null
|
||||
var date_created_gmt: Date? = null
|
||||
var product_id: Int = 0
|
||||
var reviewer: String
|
||||
var reviewer_email: String
|
||||
lateinit var reviewer: String
|
||||
lateinit var reviewer_email: String
|
||||
|
||||
var reviewer_avatar_urls: Map<String, String>
|
||||
lateinit var reviewer_avatar_urls: Map<String, String>
|
||||
|
||||
var review: String? = null
|
||||
var rating: Int = 0
|
||||
|
||||
@ -4,16 +4,16 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
class SettingOption {
|
||||
|
||||
var id: String
|
||||
var label: String
|
||||
var description: String
|
||||
var value: String
|
||||
lateinit var id: String
|
||||
lateinit var label: String
|
||||
lateinit var description: String
|
||||
lateinit var value: String
|
||||
|
||||
@JsonProperty("default")
|
||||
var default_value: String
|
||||
var tip: String
|
||||
var placeholder: String
|
||||
var type: String
|
||||
var options: Map<String, String>
|
||||
var group_id: String
|
||||
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
|
||||
}
|
||||
|
||||
@ -5,18 +5,18 @@ import com.google.gson.annotations.SerializedName
|
||||
class ShippingAddress {
|
||||
var id: Int = 0
|
||||
@SerializedName("first_name")
|
||||
var firstName: String
|
||||
lateinit var firstName: String
|
||||
@SerializedName("last_name")
|
||||
var lastName: String
|
||||
var company: String
|
||||
lateinit var lastName: String
|
||||
lateinit var company: String
|
||||
@SerializedName("address_1")
|
||||
var address1: String
|
||||
lateinit var address1: String
|
||||
@SerializedName("address_2")
|
||||
var address2: String
|
||||
var city: String
|
||||
var state: String
|
||||
var postcode: String
|
||||
var country: String
|
||||
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" +
|
||||
|
||||
@ -4,8 +4,8 @@ import com.google.gson.annotations.SerializedName
|
||||
|
||||
class ShippingClass {
|
||||
var id: Int = 0
|
||||
var name: String
|
||||
var slug: String
|
||||
var description: String
|
||||
lateinit var name: String
|
||||
lateinit var slug: String
|
||||
lateinit var description: String
|
||||
var count: Int = 0
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package me.gilo.woodroid.models
|
||||
|
||||
class TaxClass {
|
||||
var slug: String
|
||||
var name: String
|
||||
lateinit var slug: String
|
||||
lateinit var name: String
|
||||
}
|
||||
|
||||
@ -6,66 +6,66 @@ import java.util.Date
|
||||
class Variation {
|
||||
|
||||
var id: Int = 0
|
||||
internal var title: String
|
||||
internal var name: String
|
||||
var slug: String
|
||||
var permalink: String
|
||||
var type: String
|
||||
var status: String
|
||||
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
|
||||
var catalog_visibility: String
|
||||
var description: String
|
||||
var short_description: String
|
||||
var sku: String
|
||||
var price: String
|
||||
var regular_price: String
|
||||
var sale_price: String
|
||||
var date_on_sale_from: Date
|
||||
var date_on_sale_from_gmt: Date
|
||||
var date_on_sale_to: Date
|
||||
var date_on_sale_to_gmt: Date
|
||||
var price_html: String
|
||||
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
|
||||
var downloads: ArrayList<Download>
|
||||
lateinit var downloads: ArrayList<Download>
|
||||
var download_limit: Int = 0
|
||||
var download_expiry: Int = 0
|
||||
var external_url: String
|
||||
var button_text: String
|
||||
var tax_status: String
|
||||
var tax_class: String
|
||||
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
|
||||
var backorders: String
|
||||
lateinit var backorders: String
|
||||
var isBackorders_allowed: Boolean = false
|
||||
var isBackordered: Boolean = false
|
||||
var isSold_individually: Boolean = false
|
||||
var weight: String
|
||||
var dimensions: Any
|
||||
lateinit var weight: String
|
||||
lateinit var dimensions: Any
|
||||
var isShipping_required: Boolean = false
|
||||
var isShipping_taxable: Boolean = false
|
||||
var shipping_class: String
|
||||
lateinit var shipping_class: String
|
||||
var shipping_class_id: Int = 0
|
||||
var isReviews_allowed: Boolean = false
|
||||
var average_rating: String
|
||||
lateinit var average_rating: String
|
||||
var rating_count: Int = 0
|
||||
var related_ids: ArrayList<Int>
|
||||
var upsell_ids: ArrayList<Int>
|
||||
var cross_sell_ids: ArrayList<Int>
|
||||
lateinit var related_ids: ArrayList<Int>
|
||||
lateinit var upsell_ids: ArrayList<Int>
|
||||
lateinit var cross_sell_ids: ArrayList<Int>
|
||||
var parent_id: Int = 0
|
||||
var purchase_note: String
|
||||
var categories: ArrayList<Category>
|
||||
var tags: ArrayList<Tag>
|
||||
var attributes: ArrayList<Attribute>
|
||||
var default_attributes: ArrayList<DefaultAttribute>
|
||||
var grouped_products: ArrayList<Int>
|
||||
lateinit var purchase_note: String
|
||||
lateinit var categories: ArrayList<Category>
|
||||
lateinit var tags: ArrayList<Tag>
|
||||
lateinit var attributes: ArrayList<Attribute>
|
||||
lateinit var default_attributes: ArrayList<DefaultAttribute>
|
||||
lateinit var grouped_products: ArrayList<Int>
|
||||
var menu_order: Int = 0
|
||||
var meta_data: ArrayList<Metadata>
|
||||
var images: ArrayList<Image>
|
||||
lateinit var meta_data: ArrayList<Metadata>
|
||||
lateinit var images: ArrayList<Image>
|
||||
|
||||
fun getTitle(): String {
|
||||
return name
|
||||
|
||||
@ -4,16 +4,16 @@ import java.util.Date
|
||||
|
||||
class Webhook {
|
||||
var id: Int = 0
|
||||
var name: String
|
||||
var status: String
|
||||
var topic: String
|
||||
var resource: String
|
||||
var event: String
|
||||
var hooks: Array<String>
|
||||
var delivery_url: String
|
||||
var secret: String
|
||||
var date_created: Date
|
||||
var date_created_gmt: Date
|
||||
var date_modified: Date
|
||||
var date_modified_gmt: Date
|
||||
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
|
||||
}
|
||||
|
||||
@ -5,15 +5,15 @@ import java.util.Date
|
||||
class WebhookDelivery {
|
||||
|
||||
var id: Int = 0
|
||||
var duration: String
|
||||
var summary: String
|
||||
var request_url: String
|
||||
var request_headers: Map<String, String>
|
||||
var request_body: String
|
||||
var response_code: String
|
||||
var response_message: String
|
||||
var response_headers: Map<String, String>
|
||||
var response_body: String
|
||||
var date_created: Date
|
||||
var date_created_gmt: Date
|
||||
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
|
||||
}
|
||||
|
||||
@ -2,8 +2,8 @@ package me.gilo.woodroid.models.filters
|
||||
|
||||
class CustomerFilter : ListFilter() {
|
||||
|
||||
internal lateinit var email: String
|
||||
internal lateinit var role: String
|
||||
private lateinit var email: String
|
||||
private lateinit var role: String
|
||||
|
||||
//all, administrator, editor, author, contributor, subscriber, customer and shop_manager
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class OrderRepository(baseUrl: String, consumerKey: String, consumerSecret: Stri
|
||||
|
||||
if (cartOrder != null) {
|
||||
cartOrder.addLineItem(lineItem)
|
||||
return apiService.update(cartOrder.getId()!!, cartOrder)
|
||||
return apiService.update(cartOrder.id, cartOrder)
|
||||
} else {
|
||||
cartOrder = Order()
|
||||
cartOrder.orderNumber = "Cart"
|
||||
|
||||
@ -10,34 +10,30 @@ import retrofit2.Call
|
||||
class OrderNoteRepository(baseUrl: String, consumerKey: String, consumerSecret: String) :
|
||||
WooRepository(baseUrl, consumerKey, consumerSecret) {
|
||||
|
||||
private val apiService: OrderNoteAPI
|
||||
|
||||
init {
|
||||
apiService = retrofit.create(OrderNoteAPI::class.java)
|
||||
}
|
||||
private val apiService: OrderNoteAPI = retrofit.create(OrderNoteAPI::class.java)
|
||||
|
||||
fun create(order: Order, note: OrderNote): Call<OrderNote> {
|
||||
return apiService.create(order.getId()!!, note)
|
||||
return apiService.create(order.id, note)
|
||||
}
|
||||
|
||||
fun note(order: Order, id: Int): Call<OrderNote> {
|
||||
return apiService.view(order.getId()!!, id)
|
||||
return apiService.view(order.id, id)
|
||||
}
|
||||
|
||||
fun notes(order: Order): Call<List<OrderNote>> {
|
||||
return apiService.list(order.getId()!!)
|
||||
return apiService.list(order.id)
|
||||
}
|
||||
|
||||
fun notes(order: Order, orderNoteFilter: OrderNoteFilter): Call<List<OrderNote>> {
|
||||
return apiService.filter(order.getId()!!, orderNoteFilter.filters)
|
||||
return apiService.filter(order.id, orderNoteFilter.filters)
|
||||
}
|
||||
|
||||
fun delete(order: Order, id: Int): Call<OrderNote> {
|
||||
return apiService.delete(order.getId()!!, id)
|
||||
return apiService.delete(order.id, id)
|
||||
}
|
||||
|
||||
fun delete(order: Order, id: Int, force: Boolean): Call<OrderNote> {
|
||||
return apiService.delete(order.getId()!!, id, force)
|
||||
return apiService.delete(order.id, id, force)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -10,35 +10,30 @@ import retrofit2.Call
|
||||
class RefundRepository(baseUrl: String, consumerKey: String, consumerSecret: String) :
|
||||
WooRepository(baseUrl, consumerKey, consumerSecret) {
|
||||
|
||||
private val apiService: RefundAPI
|
||||
|
||||
init {
|
||||
apiService = retrofit.create(RefundAPI::class.java)
|
||||
|
||||
}
|
||||
private val apiService: RefundAPI = retrofit.create(RefundAPI::class.java)
|
||||
|
||||
fun create(order: Order, refund: Refund): Call<Refund> {
|
||||
return apiService.create(order.getId()!!, refund)
|
||||
return apiService.create(order.id, refund)
|
||||
}
|
||||
|
||||
fun refund(order: Order, id: Int): Call<Refund> {
|
||||
return apiService.view(order.getId()!!, id)
|
||||
return apiService.view(order.id, id)
|
||||
}
|
||||
|
||||
fun refunds(order: Order): Call<List<Refund>> {
|
||||
return apiService.list(order.getId()!!)
|
||||
return apiService.list(order.id)
|
||||
}
|
||||
|
||||
fun refunds(order: Order, refundFilter: RefundFilter): Call<List<Refund>> {
|
||||
return apiService.filter(order.getId()!!, refundFilter.filters)
|
||||
return apiService.filter(order.id, refundFilter.filters)
|
||||
}
|
||||
|
||||
fun delete(order: Order, id: Int): Call<Refund> {
|
||||
return apiService.delete(order.getId()!!, id)
|
||||
return apiService.delete(order.id, id)
|
||||
}
|
||||
|
||||
fun delete(order: Order, id: Int, force: Boolean): Call<Refund> {
|
||||
return apiService.delete(order.getId()!!, id, force)
|
||||
return apiService.delete(order.id, id, force)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,11 +9,7 @@ import retrofit2.Call
|
||||
class AttributeRepository(baseUrl: String, consumerKey: String, consumerSecret: String) :
|
||||
WooRepository(baseUrl, consumerKey, consumerSecret) {
|
||||
|
||||
private val apiService: ProductAttributeAPI
|
||||
|
||||
init {
|
||||
apiService = retrofit.create(ProductAttributeAPI::class.java)
|
||||
}
|
||||
private val apiService: ProductAttributeAPI = retrofit.create(ProductAttributeAPI::class.java)
|
||||
|
||||
fun create(attribute: Attribute): Call<Attribute> {
|
||||
return apiService.create(attribute)
|
||||
|
||||
@ -9,11 +9,7 @@ import retrofit2.Call
|
||||
class AttributeTermRepository(baseUrl: String, consumerKey: String, consumerSecret: String) :
|
||||
WooRepository(baseUrl, consumerKey, consumerSecret) {
|
||||
|
||||
private val apiService: ProductAttributeTermAPI
|
||||
|
||||
init {
|
||||
apiService = retrofit.create(ProductAttributeTermAPI::class.java)
|
||||
}
|
||||
private val apiService: ProductAttributeTermAPI = retrofit.create(ProductAttributeTermAPI::class.java)
|
||||
|
||||
fun create(attribute_id: Int, term: AttributeTerm): Call<AttributeTerm> {
|
||||
return apiService.create(attribute_id, term)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user