@@ -101,24 +101,10 @@ public void close(final Promise promise){
101101
102102 @ Override
103103 public void onProductPurchased (String productId , TransactionDetails details ) {
104- if (productId == productId && details != null )
104+ if (details != null && productId . equals ( details . productId ) )
105105 {
106106 try {
107- WritableMap map = Arguments .createMap ();
108-
109- map .putString ("receiptData" , details .purchaseInfo .responseData .toString ());
110-
111- if (details .purchaseInfo .signature != null )
112- map .putString ("receiptSignature" , details .purchaseInfo .signature .toString ());
113-
114- map .putString ("productId" , details .productId );
115- map .putString ("orderId" , details .orderId );
116- map .putString ("purchaseToken" , details .purchaseToken );
117- map .putString ("purchaseTime" , details .purchaseTime .toString ());
118-
119- ResponseData responseData = details .purchaseInfo .parseResponseData ();
120- map .putString ("purchaseState" , responseData .purchaseState .toString ());
121-
107+ WritableMap map = mapTransactionDetails (details );
122108 resolvePromise (PromiseConstants .PURCHASE_OR_SUBSCRIBE , map );
123109 } catch (Exception ex ) {
124110 rejectPromise (PromiseConstants .PURCHASE_OR_SUBSCRIBE , "Failure on purchase or subscribe callback: " + ex .getMessage ());
@@ -317,7 +303,7 @@ public void getSubscriptionDetails(final ReadableArray productIds, final Promise
317303 public void getPurchaseTransactionDetails (final String productId , final Promise promise ) {
318304 if (bp != null ) {
319305 TransactionDetails details = bp .getPurchaseTransactionDetails (productId );
320- if (details != null && details . productId .equals (productId ))
306+ if (details != null && productId .equals (details . productId ))
321307 {
322308 WritableMap map = mapTransactionDetails (details );
323309 promise .resolve (map );
@@ -333,7 +319,7 @@ public void getPurchaseTransactionDetails(final String productId, final Promise
333319 public void getSubscriptionTransactionDetails (final String productId , final Promise promise ) {
334320 if (bp != null ) {
335321 TransactionDetails details = bp .getSubscriptionTransactionDetails (productId );
336- if (details != null && details . productId .equals (productId ))
322+ if (details != null && productId .equals (details . productId ))
337323 {
338324 WritableMap map = mapTransactionDetails (details );
339325 promise .resolve (map );
0 commit comments