summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-07-19 14:23:43 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-07-19 13:48:45 +0000
commit33cc3a46bcfee56c57dd0613b06c77b4ec115a99 (patch)
tree4bc43e633f122566c929b95c6b646b2102239d4f
parentd06d68307d6016d7f8d0e08dd914aa3d0c33bb11 (diff)
Android: Fix test purchases after changes in Google Play
After June 20th, Google Play no longer generates order IDs for test purchases, causing an exception to occur in Qt Purchasing when making such purchases and preventing the transaction from being communicated to the application. The orderId and timestamp are not technically required information, so in the case where they are not available, we just ignore it and use defaults instead. [ChangeLog][Android] Fixed test purchases after changes in Google Play that removed the order ID for such transactions. Task-number: QTBUG-54518 Change-Id: If8cd8e4dc76329e572556988b3e65485920c4e0d Reviewed-by: BogDan Vatra <bogdan@kdab.com>
-rw-r--r--src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java b/src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java
index 3ab3d70..002e94b 100644
--- a/src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java
+++ b/src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java
@@ -203,8 +203,8 @@ public class QtInAppPurchase
String productId = jo.getString("productId");
int purchaseState = jo.getInt("purchaseState");
String purchaseToken = jo.getString("purchaseToken");
- String orderId = jo.getString("orderId");
- long timestamp = jo.getLong("purchaseTime");
+ String orderId = jo.has("orderId") ? jo.getString("orderId") : "";
+ long timestamp = jo.has("purchaseTime") ? jo.getLong("purchaseTime") : 0;
if (purchaseState == 0)
registerPurchased(m_nativePointer, productId, signature, data, purchaseToken, orderId, timestamp);
@@ -356,8 +356,10 @@ public class QtInAppPurchase
}
purchaseToken = jo.getString("purchaseToken");
- orderId = jo.getString("orderId");
- timestamp = jo.getLong("purchaseTime");
+ if (jo.has("orderId"))
+ orderId = jo.getString("orderId");
+ if (jo.has("purchaseTime"))
+ timestamp = jo.getLong("purchaseTime");
} catch (Exception e) {
e.printStackTrace();