Skip to content

Commit 783407f

Browse files
committed
1 parent 4153c97 commit 783407f

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

src/src/org/renpy/android/billing/BillingService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public CheckBillingSupported(String itemType) {
214214
super(-1);
215215
mProductType = itemType;
216216
}
217-
217+
218218
@Override
219219
protected long run() throws RemoteException {
220220
Bundle request = makeRequestBundle("CHECK_BILLING_SUPPORTED");
@@ -570,13 +570,18 @@ private void purchaseStateChanged(int startId, String signedData, String signatu
570570
return;
571571
}
572572

573+
if (Consts.DEBUG) {
574+
Log.d(TAG, "purchaseStateChanged: " + signedData);
575+
}
576+
573577
ArrayList<String> notifyList = new ArrayList<String>();
574578
for (VerifiedPurchase vp : purchases) {
575579
if (vp.notificationId != null) {
576580
notifyList.add(vp.notificationId);
577581
}
578582
ResponseHandler.purchaseResponse(this, vp.purchaseState, vp.productId,
579-
vp.orderId, vp.purchaseTime, vp.developerPayload);
583+
vp.orderId, vp.purchaseTime, vp.developerPayload,
584+
vp.purchaseToken, vp.packageName);
580585
}
581586
if (!notifyList.isEmpty()) {
582587
String[] notifyIds = notifyList.toArray(new String[notifyList.size()]);

src/src/org/renpy/android/billing/ResponseHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ public static void buyPageIntentResponse(PendingIntent pendingIntent, Intent int
107107
*/
108108
public static void purchaseResponse(
109109
final Context context, final PurchaseState purchaseState, final String productId,
110-
final String orderId, final long purchaseTime, final String developerPayload) {
110+
final String orderId, final long purchaseTime, final String developerPayload,
111+
final String purchaseToken, final String packageName) {
111112

112113
// Update the database with the purchase state. We shouldn't do that
113114
// from the main thread so we do the work in a background thread.

src/src/org/renpy/android/billing/Security.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,20 @@ public static class VerifiedPurchase {
6868
public String orderId;
6969
public long purchaseTime;
7070
public String developerPayload;
71+
public String purchaseToken;
72+
public String packageName;
7173

7274
public VerifiedPurchase(PurchaseState purchaseState, String notificationId,
73-
String productId, String orderId, long purchaseTime, String developerPayload) {
75+
String productId, String orderId, long purchaseTime, String developerPayload,
76+
String purchaseToken, String packageName) {
7477
this.purchaseState = purchaseState;
7578
this.notificationId = notificationId;
7679
this.productId = productId;
7780
this.orderId = orderId;
7881
this.purchaseTime = purchaseTime;
7982
this.developerPayload = developerPayload;
83+
this.purchaseToken = purchaseToken;
84+
this.packageName = packageName;
8085
}
8186
}
8287

@@ -176,14 +181,15 @@ public static ArrayList<VerifiedPurchase> verifyPurchase(String signedData, Stri
176181
notifyId = jElement.getString("notificationId");
177182
}
178183
String developerPayload = jElement.optString("developerPayload", null);
184+
String purchaseToken = jElement.optString("purchaseToken", null);
179185

180186
// If the purchase state is PURCHASED, then we require a
181187
// verified nonce.
182188
if (purchaseState == PurchaseState.PURCHASED && !verified) {
183189
continue;
184190
}
185191
purchases.add(new VerifiedPurchase(purchaseState, notifyId, productId,
186-
orderId, purchaseTime, developerPayload));
192+
orderId, purchaseTime, developerPayload, purchaseToken, packageName));
187193
}
188194
} catch (JSONException e) {
189195
Log.e(TAG, "JSON exception: ", e);

0 commit comments

Comments
 (0)