All Projects → gilokimu → WooDroid

gilokimu / WooDroid

Licence: other
Simple, robust Woocommerce API sdk for java and android

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to WooDroid

WooCommerceConnector
A Power BI Custom Connector for WooCommerce
Stars: ✭ 27 (-64.94%)
Mutual labels:  woocommerce, woocommerce-api
Hypermarket
If you are looking for a stylish and elegant website template for your online store, Hypermarket is the perfect choice for you.
Stars: ✭ 49 (-36.36%)
Mutual labels:  woocommerce, woocommerce-theme
bootscore
Flexible Bootstrap 5 WordPress starter theme with full WooCommerce support
Stars: ✭ 160 (+107.79%)
Mutual labels:  woocommerce, woocommerce-theme
wc-api-java
Java wrapper for WooCommerce REST API
Stars: ✭ 82 (+6.49%)
Mutual labels:  woocommerce, woocommerce-api
socialify
Socialify - Social Login and support OAuth2 for WordPress based on HybridAuth made by @uptimizt with Love :)
Stars: ✭ 20 (-74.03%)
Mutual labels:  oauth, woocommerce
wp-json-api-flutter
WordPress and WooCommerce JSON API for Flutter Mobile. Register Users, Login (with email or username), Get Users Info, Update Users Info, Update Users Password + more.
Stars: ✭ 24 (-68.83%)
Mutual labels:  woocommerce, woocommerce-api
WooCommerce-Multiple-Free-Gift
WooCommerce giveaway made easy.
Stars: ✭ 24 (-68.83%)
Mutual labels:  woocommerce
mediastack
All in one Docker Compose media server
Stars: ✭ 42 (-45.45%)
Mutual labels:  oauth
VKontakte
[READ ONLY] Subtree split of the SocialiteProviders/VKontakte Provider (see SocialiteProviders/Providers)
Stars: ✭ 82 (+6.49%)
Mutual labels:  oauth
supabase-ui-svelte
Supabase authentication UI for Svelte
Stars: ✭ 83 (+7.79%)
Mutual labels:  oauth
art-woocommerce-order-one-click
Плагин под WooCommerce. Включает режим каталога. Скрываются кнопки купить, появляется кнопка Заказать. Для правильной работы требуются WooCommerce и Contact Form 7
Stars: ✭ 18 (-76.62%)
Mutual labels:  woocommerce
WooCommerceConnector
Integration App for ERPNext to connect to WooCommerce
Stars: ✭ 48 (-37.66%)
Mutual labels:  woocommerce
wc-api-dev
This is a repository is obsolete, WooCommerce REST API is now located in https://github.com/woocommerce/woocommerce-rest-api
Stars: ✭ 45 (-41.56%)
Mutual labels:  woocommerce
AzureADAuthRazorUiServiceApiCertificate
Azure AD flows using ASP.NET Core and Microsoft.Identity
Stars: ✭ 41 (-46.75%)
Mutual labels:  oauth
oauthproxy
This is an oauth2 proxy server
Stars: ✭ 32 (-58.44%)
Mutual labels:  oauth
httpx-oauth
Async OAuth client using HTTPX
Stars: ✭ 55 (-28.57%)
Mutual labels:  oauth
wc-edostavka
Расширение для плагина WP WooCommerce. Добавляет метод доставки курьерской службы СДЭК.
Stars: ✭ 15 (-80.52%)
Mutual labels:  woocommerce
Spotify
[READ ONLY] Subtree split of the SocialiteProviders/Spotify Provider (see SocialiteProviders/Providers)
Stars: ✭ 13 (-83.12%)
Mutual labels:  oauth
goth fiber
Package goth_fiber provides a simple, clean, and idiomatic way to write authentication packages for fiber framework applications.
Stars: ✭ 26 (-66.23%)
Mutual labels:  oauth
twauth-web
A simple Python Flask web app that demonstrates the flow of obtaining a Twitter user OAuth access token
Stars: ✭ 65 (-15.58%)
Mutual labels:  oauth

Woocommerce Android SDK

This is an woocommerce api client for android

Built-based on the documentation: http://woocommerce.github.io/woocommerce-rest-api-docs/#introduction

Installation

Please note that files are still being moved around - the project should be stable before end Feb 2019

Maven dependency:

Step 1. Add the JitPack repository to your build file

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Step 2. Add the dependency

<dependency>
	<groupId>com.github.gilokimu</groupId>
	<artifactId>woodroid</artifactId>
	<version>0.2.0</version>
</dependency>

Gradle dependency:

Step 1. Add the JitPack repository to your build file

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
	implementation 'com.github.gilokimu:woodroid:0.2.0'
}

