Commit f24ea940 authored by Jose Blaya's avatar Jose Blaya
Browse files

- Add missing completion delegate

- Check if purchases are available before complete the payment
parent 9914362b
......@@ -347,6 +347,10 @@ class DefaultAccountProvider: AccountProvider, ConfigurationAccess, DatabaseAcce
// callback?(uncredited, nil)
// return
// }
if !Client.configuration.arePurchasesAvailable() {
callback?(nil, ClientError.invalidEnvironment)
return
}
self.accessedStore.purchaseProduct(product) { (transaction, error) in
guard let transaction = transaction else {
......@@ -359,6 +363,12 @@ class DefaultAccountProvider: AccountProvider, ConfigurationAccess, DatabaseAcce
}
func restorePurchases(_ callback: SuccessLibraryCallback?) {
if !Client.configuration.arePurchasesAvailable() {
callback?(ClientError.invalidEnvironment)
return
}
accessedStore.refreshPaymentReceipt(callback)
}
......@@ -515,6 +525,11 @@ class DefaultAccountProvider: AccountProvider, ConfigurationAccess, DatabaseAcce
callback?(nil, ClientError.noReceipt)
return
}
if !Client.configuration.arePurchasesAvailable() {
callback?(nil, ClientError.invalidEnvironment)
return
}
webServices.processPayment(credentials: user.credentials, request: payment) { (error) in
if let _ = error {
......
......@@ -85,7 +85,7 @@ public class RestoreSignupViewController: AutolayoutViewController, BrandableNav
vc.metadata = metadata
vc.preset = preset
vc.signupRequest = SignupRequest(email: email)
vc.completionDelegate = completionDelegate
}
}
......
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