mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
819 B
Java
47 lines
819 B
Java
package org.tasks.billing;
|
|
|
|
import com.amazon.device.iap.model.Receipt;
|
|
import com.google.gson.GsonBuilder;
|
|
|
|
public class Purchase {
|
|
|
|
private final Receipt receipt;
|
|
|
|
public Purchase(String json) {
|
|
this(new GsonBuilder().create().fromJson(json, Receipt.class));
|
|
}
|
|
|
|
public Purchase(Receipt receipt) {
|
|
this.receipt = receipt;
|
|
}
|
|
|
|
public String getSku() {
|
|
return receipt.getSku();
|
|
}
|
|
|
|
public String toJson() {
|
|
return new GsonBuilder().create().toJson(receipt);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Purchase{" + "receipt=" + receipt + '}';
|
|
}
|
|
|
|
public boolean isCanceled() {
|
|
return false;
|
|
}
|
|
|
|
public int getSubscriptionPrice() {
|
|
return 0;
|
|
}
|
|
|
|
public boolean isMonthly() {
|
|
return false;
|
|
}
|
|
|
|
public boolean isProSubscription() {
|
|
return true;
|
|
}
|
|
}
|