-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a coroutine alternative to `purchase()` --------- Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
- Loading branch information
Showing
13 changed files
with
338 additions
and
130 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
api-tester/src/main/java/com/revenuecat/apitester/java/PurchasesTransactionExceptionAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.revenuecat.apitester.java; | ||
|
||
import com.revenuecat.purchases.PurchasesError; | ||
import com.revenuecat.purchases.PurchasesErrorCode; | ||
import com.revenuecat.purchases.PurchasesTransactionException; | ||
|
||
final class PurchasesTransactionExceptionAPI { | ||
static void check(final PurchasesTransactionException exception) { | ||
final String underlyingErrorMessage = exception.getUnderlyingErrorMessage(); | ||
final String message = exception.getMessage(); | ||
final PurchasesErrorCode code = exception.getCode(); | ||
final PurchasesError error = exception.getError(); | ||
final boolean userCancelled = exception.getUserCancelled(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
api-tester/src/main/java/com/revenuecat/apitester/kotlin/PurchasesTransactionExceptionAPI.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.revenuecat.apitester.kotlin | ||
|
||
import com.revenuecat.purchases.PurchasesError | ||
import com.revenuecat.purchases.PurchasesErrorCode | ||
import com.revenuecat.purchases.PurchasesTransactionException | ||
|
||
class PurchasesTransactionExceptionAPI { | ||
fun check(exception: PurchasesTransactionException) { | ||
val underlyingErrorMessage: String? = exception.underlyingErrorMessage | ||
val message: String = exception.message | ||
val code: PurchasesErrorCode = exception.code | ||
val error: PurchasesError = exception.error | ||
val userCancelled: Boolean = exception.userCancelled | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
purchases/src/main/kotlin/com/revenuecat/purchases/PurchaseResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.revenuecat.purchases | ||
|
||
import com.revenuecat.purchases.models.StoreTransaction | ||
|
||
/** | ||
* The result of a successful purchase operation. Used in coroutines. | ||
*/ | ||
data class PurchaseResult( | ||
/** | ||
* The [StoreTransaction] for this purchase. | ||
*/ | ||
val storeTransaction: StoreTransaction, | ||
|
||
/** | ||
* The updated [CustomerInfo] for this user after the purchase has been synced with RevenueCat's servers. | ||
*/ | ||
val customerInfo: CustomerInfo, | ||
) |
2 changes: 1 addition & 1 deletion
2
purchases/src/main/kotlin/com/revenuecat/purchases/PurchasesException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
purchases/src/main/kotlin/com/revenuecat/purchases/PurchasesTransactionException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.revenuecat.purchases | ||
|
||
class PurchasesTransactionException( | ||
purchasesError: PurchasesError, | ||
val userCancelled: Boolean, | ||
) : PurchasesException(purchasesError) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.