Commit fe599067 by Dima Bart

Merge pull request #224 from Shopify/task/nullability

Add nullability annotations
parents 40120666 8b151644
......@@ -47,7 +47,7 @@
- (void)setUp
{
_modelManager = [BUYModelManager modelManager];
_checkout = [[BUYCheckout alloc] initWithModelManager:_modelManager cart:nil];
_checkout = [[BUYCheckout alloc] initWithModelManager:_modelManager cart:[BUYCart new]];
}
- (void)tearDown
......
......@@ -766,7 +766,7 @@
{
[OHHTTPStubs stubUsingResponseWithKey:@"testFetchingShippingRatesWithInvalidCheckout_1" useMocks:[self shouldUseMocks]];
BUYCheckout *checkout = [[BUYCheckout alloc] initWithModelManager:_modelManager cart:nil];
BUYCheckout *checkout = [[BUYCheckout alloc] initWithModelManager:_modelManager cart:[BUYCart new]];
checkout.token = @"bananaaaa";
XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)];
......
......@@ -70,7 +70,7 @@
- (void)testJsonDictionaryDoesntIncludeVariantsWithoutIds
{
_lineItem = [_modelManager lineItemWithVariant:nil];
_lineItem = [_modelManager lineItemWithVariant:[BUYProductVariant new]];
NSDictionary *json = [_lineItem jsonDictionaryForCheckout];
XCTAssertNotNil(json);
XCTAssertNil(json[@"variant_id"]);
......
......@@ -122,7 +122,7 @@
- (BUYDirtyTracked *)dirtyTrackedObject
{
return [[BUYDirtyTracked alloc] initWithModelManager:nil JSONDictionary:nil];
return [[BUYDirtyTracked alloc] initWithModelManager:[BUYModelManager modelManager] JSONDictionary:nil];
}
@end
......
......@@ -1487,6 +1487,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = mh_dylib;
MODULEMAP_FILE = "";
MOMC_NO_INVERSE_RELATIONSHIP_WARNINGS = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.shopify.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
......@@ -1515,6 +1516,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = mh_dylib;
MODULEMAP_FILE = "";
MOMC_NO_INVERSE_RELATIONSHIP_WARNINGS = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.shopify.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
......@@ -1733,6 +1735,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = mh_dylib;
MODULEMAP_FILE = "";
MOMC_NO_INVERSE_RELATIONSHIP_WARNINGS = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.shopify.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
......@@ -1847,6 +1850,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = mh_dylib;
MODULEMAP_FILE = "";
MOMC_NO_INVERSE_RELATIONSHIP_WARNINGS = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.shopify.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
......
......@@ -73,4 +73,4 @@ OBJC_EXTERN NSString * const BUYAccountPasswordConfirmationKey;
@end
NS_ASSUME_NONNULL_END
\ No newline at end of file
NS_ASSUME_NONNULL_END
......@@ -26,6 +26,7 @@
@import Foundation;
#import <Buy/BUYSerializable.h>
NS_ASSUME_NONNULL_BEGIN
/**
* This represents raw credit card data that the user is posting. You MUST discard this object as soon as it has been posted
......@@ -37,27 +38,29 @@
* The full name on the credit card
* First and Last in this format: 'First Last'.
*/
@property (nonatomic, copy) NSString *nameOnCard;
@property (nonatomic, nullable, copy) NSString *nameOnCard;
/**
* The full credit card number.
* This should be a numerical value without spaces, dashes or any other special characters.
*/
@property (nonatomic, copy) NSString *number;
@property (nonatomic, nullable, copy) NSString *number;
/**
* The month that the credit card expires, as a numerical value (i.e. 12 for December).
*/
@property (nonatomic, copy) NSString *expiryMonth;
@property (nonatomic, nullable, copy) NSString *expiryMonth;
/**
* The last two digits of the year in which the credit card expires (i.e. 18 for 2018).
*/
@property (nonatomic, copy) NSString *expiryYear;
@property (nonatomic, nullable, copy) NSString *expiryYear;
/**
* The Card Verification Value number (or whichever card security code should be used for the card type).
*/
@property (nonatomic, copy) NSString *cvv;
@property (nonatomic, nullable, copy) NSString *cvv;
@end
NS_ASSUME_NONNULL_END
......@@ -25,15 +25,17 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYError : NSObject
@property (nonatomic, copy) NSString *key;
@property (nonatomic, nonnull, copy, readonly) NSString *key;
@property (nonatomic, nullable, copy, readonly) NSString *code;
@property (nonatomic, nullable, copy, readonly) NSString *message;
@property (nonatomic, nullable, copy, readonly) NSDictionary<NSString *, NSString *> *options;
- (instancetype)initWithKey:(NSString *)key json:(NSDictionary *)json;
@property (nonatomic, copy) NSString *code;
@property (nonatomic, copy) NSString *message;
@property (nonatomic, copy) NSDictionary<NSString *, NSString *> *options;
@end
NS_ASSUME_NONNULL_END
......@@ -32,7 +32,7 @@
{
self = [super init];
if (self) {
self.key = key;
_key = [key copy];
[self setValuesForKeysWithDictionary:json];
}
return self;
......
......@@ -25,8 +25,8 @@
//
#import <CoreData/CoreData.h>
#import <Buy/BUYObject.h>
NS_ASSUME_NONNULL_BEGIN
#if defined CORE_DATA_PERSISTENCE
......@@ -42,7 +42,7 @@
@interface BUYManagedObject : NSManagedObject<BUYObject>
- (nonnull instancetype)init NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
@end
......@@ -56,11 +56,13 @@
*/
@interface BUYObject (BUYManagedObjectConformance)
- (void)willAccessValueForKey:(nonnull NSString *)key;
- (void)didAccessValueForKey:(nonnull NSString *)key;
- (void)willAccessValueForKey:(NSString *)key;
- (void)didAccessValueForKey:(NSString *)key;
- (nullable id)primitiveValueForKey:(nonnull NSString *)key;
- (void)setPrimitiveValue:(nullable id)value forKey:(nonnull NSString *)key;
- (nullable id)primitiveValueForKey:(NSString *)key;
- (void)setPrimitiveValue:(nullable id)value forKey:(NSString *)key;
@end
#endif
NS_ASSUME_NONNULL_END
......@@ -25,9 +25,9 @@
//
#import <Foundation/Foundation.h>
#import <Buy/BUYObject.h>
#import <Buy/BUYModelManagerProtocol.h>
NS_ASSUME_NONNULL_BEGIN
/**
* A basic implementation of the BUYModelManager interface that does no caching. New objects are created using alloc/init.
......@@ -54,3 +54,5 @@
+ (instancetype)modelManager;
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <CoreData/CoreData.h>
NS_ASSUME_NONNULL_BEGIN
@protocol BUYObject;
......@@ -52,7 +53,7 @@
*
* @return A new or existing model object.
*/
- (id<BUYObject>)buy_objectWithEntityName:(NSString *)entityName JSONDictionary:(NSDictionary *)JSON;
- (id<BUYObject>)buy_objectWithEntityName:(NSString *)entityName JSONDictionary:(nullable NSDictionary *)JSON;
- (NSArray<id<BUYObject>> *)buy_objectsWithEntityName:(NSString *)entityName JSONArray:(NSArray *)JSON;
/**
......@@ -64,7 +65,7 @@
*
* @return An object from the cache matching the provided identifier, or nil if no matching object is found.
*/
- (id<BUYObject>)buy_objectWithEntityName:(NSString *)entityName identifier:(NSNumber *)identifier;
- (nullable id<BUYObject>)buy_objectWithEntityName:(NSString *)entityName identifier:(NSNumber *)identifier;
/**
* Find all the objects in the cache matching the provided identifiers.
......@@ -74,7 +75,7 @@
*
* @return An array of objects from the cache matching the provided identifiers, if any.
*/
- (NSArray<id<BUYObject>> *)buy_objectsWithEntityName:(NSString *)entityName identifiers:(NSArray *)identifiers;
- (NSArray<id<BUYObject>> *)buy_objectsWithEntityName:(NSString *)entityName identifiers:(nullable NSArray *)identifiers;
/**
* If there is a local cache available, and the object is cached, it is flushed from the cache. Depending on the type of
......@@ -109,3 +110,5 @@
- (BOOL)buy_purgeObjectsWithEntityName:(NSString *)entityName matchingPredicate:(NSPredicate *)predicate;
@end
NS_ASSUME_NONNULL_END
......@@ -25,9 +25,9 @@
//
#import <Foundation/Foundation.h>
#import <Buy/BUYObjectProtocol.h>
#import <Buy/BUYModelManagerProtocol.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYObject : NSObject<BUYObject>
......@@ -37,8 +37,10 @@
*/
@property (nonatomic, readonly, getter=isDirty) BOOL dirty;
- (NSSet *)dirtyProperties;
- (nullable NSSet *)dirtyProperties;
- (void)markPropertyAsDirty:(NSString *)property;
- (void)markAsClean;
@end
NS_ASSUME_NONNULL_END
......@@ -26,6 +26,7 @@
#import <Foundation/Foundation.h>
#import <Buy/BUYSerializable.h>
NS_ASSUME_NONNULL_BEGIN
@class NSEntityDescription;
......@@ -37,12 +38,12 @@
*/
@protocol BUYObject <BUYSerializable>
@property (nonatomic, readonly, weak) id<BUYModelManager> modelManager;
@property (nonatomic, readonly, nullable, weak) id<BUYModelManager> modelManager;
/**
* Transient model objects need an entity for introspection.
*/
@property (nonatomic, readonly, weak) NSEntityDescription *entity;
@property (nonatomic, readonly, nullable, weak) NSEntityDescription *entity;
/**
* A dictionary of @{ NSString : NSPropertyDescription } where the keys are property names.
......@@ -63,7 +64,7 @@
/**
* A predicate composed of values from the JSON. For objects that do not have an "identifier"/"id" property.
*/
+ (NSPredicate *)fetchPredicateWithJSON:(NSDictionary *)JSONDictionary;
+ (nullable NSPredicate *)fetchPredicateWithJSON:(NSDictionary *)JSONDictionary;
/**
* Persistent classes return YES; transient classes return NO.
......@@ -77,6 +78,8 @@
@optional
- (instancetype)initWithModelManager:(id<BUYModelManager>)modelManager JSONDictionary:(NSDictionary *)dictionary;
- (instancetype)initWithModelManager:(id<BUYModelManager>)modelManager JSONDictionary:(nullable NSDictionary *)dictionary;
@end
NS_ASSUME_NONNULL_END
......@@ -24,8 +24,12 @@
// THE SOFTWARE.
//
NS_ASSUME_NONNULL_BEGIN
@protocol BUYPaymentToken <NSObject>
- (NSDictionary *)JSONDictionary;
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol BUYSerializable <NSObject>
......@@ -34,4 +35,6 @@
@interface NSDictionary (BUYSerializable) <BUYSerializable>
@end
\ No newline at end of file
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Buy/_BUYAddress.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYAddress : _BUYAddress {}
......@@ -47,3 +48,5 @@
- (BOOL)isValidAddressForShippingRates;
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Buy/_BUYCart.h>
NS_ASSUME_NONNULL_BEGIN
@class BUYProductVariant;
@class BUYLineItem;
......@@ -36,7 +37,7 @@
*
* These are different from BUYLineItem objects. The line item objects do include the BUYProductVariant.
*/
- (nonnull NSArray<BUYCartLineItem *> *)lineItemsArray;
- (NSArray<BUYCartLineItem *> *)lineItemsArray;
/**
* Returns true if the cart is acceptable to send to Shopify.
......@@ -56,7 +57,7 @@
*
* @param variant The BUYProductVariant to add to the BUYCart or increase by one quantity
*/
- (void)addVariant:(nonnull BUYProductVariant *)variant;
- (void)addVariant:(BUYProductVariant *)variant;
/**
* Removes the BUYCartLineItem from the BUYCart associated with the given BUYProductVariant object.
......@@ -64,7 +65,7 @@
*
* @param variant The BUYProductVariant to remove from the BUYCart or decrease by one quantity
*/
- (void)removeVariant:(nonnull BUYProductVariant *)variant;
- (void)removeVariant:(BUYProductVariant *)variant;
/**
* Adds a BUYCartLineItem with a set quantity to the BUYCart with the given BUYProductVariant object on it.
......@@ -74,6 +75,8 @@
* @param variant The BUYProductVariant to add to the BUYCart with a quantity
* @param quantity The quantity for the BUYCartLineItem associated with the BUYProductVariant
*/
- (void)setVariant:(nonnull BUYProductVariant *)variant withTotalQuantity:(NSInteger)quantity;
- (void)setVariant:(BUYProductVariant *)variant withTotalQuantity:(NSInteger)quantity;
@end
NS_ASSUME_NONNULL_END
......@@ -42,9 +42,9 @@
}
#endif
- (nonnull NSArray<BUYCartLineItem *> *)lineItemsArray
- (NSArray<BUYCartLineItem *> *)lineItemsArray
{
return self.lineItems.array;
return self.lineItems.array ?: @[];
}
- (BOOL)isValid
......
......@@ -25,11 +25,11 @@
//
#import <Buy/_BUYCartLineItem.h>
NS_ASSUME_NONNULL_BEGIN
/**
* Newly inserted `CartLineItem`s have an initial quantity of 1.
*/
@interface BUYCartLineItem : _BUYCartLineItem {}
/**
......@@ -68,4 +68,6 @@
- (BUYCartLineItem *)cartLineItemWithVariant:(BUYProductVariant *)variant;
@end
\ No newline at end of file
@end
NS_ASSUME_NONNULL_END
......@@ -26,10 +26,11 @@
#import <Buy/_BUYCollection.h>
#import <Buy/BUYClient+Storefront.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYCollection : _BUYCollection {}
@property (nonatomic, readonly) NSString *stringDescription;
@property (nonatomic, nullable, readonly) NSString *stringDescription;
- (NSArray<BUYProduct *> *)productsArray;
......@@ -43,3 +44,5 @@
+ (NSString *)sortOrderParameterForCollectionSort:(BUYCollectionSort)sort;
@end
NS_ASSUME_NONNULL_END
......@@ -34,7 +34,7 @@
- (NSArray<BUYProduct *> *)productsArray
{
return self.products.array;
return self.products.array ?: @[];
}
- (void)updateStringDescription
......
......@@ -25,10 +25,11 @@
//
#import <Buy/_BUYCustomer.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYCustomer : _BUYCustomer {}
@property (readonly) NSString *fullName;
@property (nonatomic, strong, readonly) NSString *fullName;
@end
......@@ -37,3 +38,5 @@
- (BUYCustomer *)customerWithJSONDictionary:(NSDictionary *)json;
@end
NS_ASSUME_NONNULL_END
......@@ -24,9 +24,9 @@
// THE SOFTWARE.
//
#import <Buy/_BUYImageLink.h>
@import UIKit;
#import <Buy/_BUYImageLink.h>
NS_ASSUME_NONNULL_BEGIN
// Defines for common maximum image sizes
typedef NS_ENUM(NSUInteger, BUYImageURLSize) {
......@@ -83,3 +83,5 @@ typedef NS_ENUM(NSUInteger, BUYImageURLSize) {
- (BUYImageURLSize)buy_imageSize;
@end
NS_ASSUME_NONNULL_END
......@@ -51,39 +51,15 @@
+ (NSString *)keyForImageSize:(BUYImageURLSize)size
{
NSString *sizeKey = nil;
switch (size) {
case BUYImageURLSize100x100:
sizeKey = @"_small";
break;
case BUYImageURLSize160x160:
sizeKey = @"_compact";
break;
case BUYImageURLSize240x240:
sizeKey = @"_medium";
break;
case BUYImageURLSize480x480:
sizeKey = @"_large";
break;
case BUYImageURLSize600x600:
sizeKey = @"_grande";
break;
case BUYImageURLSize1024x1024:
sizeKey = @"_1024x1024";
break;
case BUYImageURLSize2048x2048:
sizeKey = @"_2048x2048";
break;
case BUYImageURLSize100x100: return @"_small";
case BUYImageURLSize160x160: return @"_compact";
case BUYImageURLSize240x240: return @"_medium";
case BUYImageURLSize480x480: return @"_large";
case BUYImageURLSize600x600: return @"_grande";
case BUYImageURLSize1024x1024: return @"_1024x1024";
case BUYImageURLSize2048x2048: return @"_2048x2048";
}
return sizeKey;
}
@end
......
......@@ -26,8 +26,11 @@
#import <Buy/_BUYLineItem.h>
#import <Buy/BUYModelManager.h>
NS_ASSUME_NONNULL_BEGIN
@class BUYCartLineItem, BUYProductVariant;
@class BUYCartLineItem;
@class BUYProductVariant;
@class BUYCartLineItem;
@interface BUYLineItem : _BUYLineItem {}
......@@ -36,11 +39,11 @@
@end
@class BUYCartLineItem;
@interface BUYModelManager (BUYLineItemCreation)
- (BUYLineItem *)lineItemWithVariant:(BUYProductVariant *)variant;
- (BUYLineItem *)lineItemWithCartLineItem:(BUYCartLineItem *)cartLineItem;
@end
NS_ASSUME_NONNULL_END
......@@ -28,7 +28,6 @@
//
#import "BUYLineItem.h"
#import "BUYCartLineItem.h"
#import "BUYProductVariant.h"
......
......@@ -25,7 +25,10 @@
//
#import <Buy/_BUYOption.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYOption : _BUYOption {}
@end
NS_ASSUME_NONNULL_END
......@@ -25,9 +25,12 @@
//
#import <Buy/_BUYOptionValue.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYOptionValue : _BUYOptionValue {}
- (BOOL)isEqualToOptionValue:(BUYOptionValue *)other;
- (BOOL)isEqualToOptionValue:(nullable BUYOptionValue *)other;
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Buy/_BUYOrder.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYOrder : _BUYOrder {}
......@@ -39,3 +40,5 @@
@end
NS_ASSUME_NONNULL_END
......@@ -31,7 +31,7 @@
- (NSArray<BUYLineItem *> *)lineItemsArray
{
return self.lineItems.array;
return self.lineItems.array ?: @[];
}
- (NSArray *)formatIDsForLineItemsJSON:(NSArray<NSDictionary *> *)lineItems
......
......@@ -25,12 +25,14 @@
//
#import <Buy/_BUYProduct.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYProduct : _BUYProduct {}
@property (nonatomic, readonly, copy) NSDate *createdAtDate;
@property (nonatomic, readonly, copy) NSDate *updatedAtDate;
@property (nonatomic, readonly, copy) NSDate *publishedAtDate;
@property (nonatomic, readonly, copy) NSString *stringDescription;
/**
......@@ -70,7 +72,7 @@
*
* @return the product variant matching the set of options
*/
- (BUYProductVariant *)variantWithOptions:(NSArray *)options;
- (nullable BUYProductVariant *)variantWithOptions:(NSArray *)options;
/**
* Determine if the variant is a default variant automatically created by Shopify
......@@ -80,3 +82,5 @@
- (BOOL)isDefaultVariant;
@end
NS_ASSUME_NONNULL_END
......@@ -60,17 +60,17 @@
- (NSArray<BUYImageLink *> *)imagesArray
{
return self.images.array;
return self.images.array ?: @[];
}
- (NSArray<BUYOption *> *)optionsArray
{
return self.options.array;
return self.options.array ?: @[];
}
- (NSArray<BUYProductVariant *> *)variantsArray
{
return self.variants.array;
return self.variants.array ?: @[];
}
@end
......
......@@ -25,6 +25,7 @@
//
#import <Buy/_BUYProductVariant.h>
NS_ASSUME_NONNULL_BEGIN
@class BUYOptionValue;
......@@ -37,7 +38,7 @@
*
* @return the option value
*/
- (BUYOptionValue *)optionValueForName:(NSString *)optionName;
- (nullable BUYOptionValue *)optionValueForName:(NSString *)optionName;
/**
* Filters array of product variants filtered based on a selected option value
......@@ -50,3 +51,5 @@
+ (NSArray *)filterProductVariants:(NSArray *)productVariants forOptionValue:(BUYOptionValue *)optionValue;
@end
NS_ASSUME_NONNULL_END
......@@ -25,7 +25,10 @@
//
#import <Buy/_BUYShop.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYShop : _BUYShop {}
@end
NS_ASSUME_NONNULL_END
......@@ -27,12 +27,12 @@
#import <Buy/_BUYCheckout.h>
#import <Buy/_BUYProductVariant.h>
#import <Buy/BUYModelManager.h>
NS_ASSUME_NONNULL_BEGIN
@class BUYCart, BUYCartLineItem, BUYAddress, BUYGiftCard;
@interface BUYCheckout : _BUYCheckout {}
@property (nonatomic, copy) NSNumber *taxesIncluded;
@property (nonatomic, readonly, copy) NSDate *createdAtDate;
@property (nonatomic, readonly, copy) NSDate *updatedAtDate;
@property (nonatomic, readonly, copy) NSDictionary *attributesDictionary;
......@@ -47,7 +47,7 @@
- (void)updateWithCart:(BUYCart *)cart;
- (BUYGiftCard *)giftCardWithIdentifier:(NSNumber *)identifier;
- (nullable BUYGiftCard *)giftCardWithIdentifier:(NSNumber *)identifier;
- (void)addGiftCard:(BUYGiftCard *)giftCard;
- (void)removeGiftCardWithIdentifier:(NSNumber *)identifier;
......@@ -61,3 +61,5 @@
- (BUYCheckout *)checkoutwithCartToken:(NSString *)token;
@end
NS_ASSUME_NONNULL_END
......@@ -118,12 +118,12 @@
- (NSArray<BUYGiftCard *> *)giftCardsArray
{
return self.giftCards.array;
return self.giftCards.array ?: @[];
}
- (NSArray<BUYCartLineItem *> *)lineItemsArray
{
return self.lineItems.array;
return self.lineItems.array ?: @[];
}
#pragma mark - Update -
......
......@@ -25,9 +25,13 @@
//
#import <Buy/_BUYCheckoutAttribute.h>
NS_ASSUME_NONNULL_BEGIN
/**
* A BUYCheckoutAttribute represents a checkout attributes key and value
*/
@interface BUYCheckoutAttribute : _BUYCheckoutAttribute
@end
NS_ASSUME_NONNULL_END
......@@ -26,10 +26,15 @@
#import <Buy/_BUYDiscount.h>
#import <Buy/BUYModelManager.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYDiscount : _BUYDiscount {}
@end
@interface BUYModelManager (BUYDiscountCreating)
- (BUYDiscount *)discountWithCode:(NSString *)code;
- (BUYDiscount *)discountWithCode:(nullable NSString *)code;
@end
NS_ASSUME_NONNULL_END
......@@ -26,6 +26,7 @@
#import <Buy/_BUYGiftCard.h>
#import <Buy/BUYModelManager.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYGiftCard : _BUYGiftCard {}
......@@ -36,3 +37,5 @@
- (BUYGiftCard *)giftCardWithCode:(NSString *)code;
@end
NS_ASSUME_NONNULL_END
......@@ -25,7 +25,10 @@
//
#import <Buy/_BUYMaskedCreditCard.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYMaskedCreditCard : _BUYMaskedCreditCard {}
@end
NS_ASSUME_NONNULL_END
......@@ -25,7 +25,10 @@
//
#import <Buy/_BUYShippingRate.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYShippingRate : _BUYShippingRate {}
@end
NS_ASSUME_NONNULL_END
......@@ -25,7 +25,10 @@
//
#import <Buy/_BUYTaxLine.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYTaxLine : _BUYTaxLine {}
@end
NS_ASSUME_NONNULL_END
......@@ -30,6 +30,7 @@
#import <Buy/BUYCheckout.h>
#import <Buy/BUYShippingRate.h>
#import <Buy/BUYAddress.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYCheckout (ApplePay)
......@@ -37,7 +38,7 @@
* Returns an array of summary items for all Apple Pay requests. Will use 'PAY TOTAL' as the summary label. Apple recommends
* including the business name in the summary label, so it is recommended to use `buy_summaryItemsWithShopName` instead.
*/
- (nonnull NSArray<PKPaymentSummaryItem *> *)buy_summaryItems;
- (NSArray<PKPaymentSummaryItem *> *)buy_summaryItems;
/**
* Returns an array of summary items for all Apple Pay requests using the shop name in the "PAY" section
......@@ -46,7 +47,7 @@
*
* @return An array of PKPaymentSummaryItems
*/
- (nonnull NSArray<PKPaymentSummaryItem *> *)buy_summaryItemsWithShopName:(nullable NSString *)shopName;
- (NSArray<PKPaymentSummaryItem *> *)buy_summaryItemsWithShopName:(nullable NSString *)shopName;
@end
......@@ -59,7 +60,7 @@
*
* @return An array of PKShippingMethods
*/
+ (nonnull NSArray<PKShippingMethod *> *)buy_convertShippingRatesToShippingMethods:(nonnull NSArray<BUYShippingRate *> *)rates;
+ (NSArray<PKShippingMethod *> *)buy_convertShippingRatesToShippingMethods:(NSArray<BUYShippingRate *> *)rates;
@end
......@@ -72,3 +73,5 @@
- (void)updateWithContact:(nullable PKContact*)contact NS_AVAILABLE_IOS(9_0);
@end
NS_ASSUME_NONNULL_END
......@@ -25,12 +25,20 @@
//
#import <Buy/BUYError.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUYError (Checkout)
+ (NSArray<BUYError *> *)errorsFromCheckoutJSON:(NSDictionary *)json;
@property (readonly) NSString *quantityRemainingMessage;
+ (nullable NSArray<BUYError *> *)errorsFromCheckoutJSON:(NSDictionary *)json;
@end
@interface BUYError (Customer)
+ (NSArray<BUYError *> *)errorsFromSignUpJSON:(NSDictionary *)json;
@end
NS_ASSUME_NONNULL_END
......@@ -24,8 +24,9 @@
// THE SOFTWARE.
//
#import <Buy/BUYModelManager.h>
@import PassKit;
#import <Buy/BUYModelManager.h>
NS_ASSUME_NONNULL_BEGIN
@class BUYAddress;
......@@ -49,4 +50,6 @@
*/
- (BUYAddress *)buyAddressWithContact:(PKContact *)contact NS_AVAILABLE_IOS(9_0);
@end
\ No newline at end of file
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString * const BUYDateTransformerName; // = @"BUYDate";
......@@ -32,5 +33,9 @@ extern NSString * const BUYDateTransformerName; // = @"BUYDate";
* Transforms a date object into a string and back using the provided format string.
*/
@interface BUYDateTransformer : NSValueTransformer
+ (instancetype)dateTransformerWithFormat:(NSString *)format;
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString * const BUYDecimalNumberTransformerName; // = @"BUYDecimalNumber";
......@@ -32,4 +33,7 @@ extern NSString * const BUYDecimalNumberTransformerName; // = @"BUYDecimalNumber
* Transforms a decimal number object into a string and back.
*/
@interface BUYDecimalNumberTransformer : NSValueTransformer
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString * const BUYShippingRateDateTransformerName; // = @"BUYShippingRateDate";
extern NSString * const BUYShippingRateDateFormat; // = @"yyyy-MM-dd'T'HH:mm:ss.SSSZ";
......@@ -32,3 +33,5 @@ extern NSString * const BUYShippingRateDateFormat; // = @"yyyy-MM-dd'T'HH:mm:ss.
@interface BUYDeliveryRangeTransformer : NSValueTransformer
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
* Transforms an array of objects into a string with given separator.
......@@ -44,3 +45,5 @@
+ (instancetype)setTransformerWithSeparator:(NSString *)separator;
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString * const BUYIdentityTransformerName; // = @"BUYIdentity";
......@@ -34,3 +35,5 @@ extern NSString * const BUYIdentityTransformerName; // = @"BUYIdentity";
@interface BUYIdentityTransformer : NSValueTransformer
@end
NS_ASSUME_NONNULL_END
......@@ -25,6 +25,7 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString * const BUYURLTransformerName; // = @"BUYURL";
......@@ -32,4 +33,7 @@ extern NSString * const BUYURLTransformerName; // = @"BUYURL";
* Transforms a URL object into a string and back.
*/
@interface BUYURLTransformer : NSValueTransformer
@end
NS_ASSUME_NONNULL_END
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