Browse Source

Change signature of verifySubscriptions, update documentation

Andrea Bizzotto 7 years ago
parent
commit
1edf323487
1 changed files with 19 additions and 15 deletions
  1. 19 15
      SwiftyStoreKit/SwiftyStoreKit.swift

+ 19 - 15
SwiftyStoreKit/SwiftyStoreKit.swift

@@ -262,12 +262,14 @@ extension SwiftyStoreKit {
     }
 
     /**
-     *  Verify the validity of a subscription (auto-renewable, free or non-renewing) in a receipt. This method extracts all transactions mathing the given productId and sorts them by date in descending order, then compares the first transaction expiry date against the receipt date.
-     *  - Parameter type: autoRenewable or nonRenewing
-     *  - Parameter productId: the product id of the subscription to verify
-     *  - Parameter inReceipt: the receipt to use for looking up the subscription
-     *  - Parameter validUntil: date to check against the expiry date of the subscription. This is only used if a date is not found in the receipt.
-     *  - return: either .notPurchased or .purchased / .expired with the expiry date found in the receipt
+     *  Verify the validity of a subscription (auto-renewable, free or non-renewing) in a receipt.
+     *
+     *  This method extracts all transactions mathing the given productId and sorts them by date in descending order. It then compares the first transaction expiry date against the receipt date to determine its validity.
+     *  - Parameter type: .autoRenewable or .nonRenewing.
+     *  - Parameter productId: The product id of the subscription to verify.
+     *  - Parameter receipt: The receipt to use for looking up the subscription.
+     *  - Parameter validUntil: Date to check against the expiry date of the subscription. This is only used if a date is not found in the receipt.
+     *  - return: Either .notPurchased or .purchased / .expired with the expiry date found in the receipt.
      */
     public class func verifySubscription(type: SubscriptionType, productId: String, inReceipt receipt: ReceiptInfo, validUntil date: Date = Date()) -> VerifySubscriptionResult {
 
@@ -275,16 +277,18 @@ extension SwiftyStoreKit {
     }
     
     /**
-     *  Verify the validity of a set of subscriptions in a receipt. This method extracts all transactions mathing the given productIds and sorts them by date in descending order, then compares the first transaction expiry date against the receipt date.
-     *  - Note: you can use this method to check the validity of subscriptions in a subscription group
-     *  - Remark: the type parameter determines how the expiration dates are calculated for all subscriptions. Make sure all productIds match the specified subscription type to avoid incorrect results.
-     *  - Parameter type: autoRenewable or nonRenewing
-     *  - Parameter productIds: the product ids of the subscriptions to verify
-     *  - Parameter inReceipt: the receipt to use for looking up the subscriptions
-     *  - Parameter validUntil: date to check against the expiry date of the subscriptions. This is only used if a date is not found in the receipt.
-     *  - return: either .notPurchased or .purchased / .expired with the expiry date found in the receipt
+     *  Verify the validity of a set of subscriptions in a receipt.
+     *
+     *  This method extracts all transactions mathing the given productIds and sorts them by date in descending order. It then compares the first transaction expiry date against the receipt date, to determine its validity.
+     *  - Note: You can use this method to check the validity of (mutually exclusive) subscriptions in a subscription group.
+     *  - Remark: The type parameter determines how the expiration dates are calculated for all subscriptions. Make sure all productIds match the specified subscription type to avoid incorrect results.
+     *  - Parameter type: .autoRenewable or .nonRenewing.
+     *  - Parameter productIds: The product ids of the subscriptions to verify.
+     *  - Parameter receipt: The receipt to use for looking up the subscriptions
+     *  - Parameter validUntil: Date to check against the expiry date of the subscriptions. This is only used if a date is not found in the receipt.
+     *  - return: Either .notPurchased or .purchased / .expired with the expiry date found in the receipt.
      */
-    public class func verifySubscriptions(type: SubscriptionType = .autoRenewable, productIds: Set<String>, inReceipt receipt: ReceiptInfo, validUntil date: Date = Date()) -> VerifySubscriptionResult {
+    public class func verifySubscriptions(ofType type: SubscriptionType = .autoRenewable, productIds: Set<String>, inReceipt receipt: ReceiptInfo, validUntil date: Date = Date()) -> VerifySubscriptionResult {
 
         return InAppReceipt.verifySubscriptions(type: type, productIds: productIds, inReceipt: receipt, validUntil: date)
     }