Skip to content

Commit

Permalink
Merge pull request #44 from dietmap/extra-handling-for-sandbox-apple-…
Browse files Browse the repository at this point in the history
…server

Improve receipt validation against two Apple servers: production and …
  • Loading branch information
koziolk committed Apr 28, 2020
2 parents aedd53e + 1d49318 commit afe16ed
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,13 @@ class AppStoreClient {

logger.debug { "processRequest: ReceiptRequest $receiptRequest" }

val receiptResponse: ReceiptResponse =
var receiptResponse: ReceiptResponse =
productionRestTemplate.postForObject("/verifyReceipt", prepareHttpHeaders(receiptRequest), ReceiptResponse::class.java)!!

if (receiptResponse.responseStatusCode!! == ResponseStatusCode.CODE_21007) {
receiptResponse = sandboxRestTemplate.postForObject("/verifyReceipt", prepareHttpHeaders(receiptRequest), ReceiptResponse::class.java)!!
}

logger.debug { "processRequest: ReceiptResponse $receiptResponse" }

if (receiptResponse.shouldRetry()) {
Expand Down

0 comments on commit afe16ed

Please sign in to comment.