com.genexus.sd.store.validation.model.PurchasesInformation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gxandroidpublisher Show documentation
Show all versions of gxandroidpublisher Show documentation
Core classes for the runtime used by Java and Android apps generated with GeneXus
package com.genexus.sd.store.validation.model;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.genexus.xml.GXXMLSerializable;
public class PurchasesInformation {
private String appleReceipt;
private int purchasePlatform;
private List purchases = new ArrayList();
public String getAppleReceipt() {
return appleReceipt;
}
public void setAppleReceipt(String appleReceipt) {
this.appleReceipt = appleReceipt;
}
public int getPurchasePlatform() {
return purchasePlatform;
}
public void setPurchasePlatform(int purchasePlatform) {
this.purchasePlatform = purchasePlatform;
}
public List getPurchases() {
return purchases;
}
public void setPurchases(List purchases) {
this.purchases = purchases;
}
public PurchasesInformation(GXXMLSerializable data)
{
String json = data.toJSonString(false);
JSONObject jObj = null;
try {
jObj = new JSONObject(json);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (jObj != null){
try {
if (jObj.has("Receipt")){
this.appleReceipt = jObj.getString("Receipt");
}
if (jObj.has("PurchasePlatform")){
this.purchasePlatform = jObj.getInt("PurchasePlatform");
}
if (jObj.has("Purchases")){
JSONArray purchases = jObj.getJSONArray("Purchases");
for (int i = 0; i < purchases.length(); i++) {
PurchaseResult p = new PurchaseResult(purchases.getJSONObject(i));
this.purchases.add(p);
}
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy