br.com.vtex.Main Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vtex-android-sdk Show documentation
Show all versions of vtex-android-sdk Show documentation
Uma biblioteca para ajudar as agências a criar suas lojas Android.
package br.com.vtex;
/**
* Created by felipe-moraais on 10/02/15.
*/
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.async.Callback;
import com.mashape.unirest.http.exceptions.UnirestException;
public class Main {
// ESTE MÉTODO MAIN SERVE PARA TESTES
public static void main(String[] args){
// INSTANCIA O SDK
// TODO -> TRANSFORMAR O VtexSDK CLASSE EM UM SINGLETON
final VtexSDK api = VtexSDK.getInstance("walmartv5");
// DADOS PARA TESTE
final Integer sku = 1;
final Integer quantity = 1;
final Integer seller = 1;
final Integer sallesChannel = 1;
final Callback getOrderFormCallback = new Callback() {
@Override
public void completed(HttpResponse response) {
System.out.println("olar");
System.out.println(response.getStatus());
// TODO mostrar items
System.out.println(response.getHeaders().get("set-cookie"));
}
@Override
public void failed(UnirestException e) {
}
@Override
public void cancelled() {
}
};
Callback callback = new Callback() {
@Override
public void completed(HttpResponse response) {
System.out.println(response.getStatus());
System.out.println(response.getHeaders().get("set-cookie"));
// TODO getOrderForm
api.addToCart(sku, quantity, seller, sallesChannel, getOrderFormCallback);
}
@Override
public void failed(UnirestException e) {
}
@Override
public void cancelled() {
}
};
api.addToCart(sku, quantity, seller, sallesChannel, callback);
System.out.println("after");
// orderForm = api.getOrderForm("http://walmartv5.vtexcommercebeta.com.br/");
// orderForm = api.getOrderForm("http://walmartv5.vtexcommercebeta.com.br/", "[email protected]");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy