Skip to content

Commit d6913d7

Browse files
author
Robot Media
committed
Removed unnecessary methods.
1 parent 4af42bb commit d6913d7

File tree

2 files changed

+1
-64
lines changed

2 files changed

+1
-64
lines changed

AndroidBillingLibrary/src/net/robotmedia/billing/BillingController.java

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -165,35 +165,7 @@ public static int countPurchases(Context context, String itemId) {
165165
itemId = salt != null ? Security.obfuscate(context, salt, itemId) : itemId;
166166
return TransactionManager.countPurchases(context, itemId);
167167
}
168-
169-
/**
170-
* Returns the number of purchases for the specified item, minus the number
171-
* of cancellations and refunds.
172-
*
173-
* @param context
174-
* @param itemId
175-
* id of the item whose purchases will be counted.
176-
* @return number of net purchases for the specified item.
177-
*/
178-
public static int countPurchasesNet(Context context, String itemId) {
179-
final List<Transaction> transactions = BillingController.getTransactions(context, itemId);
180-
int count = 0;
181-
for (Transaction t : transactions) {
182-
switch (t.purchaseState) {
183-
case PURCHASED:
184-
count++;
185-
break;
186-
case CANCELLED:
187-
count--;
188-
break;
189-
case REFUNDED:
190-
count--;
191-
break;
192-
}
193-
}
194-
return count;
195-
}
196-
168+
197169
protected static void debug(String message) {
198170
if (debug) {
199171
Log.d(LOG_TAG, message);
@@ -276,19 +248,6 @@ public static boolean isPurchased(Context context, String itemId) {
276248
return TransactionManager.isPurchased(context, itemId);
277249
}
278250

279-
/**
280-
* Returns true if there have been purchases for the specified item and the
281-
* number is greater than the number of cancellations and refunds.
282-
*
283-
* @param context
284-
* @param itemId
285-
* item id
286-
* @return true if there are net purchases for the item, false otherwise.
287-
*/
288-
public static boolean isPurchasedNet(Context context, String itemId) {
289-
return countPurchasesNet(context, itemId) > 0;
290-
}
291-
292251
/**
293252
* Notifies observers of the purchase state change of the specified item.
294253
*

AndroidBillingLibraryTest/src/net/robotmedia/billing/BillingControllerTest.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ public void testIsPurchased() throws Exception {
5555
assertTrue(BillingController.isPurchased(getContext(), TransactionTest.TRANSACTION_1.productId));
5656
}
5757

58-
@MediumTest
59-
public void testIsPurchasedNet() throws Exception {
60-
assertFalse(BillingController.isPurchasedNet(getContext(), TransactionTest.TRANSACTION_1.productId));
61-
BillingController.storeTransaction(getContext(), TransactionTest.TRANSACTION_1);
62-
assertTrue(BillingController.isPurchasedNet(getContext(), TransactionTest.TRANSACTION_1.productId));
63-
BillingController.storeTransaction(getContext(), TransactionTest.TRANSACTION_1_REFUNDED);
64-
assertFalse(BillingController.isPurchasedNet(getContext(), TransactionTest.TRANSACTION_1.productId));
65-
BillingController.storeTransaction(getContext(), TransactionTest.TRANSACTION_2);
66-
assertFalse(BillingController.isPurchasedNet(getContext(), TransactionTest.TRANSACTION_1.productId));
67-
}
68-
6958
@MediumTest
7059
public void testCountPurchases() throws Exception {
7160
assertEquals(BillingController.countPurchases(getContext(), TransactionTest.TRANSACTION_1.productId), 0);
@@ -77,17 +66,6 @@ public void testCountPurchases() throws Exception {
7766
assertEquals(BillingController.countPurchases(getContext(), TransactionTest.TRANSACTION_1.productId), 1);
7867
}
7968

80-
@MediumTest
81-
public void testCountPurchasesNet() throws Exception {
82-
assertEquals(BillingController.countPurchasesNet(getContext(), TransactionTest.TRANSACTION_1.productId), 0);
83-
BillingController.storeTransaction(getContext(), TransactionTest.TRANSACTION_1);
84-
assertEquals(BillingController.countPurchasesNet(getContext(), TransactionTest.TRANSACTION_1.productId), 1);
85-
BillingController.storeTransaction(getContext(), TransactionTest.TRANSACTION_1_REFUNDED);
86-
assertEquals(BillingController.countPurchasesNet(getContext(), TransactionTest.TRANSACTION_1.productId), 0);
87-
BillingController.storeTransaction(getContext(), TransactionTest.TRANSACTION_2);
88-
assertEquals(BillingController.countPurchasesNet(getContext(), TransactionTest.TRANSACTION_1.productId), 0);
89-
}
90-
9169
@MediumTest
9270
public void testGetTransactions() throws Exception {
9371
final List<Transaction> transactions0 = BillingController.getTransactions(getContext());

0 commit comments

Comments
 (0)