use of net.osmand.live.subscriptions.AmazonIAPHelper in project OsmAnd-tools by osmandapp.
the class UserdataController method revalidateAmazonSubscription.
private SupporterDeviceSubscription revalidateAmazonSubscription(SupporterDeviceSubscription s) {
if (amazonIAPHelper == null) {
amazonIAPHelper = new AmazonIAPHelper();
}
try {
if (s.orderId == null) {
return s;
}
AmazonSubscription subscription = amazonIAPHelper.getAmazonSubscription(s.orderId, s.purchaseToken);
if (subscription != null) {
if (s.expiretime == null || s.expiretime.getTime() < subscription.renewalDate) {
s.expiretime = new Date(subscription.renewalDate);
// s.checktime = new Date(); // don't set checktime let jenkins do its job
s.valid = System.currentTimeMillis() < subscription.renewalDate;
subscriptionsRepo.save(s);
}
}
} catch (IOException e) {
LOG.error(String.format("Error retrieving amazon subscription %s - %s: %s", s.sku, s.orderId, e.getMessage()), e);
}
return s;
}
Aggregations