Commit 4c5d7c92 by Dima Bart

Minor clean up. Add assertions for shop credentials in init.

parent fdb2606c
......@@ -26,8 +26,6 @@
@import Foundation;
@class PKPaymentToken;
@class BUYAccountCredentials;
@class BUYCart;
@class BUYCheckout;
......@@ -459,7 +457,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard *giftCard, NSError *error);
*
* @return The associated NSURLSessionDataTask
*/
- (NSURLSessionDataTask*)completeCheckout:(BUYCheckout *)checkout paymentToken:(id<BUYPaymentToken>)paymentToken completion:(BUYDataCheckoutBlock)block;
- (NSURLSessionDataTask *)completeCheckout:(BUYCheckout *)checkout paymentToken:(id<BUYPaymentToken>)paymentToken completion:(BUYDataCheckoutBlock)block;
/**
* Retrieve the status of a BUYCheckout. This checks the status of the current payment processing job for the provided checkout.
......
......@@ -86,7 +86,10 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
- (instancetype)initWithShopDomain:(NSString *)shopDomain apiKey:(NSString *)apiKey appId:(NSString *)appId
{
NSAssert(shopDomain.length > 0, @"Bad shop domain. Please ensure you initialize with a shop domain");
NSAssert(shopDomain.length > 0, @"Bad shop domain. Please ensure you initialize with a shop domain.");
NSAssert(apiKey.length > 0, @"Bad API key. Please ensure you initialize with a valid API key.");
NSAssert(appId.length > 0, @"Bad app ID. Please ensure you initialize with a valid App ID.");
self = [super init];
if (self) {
self.modelManager = [BUYModelManager modelManager];
......@@ -558,7 +561,7 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
{
NSAssert(object, @"Failed to perform request. id<BUYSerializable> must not be nil.");
NSData *data = [NSJSONSerialization dataWithJSONObject:[object jsonDictionaryForCheckout] options:0 error:nil];
NSData *data = [NSJSONSerialization dataWithJSONObject:[object jsonDictionaryForCheckout] options:0 error:nil];
NSAssert(data, @"Failed to perform request. Could not serialize object. Possibly invalid object.");
return [self requestForURL:url method:method body:data completionHandler:completionHandler];
......
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