badge-service: verify App Store and Google Play purchases (#7654)

This commit is contained in:
spaced4ndy authored and GitHub committed 2026-10-13 15:24:07 +00:00
1 parent 5cddbffaa1
commit 59c588932e
31 files changed
+1574 -79

No files matched your search

+3
View File
@@ -244,6 +244,7 @@ data BadgeServiceErrorCode
| BSECodeExpired
| BSEReceiptInvalid
| BSEReceiptUsed
| BSETestPurchase -- the store vouched for a purchase that cost nothing: Apple's sandbox, a Play license tester
| BSEInternal
| BSEUnknown Text -- forwards-compatible: service is deployed ahead of clients
deriving (Eq, Show)
@@ -345,6 +346,7 @@ instance TextEncoding BadgeServiceErrorCode where
BSECodeExpired -> "code_expired"
BSEReceiptInvalid -> "receipt_invalid"
BSEReceiptUsed -> "receipt_used"
BSETestPurchase -> "test_purchase"
BSEInternal -> "internal"
BSEUnknown t -> t
textDecode s = Just $ case s of
@@ -365,6 +367,7 @@ instance TextEncoding BadgeServiceErrorCode where
"code_expired" -> BSECodeExpired
"receipt_invalid" -> BSEReceiptInvalid
"receipt_used" -> BSEReceiptUsed
"test_purchase" -> BSETestPurchase
"internal" -> BSEInternal
t -> BSEUnknown t
+1
View File
@@ -5308,6 +5308,7 @@ storeReceiptRefused :: BadgeServiceErrorCode -> Bool
storeReceiptRefused = \case
BSEReceiptInvalid -> True
BSEReceiptUsed -> True
BSETestPurchase -> True
_ -> False
-- | The same reference the service claims a transaction by, read without verifying anything.