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

Fix purchase flow

parent 22d19b66
......@@ -49,9 +49,6 @@ public final class Client {
You probably want to do this as soon as the consumer application starts.
*/
public static func bootstrap() {
#if os(iOS)
store.startObservingTransactions()
#endif
// preload servers from optionally bundled JSON
if let data = configuration.bundledServersJSON {
......@@ -79,6 +76,15 @@ public final class Client {
providers.accountProvider.listPlanProducts(nil)
#endif
}
/**
Observe Purchase transactions
*/
public static func observeTransactions() {
#if os(iOS)
store.startObservingTransactions()
#endif
}
/**
Disposes the client resources and observers.
......
......@@ -130,7 +130,11 @@ class AppStoreProvider: NSObject, InAppProvider {
private func addUncreditedTransaction(_ transaction: SKPaymentTransaction) {
log.debug("Adding uncredited transaction: \(transaction)")
uncreditedTransactions.append(AppStoreTransaction(native: transaction))
if let _ = Client.configuration.plan(forProductIdentifier: transaction.payment.productIdentifier) {
//Only add the uncredited transaction if the plan is available
uncreditedTransactions.append(AppStoreTransaction(native: transaction))
}
log.debug("Uncredited transactions now: \(uncreditedTransactions)")
......
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