Update class header and remove readwrite property redeclerations

parent 8f04c819
...@@ -63,9 +63,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -63,9 +63,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong, readonly) NSError *lastError; @property (nonatomic, strong, readonly) NSError *lastError;
/** /**
* The shop object * The shop name
*/ */
@property (nonatomic, strong, readonly) BUYShop *shop; @property (nonatomic, strong, readonly) NSString *shopName;
@end @end
......
...@@ -38,14 +38,12 @@ ...@@ -38,14 +38,12 @@
const NSTimeInterval PollDelay = 0.5; const NSTimeInterval PollDelay = 0.5;
@interface BUYApplePayAuthorizationDelegate () @interface BUYApplePayAuthorizationDelegate ()
@property (nonatomic, strong) BUYCheckout *checkout; @property (nonatomic, strong) BUYCheckout *checkout;
@property (nonatomic, strong) BUYClient *client;
@property (nonatomic, strong) NSArray *shippingRates; @property (nonatomic, strong) NSArray *shippingRates;
@property (nonatomic, strong) NSError *lastError; @property (nonatomic, strong) NSError *lastError;
@property (nonatomic, strong) NSString *shopName;
@end @end
@implementation BUYApplePayAuthorizationDelegate @implementation BUYApplePayAuthorizationDelegate
...@@ -58,9 +56,9 @@ const NSTimeInterval PollDelay = 0.5; ...@@ -58,9 +56,9 @@ const NSTimeInterval PollDelay = 0.5;
self = [super init]; self = [super init];
if (self) { if (self) {
self.client = client; _client = client;
self.checkout = checkout; _checkout = checkout;
self.shopName = shopName; _shopName = shopName;
} }
return self; return self;
...@@ -157,7 +155,7 @@ const NSTimeInterval PollDelay = 0.5; ...@@ -157,7 +155,7 @@ const NSTimeInterval PollDelay = 0.5;
else { else {
self.lastError = error; self.lastError = error;
} }
completion(error == nil ? PKPaymentAuthorizationStatusSuccess : PKPaymentAuthorizationStatusFailure, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(error == nil ? PKPaymentAuthorizationStatusSuccess : PKPaymentAuthorizationStatusFailure, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
}]; }];
} }
...@@ -181,12 +179,12 @@ const NSTimeInterval PollDelay = 0.5; ...@@ -181,12 +179,12 @@ const NSTimeInterval PollDelay = 0.5;
} }
else { else {
self.lastError = error; self.lastError = error;
completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, nil, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, nil, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
} }
}]; }];
} }
else { else {
completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, nil, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, nil, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
} }
} }
...@@ -211,7 +209,7 @@ const NSTimeInterval PollDelay = 0.5; ...@@ -211,7 +209,7 @@ const NSTimeInterval PollDelay = 0.5;
// We then turn our BUYShippingRate objects into PKShippingMethods for Apple to present to the user. // We then turn our BUYShippingRate objects into PKShippingMethods for Apple to present to the user.
if ([self.checkout requiresShipping] == NO) { if ([self.checkout requiresShipping] == NO) {
completion(PKPaymentAuthorizationStatusSuccess, nil, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(PKPaymentAuthorizationStatusSuccess, nil, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
} }
else { else {
[self fetchShippingRates:^(PKPaymentAuthorizationStatus status, NSArray *methods, NSArray *summaryItems) { [self fetchShippingRates:^(PKPaymentAuthorizationStatus status, NSArray *methods, NSArray *summaryItems) {
...@@ -222,12 +220,12 @@ const NSTimeInterval PollDelay = 0.5; ...@@ -222,12 +220,12 @@ const NSTimeInterval PollDelay = 0.5;
if (checkout && error == nil) { if (checkout && error == nil) {
self.checkout = checkout; self.checkout = checkout;
} }
completion(error ? PKPaymentAuthorizationStatusFailure : PKPaymentAuthorizationStatusSuccess, shippingMethods, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(error ? PKPaymentAuthorizationStatusFailure : PKPaymentAuthorizationStatusSuccess, shippingMethods, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
}]; }];
} }
else { else {
self.lastError = [NSError errorWithDomain:BUYShopifyError code:BUYShopifyError_NoShippingMethodsToAddress userInfo:nil]; self.lastError = [NSError errorWithDomain:BUYShopifyError code:BUYShopifyError_NoShippingMethodsToAddress userInfo:nil];
completion(status, nil, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(status, nil, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
} }
}]; }];
} }
...@@ -246,7 +244,7 @@ const NSTimeInterval PollDelay = 0.5; ...@@ -246,7 +244,7 @@ const NSTimeInterval PollDelay = 0.5;
shippingStatus = status; shippingStatus = status;
if (error) { if (error) {
completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, nil, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, nil, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
} }
else if (shippingStatus == BUYStatusComplete) { else if (shippingStatus == BUYStatusComplete) {
self.shippingRates = shippingRates; self.shippingRates = shippingRates;
...@@ -254,11 +252,11 @@ const NSTimeInterval PollDelay = 0.5; ...@@ -254,11 +252,11 @@ const NSTimeInterval PollDelay = 0.5;
if ([self.shippingRates count] == 0) { if ([self.shippingRates count] == 0) {
// Shipping address is not supported and no shipping rates were returned // Shipping address is not supported and no shipping rates were returned
if (completion) { if (completion) {
completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, nil, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, nil, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
} }
} else { } else {
if (completion) { if (completion) {
completion(PKPaymentAuthorizationStatusSuccess, self.shippingRates, [self.checkout buy_summaryItemsWithShopName:self.shop.name]); completion(PKPaymentAuthorizationStatusSuccess, self.shippingRates, [self.checkout buy_summaryItemsWithShopName:self.shopName]);
} }
} }
......
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