Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved repurchasing a non-consumable not calling completion, on macOS #465

Merged
merged 1 commit into from
Mar 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions SwiftyStoreKit/PaymentsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ class PaymentsController: TransactionController {
payments.remove(at: paymentIndex)
return true
}

if transactionState == .restored {
print("Unexpected restored transaction for payment \(transactionProductIdentifier)")

let purchase = PurchaseDetails(productId: transactionProductIdentifier, quantity: transaction.payment.quantity, product: payment.product, transaction: transaction, originalTransaction: transaction.original, needsFinishTransaction: !payment.atomically)

payment.callback(.purchased(purchase: purchase))

if payment.atomically {
paymentQueue.finishTransaction(transaction)
}
payments.remove(at: paymentIndex)
return true
}

if transactionState == .failed {

payment.callback(.failed(error: transactionError(for: transaction.error as NSError?)))
Expand All @@ -92,9 +107,6 @@ class PaymentsController: TransactionController {
return true
}

if transactionState == .restored {
print("Unexpected restored transaction for payment \(transactionProductIdentifier)")
}
return false
}

Expand Down