Getting started

Generate API credentials (Consumer Key & Consumer Secret) following this instructions http://docs.woocommerce.com/document/woocommerce-rest-api/ .

Check out the WooCommerce API endpoints and data that can be manipulated in https://woocommerce.github.io/woocommerce-rest-api-docs/.

Demo

I have left consumer key and secret within the app, for you to test the app without an installation of wordpress. To use my installation of wordpress, here are the credentials:

username: demo password: demo2019 https://gilo.me/store/wp-admin

PS/ Do no harm

Setup

Setup for the new WP REST API integration (WooCommerce 2.6 or later):

val woocommerce = Woocommerce.Builder()
	.setSiteUrl("http://example.com")
	.setApiVersion(Woocommerce.API_V2)
	.setConsumerKey("ck_XXXXX")
	.setConsumerSecret("cs_XXXX")
	.build()

Usage

Getting products example

woocommerce.ProductRepository().products().enqueue(object : Callback<List<Product>> {
        override fun onResponse(call: Call<List<Product>>, response: Response<List<Product>>) {
            val productsResponse = response.body()
            for (product in productsResponse!!) {
                products.add(product)
            }

            adapter.notifyDataSetChanged()
        }

        override fun onFailure(call: Call<List<Product>>, t: Throwable) {

        }
    })

Supported resources

The sdk currently supports :

  1. Order Notes
  2. Refunds
  3. Attributes
  4. Attribute Terms
  5. Product Category
  6. Shipping Class
  7. Product Tags
  8. Variations
  9. Coupons
  10. Customers
  11. Orders
  12. Products
  13. Reports

Coming soon

  1. Settings
  2. Payment gateway

API Methods

The general resource method calls are

  1. Create - Pass the object to create
  2. List - a list of all items
  3. View single method - retries a single item
  4. Delete - deletes the resource
  5. Filter - provides a list that meets a criteria

Create Method

Create an instance of the resource then pass onto a .create() function on the resource repository

val coupon = Coupon()
coupon.code = code
coupon.description = description
        
woocommerce.CouponRepository().create(coupon).enqueue(object : Callback<Coupon> {
    override fun onResponse(call: Call<Coupon>, response: Response<Coupon>) {
        val couponResponse = response.body()
        finish()
    }

    override fun onFailure(call: Call<Coupon>, t: Throwable) {
        
    }
})

List Method

 woocommerce.CouponRepository().coupons().enqueue(object : Callback<List<Coupon>> {
    override fun onResponse(call: Call<List<Coupon>>, response: Response<List<Coupon>>) {
        val couponResponse = response.body()
        for (coupon in couponResponse!!) {
            coupons.add(coupon)
        }

        adapter.notifyDataSetChanged()
    }

    override fun onFailure(call: Call<List<Coupon>>, t: Throwable) {

    }
})

View single item

val couponId = intent.getIntExtra("couponId", 0)

woocommerce.CouponRepository().coupon(couponId).enqueue(object : Callback<Coupon> {
    override fun onResponse(call: Call<Coupon>, response: Response<Coupon>) {
        val coupon = response.body()!!

        etCode.setText(coupon.code.toUpperCase())
        etDescription.setText(coupon.description)

    }

    override fun onFailure(call: Call<Coupon>, t: Throwable) {
        
    }
})

Delete item

woocommerce.CouponRepository().delete(couponId).enqueue(object : Callback<Coupon> {
    override fun onResponse(call: Call<Coupon>, response: Response<Coupon>) {
        if (response.isSuccessful) {
            val coupon = response.body()!!
            finish()
        }else{
            Toast.makeText(this@CouponActivity, "" + response.code() + " : " + response.message(), Toast.LENGTH_SHORT).show()
        }

    }

    override fun onFailure(call: Call<Coupon>, t: Throwable) {
        stopShowingLoading()
    }
})

Filter item

val filter = CouponFilter()
filter.search = "FEB"

woocommerce.CouponRepository().coupons(filter).enqueue(object : Callback<List<Coupon>> {
    override fun onResponse(call: Call<List<Coupon>>, response: Response<List<Coupon>>) {
        val couponResponse = response.body()
        for (coupon in couponResponse!!) {
            coupons.add(coupon)
        }

        adapter.notifyDataSetChanged()
    }

    override fun onFailure(call: Call<List<Coupon>>, t: Throwable) {

    }
})

Sample app

The sample app implements an MVVM approach which would look slightly different from the above. The methods are the same though

Contribution

Contributions are highly welcomed, just create a PR

Slack

You can also reach out through slack in case of any issues with installation or feature request

Love the Project?

You can donate to support the project futher. Donate with Crypto

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].