mirror of
https://github.com/mas-cli/mas
synced 2024-12-03 16:59:24 +00:00
2c2eaa2821
🔥 Remove empty mas bridging header
32 lines
1.1 KiB
Swift
32 lines
1.1 KiB
Swift
//
|
|
// SSPurchase.swift
|
|
// mas-cli
|
|
//
|
|
// Created by Andrew Naylor on 25/08/2015.
|
|
// Copyright (c) 2015 Andrew Naylor. All rights reserved.
|
|
//
|
|
|
|
import CommerceKit
|
|
import StoreFoundation
|
|
|
|
typealias SSPurchaseCompletion = (_ purchase: SSPurchase?, _ completed: Bool, _ error: Error?, _ response: SSPurchaseResponse?) -> ()
|
|
|
|
extension SSPurchase {
|
|
convenience init(adamId: UInt64, account: ISStoreAccount) {
|
|
self.init()
|
|
self.buyParameters = "productType=C&price=0&salableAdamId=\(adamId)&pricingParameters=STDRDL&pg=default&appExtVrsId=0"
|
|
self.itemIdentifier = adamId
|
|
self.accountIdentifier = account.dsID
|
|
self.appleID = account.identifier
|
|
|
|
let downloadMetadata = SSDownloadMetadata()
|
|
downloadMetadata.kind = "software"
|
|
downloadMetadata.itemIdentifier = adamId
|
|
|
|
self.downloadMetadata = downloadMetadata
|
|
}
|
|
|
|
func perform(_ completion: @escaping SSPurchaseCompletion) {
|
|
CKPurchaseController.shared().perform(self, withOptions: 0, completionHandler: completion)
|
|
}
|
|
}
|