Skip to content

Commit

Permalink
Handle order verification failure
Browse files Browse the repository at this point in the history
add more logging
expose separate port for monitoring (actuator)
remove explicitly set Xms parameter
  • Loading branch information
wojtekbauman committed Sep 14, 2020
1 parent 92613a7 commit dd147cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jib {
labels = mapOf(
"maintainer" to "Krzysztof Koziol"
)
jvmFlags = listOf("-Xms512m", "-Djava.awt.headless=true")
jvmFlags = listOf("-Djava.awt.headless=true")
mainClass = "com.dietmap.yaak.YaakApplicationKt"
ports = listOf("8080", "9090")
ports = listOf("8080", "8778", "9090")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,18 @@ class GooglePlaySubscriptionService(val androidPublisherApiClient: AndroidPublis

fun verifyOrders(orders: Collection<PurchaseRequest>): Boolean {
orders
.map(::handlePurchase)
.map(::tryToVerifyOrder)
.also { logger.info { "Verified ${it.size} user orders" } }
return userAppClient.checkSubscription()?.status == USER_APP_STATUS_ACTIVE
}

private fun tryToVerifyOrder(purchaseRequest: PurchaseRequest) = try {
logger.debug { "About to verify user order: $purchaseRequest" }
handlePurchase(purchaseRequest)
} catch (e: Exception) {
logger.error(e) { "Error during verification of user order" }
}

private fun handleStatusUpdate(packageName: String, notification: GooglePlaySubscriptionNotification) {
val subscription = androidPublisherApiClient.Purchases().Subscriptions().get(packageName, notification.subscriptionId, notification.purchaseToken).execute()
logger.debug { "Google Play subscription details: $subscription" }
Expand Down

0 comments on commit dd147cb

Please sign in to comment.