gilokimu / woodroid Goto Github PK
View Code? Open in Web Editor NEWSimple, robust Woocommerce API sdk for java and android
Simple, robust Woocommerce API sdk for java and android
404 Not Found https://example.com/wp-json/wc/v2/cart
The woocommerce rest API seems not to have such an endpoint.Instead you should use oders endpoint and handle the cart in your own way
in this repository as
implementation 'com.github.gilokimu:woodroid:0.1.0'
is do not defined API_V3
Hello sir
I got a question
imagine I have a cloth shop and I have attributes color , made_in and special_off (I can already see the attributes when testing by Postman). I need "10 products" with following conditions:
how can I implement this request?
is it possible using (class ProductFilter)?
I have read the woocommerce_rest_api
please tell me how to request products using java
after testing your application with your web site consumer key and password that work fine, now i change them on my own site and when i test application to get products list i get this message:
Response{protocol=http/1.1, code=401,
message=Unauthorized, url=http://www.aklin.ir/wp//wp-json/wc/v2/products?oauth_consumer_key=ck_c559b86adc5460395e3ae483b852201615d29712&oauth_nonce=9.55824708358162E7&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1555420204&oauth_signature=4R%2BipUXvIJBvO2OQjnvnMPLX6WU%3D
i installed and enabled wp-json plugin on this website
class Main : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val woocommerce = Woocommerce.Builder()
.setSiteUrl("http://www.aklin.ir/wp")
.setApiVersion(Woocommerce.API_V2)
.setConsumerKey("ck_c559b86adc5460395e3ae483b852201615d29712")
.setConsumerSecret("cs_5aaa22e54cd35fd42e490ab12c22afb4d99b6225")
.build()
woocommerce.products.enqueue(object : Callback<List<Product>> {
override fun onResponse(call: Call<List<Product>>, response: Response<List<Product>>) {
val productsResponse = response.body()
}
override fun onFailure(call: Call<List<Product>>, t: Throwable) {
}
})
}
}
is any special settings on woocommerce?
can anyone provide me code for using Cart Repository? I am having hard time to figure it out
"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}
This is error I am getting in response
hello, thanks for the project sir, you're doing great, however, im still getting the same error with this issue, is there any solution? i already renamed some class and the error is getting bigger
example :
WooDroid/woodroid/build/intermediates/runtime_library_classes/debug/classes.jar:me/gilo/woodroid/models/Download.class,
Hey there..Please update the model variables to the current woocommerce responses...eg update "discount_tax" from "total_discount" in the orders class
Great work!
But I have issues with product update. After the Update API returns successful, the product will have an empty attributes array.
For example, if I updated a product which have 2 attributes Colour and Size. By the time I called load product from the database, all the attributes are gone.
Please can you help?
Thank you
Hello, update the serialized name of "shipping_address" to "shipping" and from "billing_address" to "billing" in Order.java in the java version of this wooDroid.
Hey there !
I had to change my server's dns from a cwp to a cpanel dns and after that I've got timestamp errors but a day later there wasn't any error . Now I'm getting woocommerce_api_authentication_error 401 error in the logs. I'm not using any SSL (It's like this. "http://example.com") how can I fix this?
I already manually add some implementations because of errors
implementation 'com.github.gilokimu:woodroid:0.2.1'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation "com.google.code.gson:gson:2.8.2"
implementation 'com.squareup.okhttp3:okhttp:4.1.0'
implementation 'com.squareup.okio:okio:2.2.2'
implementation "com.squareup.okhttp3:logging-interceptor:4.1.0"
Did I have to do that?
import me.gilo.woodroid.Woocommerce
import me.gilo.woodroid.models.Product
import retrofit2.*
fun main() {
val siteUrl = "https://si.te/"
val ConsumerKey = "ck_key"
val ConsumerSecret = "cs_secret"
WooComerceProvider(siteUrl, ConsumerKey, ConsumerSecret).loadProducts()
}
class WooComerceProvider(site: String, key: String, secretKey: String) {
private val woocommerce = Woocommerce.Builder()
.setSiteUrl(site)
.setApiVersion(Woocommerce.API_V3)
.setConsumerKey(key)
.setConsumerSecret(secretKey)
.build()
fun loadProducts() {
var products: MutableList<Product> = mutableListOf()
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)
}
}
override fun onFailure(call: Call<List<Product>>, t: Throwable) {
}
})
}
}
and there are more errors
Exception in thread "OkHttp Dispatcher" java.lang.RuntimeException: Stub!
at org.apache.http.message.BasicNameValuePair.(BasicNameValuePair.java:121)
at me.gilo.woodroid.data.auth.AuthIntercepter.getOauthParams(AuthIntercepter.java:90)
at me.gilo.woodroid.data.auth.AuthIntercepter.intercept(AuthIntercepter.java:43)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
at okhttp3.RealCall$AsyncCall.run(RealCall.kt:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Woocommerce.Builder() worked, but the query did not. Sorry, it seems I don't really understand. Could you help me to install/use your package?
Hi! When I run the app with no errors this is my logcat
ActivityManager: Invalid packageName: me.gilo.woodroid.app
Thanks!
Orders pojo model class datas are different from the data from server
Hello! can you help me?
4:01 AM Gradle sync started with IDEA sync 4:01 AM Project setup started 4:02 AM Gradle sync failed: Tooling support for the platform 'JavaScript' is missing. Implement 'IdePlatformKindTooling' for it. (56 s 155 ms) 4:02 AM NDK Resolution Outcome: Project settings: Gradle model version=5.3, NDK version is UNKNOWN
First off, my apologies, I didn't want to open an issue for a support query but I couldn't find any alternative way to reach out (slack maybe?).
I'm a novice Android and WooCommerce developer and I'm trying to access a store using WooDroid but I'm getting the following response whenever I try to grab response from the onResponse
method:
{"code":"woocommerce_rest_authentication_error","message":"Invalid signature - provided signature does not match.","data":{"status":401}}
I setup the new WP REST API integration using the store's credentials (URL, CK and CS) and double checked them. Everything is working fine in Postman.
Any idea how to configure the order completed webhook?
For example: As soon as an order is completed/payment is done, I should be notified via webhook in my android application.
Old Link:
https://xyz.com/wp-json/wc/v2/[endpoints]
New Should Be Like
https://xyz.com/wp-json/wc/store/[endpoints]
I cloned the project and when I try to build it I get the following error:
:app:multiDexListDebug
Type me.gilo.woodroid.models.Download is defined multiple times: /home/omar/Documents/WooDroid/woodroid/build/intermediates/runtime_library_classes/debug/classes.jar:me/gilo/woodroid/models/Download.class, /home/omar/Documents/WooDroid/firebasecart/build/intermediates/runtime_library_classes/classes.jar:me/gilo/woodroid/models/Download.class
I think this is due to both classes with the same name, I will refactor firebasecart Download class and see what happens.
You're doing a great job with this project, thanks
Is it possible to sign in through customer credentials, or restrict the android client to access data for only currently signed in customer user, not all of the data that is related to admins?
hi. i collect some informations from user into the customer's metadata like membership state and some infos for products into the product's metadata that is important for app. but the wooDroid lib not return customer metadata and return product metadata without value. how i can resolve this?
Instead of loading all the values (Products for example) together and then showing them in the list view or recycler ,what if I want to show each value after it's loaded ?
Currently I can accomplish this by running the enque function multiple times keeping the filter as per_page=1 and increasing the page number for each product and then showing it.
But this is not that much efficient as you can understand.
So please suggest how I can load values (Products for example) one by one and show them in the recycler view.
And currently this is what I am doing
val allProducts : MutableLiveData<Product> by lazy {
woocommerce = Woocommerce.Builder().setSiteUrl(baseURL)
.setApiVersion(Woocommerce.API_V2)
.setConsumerKey(consumerKey)
.setConsumerSecret(consumerSecret)
.build()
preLoadProducts()
MutableLiveData<Product>()
}
private fun preLoadProducts() {
val productFilter = ProductFilter()
productFilter.page = pageNum
productFilter.per_page = 1
loadProducts(productFilter)
}
private fun loadProducts(productFilter: ProductFilter){
woocommerce.ProductRepository().products(productFilter).enqueue(object :
Callback<List<Product>> {
override fun onResponse(call: Call<List<Product>>, response: Response<List<Product>>) {
try{
val productsResponse = response.body()
allProducts.value = productsResponse?.get(0)
pageNum ++
preLoadProducts()
}catch (e : Exception){
e.printStackTrace()
allProducts.value = null
}
}
override fun onFailure(call: Call<List<Product>>, t: Throwable) {
t.printStackTrace()
allProducts.value = null
}
})
}
I'm not that much of an expert, but I hope you get the idea.
Thanks
Hi there,
when I try to create customer with follwoing request:
var customer = Customer()
customer.email = "[email protected]
customer.firstName = "test"
customer.lastName = "test"
customer.username = "test test"
It returns "code=400, message=Bad Request"
But when I use
var customer = Customer()
customer.email = "[email protected]
customer.firstName = "test"
customer.lastName = "test"
customer.username = "test test"
customer.password = "Pass123"
above object, customer gets created succesfully.
However I want to create a customer without passing a password.
Please help.
I developed one e-commerce app using woocommerce rest-API. now I need to add coupons codes feature in-app. I know how to pass coupon code in creating order, but how to check this code is valid or not before creating an order?
hi, i have this problem with wooDroid. what i must to do?
please help me
Woocommerce woocommerce = Woocommerce.Builder()
.setSiteUrl("http://parstuts.ir")
.setApiVersion(Woocommerce.API_V3)
.setConsumerKey(ConstantValues.WOOCOMMERCE_CONSUMER_KEY)
.setConsumerSecret(ConstantValues.WOOCOMMERCE_CONSUMER_KEY)
.build();
[size=327 text={"code":"woocommerce_rest_authentication_error","message":"\\u062โฆ]
D/OkHttp: {"code":"woocommerce_rest_authentication_error","message":"\u0627\u0645\u0636\u0627\u0621 \u0646\u0627\u0645\u0639\u062a\u0628\u0631 \u0627\u0633\u062a - \u0627\u0645\u0636\u0627\u06cc \u0627\u0631\u0627\u0626\u0647 \u0634\u062f\u0647 \u0645\u0637\u0627\u0628\u0642\u062a \u0646\u062f\u0627\u0631\u062f.","data":{"status":401}}
<-- END HTTP (327-byte body)
D/OkHttp: <-- 401 Unauthorized http://parstuts.ir/wp-json/wc/v3/products
Can you post Pro-Guard fo this gradle
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.