mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-24 04:03:41 +00:00
badge-service: verify App Store and Google Play purchases (#7654)
This commit is contained in:
1 parent
5cddbffaa1
commit
59c588932e
31 files changed
+1574
-79
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user