All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sailthru.client.params.PurchaseItem Maven / Gradle / Ivy

There is a newer version: 2.4.1
Show newest version
package com.sailthru.client.params;

import com.google.gson.Gson;
import com.sailthru.client.SailthruUtil;
import com.sailthru.client.handler.JsonHandler;

import java.util.Map;
import java.util.List;

/**
 *
 * @author Prajwal Tuladhar 
 */
public class PurchaseItem {
    protected String qty;
    protected String title;
    protected String price;
    protected String id;
    protected String url;
    protected List tags;
    protected Map vars;

    public PurchaseItem(Integer qty, String title, Integer price, String id, String url) {
        this.qty = qty.toString();
        this.title = title;
        this.price = price.toString();
        this.id = id;
        this.url = url;
    }

    public PurchaseItem setTags(List tags) {
        this.tags = tags;
        return this;
    }

    public PurchaseItem setVars(Map vars) {
        this.vars = vars;
        return this;
    }

    public Map toHashMap() {
        Gson gson = SailthruUtil.createGson();
        String json = gson.toJson(this);
        JsonHandler handler = new JsonHandler();
        return (Map)handler.parseResponse(json);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy