Commit 558fe853 authored by Jose Blaya's avatar Jose Blaya
Browse files

Remove uncredited transaction if badReceipt

parent bb1020de
......@@ -378,12 +378,22 @@ class DefaultAccountProvider: AccountProvider, ConfigurationAccess, DatabaseAcce
return
}
guard let credentials = credentials else {
if let error = error as? ClientError, error == .badReceipt {
if let products = Client.store.availableProducts {
for product in products {
if let uncreditedTransaction = Client.store.uncreditedTransaction(for: product) {
self.accessedStore.finishTransaction(uncreditedTransaction, success: false)
}
}
}
}
callback?(nil, error)
return
}
if let transaction = request.transaction {
self.accessedStore.finishTransaction(transaction, success: true)
}
self.accessedDatabase.plain.lastSignupEmail = nil
self.accessedDatabase.secure.setPublicUsername(credentials.username)
self.accessedDatabase.secure.setPassword(credentials.password, for: credentials.username)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment