From e94e7baafe450b9c45eff977a596da6868c93d82 Mon Sep 17 00:00:00 2001 From: Dima Bart <dima.bart01@gmail.com> Date: Mon, 16 May 2016 14:41:15 -0400 Subject: [PATCH] Remove BUYCheckoutOperation. --- Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj | 12 ------------ Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.h | 41 ----------------------------------------- Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m | 164 -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3 files changed, 217 deletions(-) delete mode 100644 Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.h delete mode 100644 Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m diff --git a/Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj b/Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj index e08d1d6..66b8fe5 100644 --- a/Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj +++ b/Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj @@ -381,10 +381,6 @@ 9A47CF201CE50EBB00A6D5BA /* BUYApplePayTestToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A47CF1F1CE50EBB00A6D5BA /* BUYApplePayTestToken.m */; }; 9A47CF221CE5112A00A6D5BA /* BUYAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A47CF211CE5112A00A6D5BA /* BUYAssert.h */; }; 9A47CF231CE5112A00A6D5BA /* BUYAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A47CF211CE5112A00A6D5BA /* BUYAssert.h */; }; - 9A585C061CE6440B001F20F0 /* BUYCheckoutOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A585C021CE6440B001F20F0 /* BUYCheckoutOperation.h */; }; - 9A585C071CE6440B001F20F0 /* BUYCheckoutOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A585C021CE6440B001F20F0 /* BUYCheckoutOperation.h */; }; - 9A585C081CE6440B001F20F0 /* BUYCheckoutOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A585C031CE6440B001F20F0 /* BUYCheckoutOperation.m */; }; - 9A585C091CE6440B001F20F0 /* BUYCheckoutOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A585C031CE6440B001F20F0 /* BUYCheckoutOperation.m */; }; 9A585C0A1CE6440B001F20F0 /* BUYOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A585C041CE6440B001F20F0 /* BUYOperation.h */; }; 9A585C0B1CE6440B001F20F0 /* BUYOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A585C041CE6440B001F20F0 /* BUYOperation.h */; }; 9A585C0C1CE6440B001F20F0 /* BUYOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A585C051CE6440B001F20F0 /* BUYOperation.m */; }; @@ -683,8 +679,6 @@ 9A47CF1E1CE50EBB00A6D5BA /* BUYApplePayTestToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYApplePayTestToken.h; sourceTree = "<group>"; }; 9A47CF1F1CE50EBB00A6D5BA /* BUYApplePayTestToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYApplePayTestToken.m; sourceTree = "<group>"; }; 9A47CF211CE5112A00A6D5BA /* BUYAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BUYAssert.h; path = ../Additions/BUYAssert.h; sourceTree = "<group>"; }; - 9A585C021CE6440B001F20F0 /* BUYCheckoutOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYCheckoutOperation.h; sourceTree = "<group>"; }; - 9A585C031CE6440B001F20F0 /* BUYCheckoutOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYCheckoutOperation.m; sourceTree = "<group>"; }; 9A585C041CE6440B001F20F0 /* BUYOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYOperation.h; sourceTree = "<group>"; }; 9A585C051CE6440B001F20F0 /* BUYOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYOperation.m; sourceTree = "<group>"; }; 9A585C111CE65811001F20F0 /* BUYRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYRequestOperation.h; sourceTree = "<group>"; }; @@ -1136,8 +1130,6 @@ 9A585C011CE6440B001F20F0 /* Operations */ = { isa = PBXGroup; children = ( - 9A585C021CE6440B001F20F0 /* BUYCheckoutOperation.h */, - 9A585C031CE6440B001F20F0 /* BUYCheckoutOperation.m */, 9A585C041CE6440B001F20F0 /* BUYOperation.h */, 9A585C051CE6440B001F20F0 /* BUYOperation.m */, 9A585C111CE65811001F20F0 /* BUYRequestOperation.h */, @@ -1381,7 +1373,6 @@ 84B0A73B1CE10ED900253EB0 /* BUYWebCheckoutPaymentProvider.h in Headers */, 841ADE081CB6C942000004B0 /* NSDateFormatter+BUYAdditions.h in Headers */, 841ADE001CB6C942000004B0 /* NSArray+BUYAdditions.h in Headers */, - 9A585C071CE6440B001F20F0 /* BUYCheckoutOperation.h in Headers */, 841ADE101CB6C942000004B0 /* NSDictionary+BUYAdditions.h in Headers */, 841ADE1C1CB6C942000004B0 /* NSString+BUYAdditions.h in Headers */, 841ADE181CB6C942000004B0 /* NSRegularExpression+BUYAdditions.h in Headers */, @@ -1490,7 +1481,6 @@ 84B0A73A1CE10ED900253EB0 /* BUYWebCheckoutPaymentProvider.h in Headers */, 841ADE031CB6C942000004B0 /* NSDate+BUYAdditions.h in Headers */, 841ADE071CB6C942000004B0 /* NSDateFormatter+BUYAdditions.h in Headers */, - 9A585C061CE6440B001F20F0 /* BUYCheckoutOperation.h in Headers */, 841ADDFF1CB6C942000004B0 /* NSArray+BUYAdditions.h in Headers */, 841ADE1B1CB6C942000004B0 /* NSString+BUYAdditions.h in Headers */, 841ADE171CB6C942000004B0 /* NSRegularExpression+BUYAdditions.h in Headers */, @@ -1768,7 +1758,6 @@ 84980F551CB7616900CFAB58 /* BUYDecimalNumberTransformer.m in Sources */, 901931041BC5B9BC00D1134E /* BUYApplePayAdditions.m in Sources */, 901931051BC5B9BC00D1134E /* BUYOptionSelectionNavigationController.m in Sources */, - 9A585C091CE6440B001F20F0 /* BUYCheckoutOperation.m in Sources */, 901931061BC5B9BC00D1134E /* BUYDiscount.m in Sources */, 9A0B0C5D1CE662EC0037D68F /* BUYRequestOperation.m in Sources */, 84DD129A1CC63FE600A2442D /* _BUYCart.m in Sources */, @@ -1914,7 +1903,6 @@ 84980F541CB7616900CFAB58 /* BUYDecimalNumberTransformer.m in Sources */, BE9A646D1B503D1C0033E558 /* BUYApplePayAdditions.m in Sources */, BEB74A2A1B554BFB0005A300 /* BUYOptionSelectionNavigationController.m in Sources */, - 9A585C081CE6440B001F20F0 /* BUYCheckoutOperation.m in Sources */, BE9A64501B503CAD0033E558 /* BUYDiscount.m in Sources */, 9A0B0C5E1CE662ED0037D68F /* BUYRequestOperation.m in Sources */, 84DD12821CC63FE600A2442D /* _BUYCart.m in Sources */, diff --git a/Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.h b/Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.h deleted file mode 100644 index 7a40647..0000000 --- a/Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// BUYCheckoutOperation.h -// Mobile Buy SDK -// -// Created by Shopify. -// Copyright (c) 2015 Shopify Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "BUYOperation.h" - -@class BUYClient; -@class BUYCheckout; -@protocol BUYPaymentToken; - -typedef void (^BUYOperationCheckoutCompletion)(BUYCheckout *checkout, NSError *error); - -@interface BUYCheckoutOperation : BUYOperation - -@property (strong, nonatomic, readonly) BUYOperationCheckoutCompletion completion; - -- (instancetype)initWithCheckout:(BUYCheckout *)checkout token:(id<BUYPaymentToken>)token client:(BUYClient *)client completion:(BUYOperationCheckoutCompletion)completion; - -@end diff --git a/Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m b/Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m deleted file mode 100644 index c04cff0..0000000 --- a/Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m +++ /dev/null @@ -1,164 +0,0 @@ -// -// BUYCheckoutOperation.m -// Mobile Buy SDK -// -// Created by Shopify. -// Copyright (c) 2015 Shopify Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "BUYCheckoutOperation.h" -#import "BUYCheckout.h" -#import "BUYClient.h" - -@interface BUYOperation (Private) -- (void)setExecuting:(BOOL)executing; -- (void)setFinished:(BOOL)finished; -@end - -@interface BUYCheckoutOperation () - -@property (strong, nonatomic) BUYCheckout *checkout; -@property (strong, nonatomic) id<BUYPaymentToken> token; -@property (strong, nonatomic) BUYClient *client; - -@end - -@implementation BUYCheckoutOperation - -#pragma mark - Init - - -- (instancetype)initWithCheckout:(BUYCheckout *)checkout token:(id<BUYPaymentToken>)token client:(BUYClient *)client completion:(BUYOperationCheckoutCompletion)completion -{ - self = [super init]; - if (self) { - _checkout = checkout; - _token = token; - _client = client; - _completion = completion; - } - return self; -} - -#pragma mark - Actions - - -- (void)finishWithCheckout:(BUYCheckout *)checkout -{ - [self setExecuting:NO]; - self.completion(checkout, nil); -} - -- (void)finishWithError:(NSError *)error -{ - [self setExecuting:NO]; - self.completion(nil, error); -} - -- (void)finishByCancellation -{ - [self setFinished:YES]; - [self setExecuting:NO]; -} - -#pragma mark - Start - - -- (void)start -{ - [super start]; - [self setExecuting:YES]; - - if (self.isCancelled) { - [self finishByCancellation]; - return; - } - - /* --------------------------------- - * Initiate the checkout process by - * sending the checkout object to the - * backend for processing. - */ - [self.client completeCheckout:self.checkout paymentToken:self.token completion:^(BUYCheckout *checkout, NSError *error) { - if (self.isCancelled) { - [self finishByCancellation]; - return; - - } else if (checkout) { - - /* ---------------------------------------- - * Recursively poll for checkout completion - * status until we encounter an error or - * get a successful completion status. - */ - [self pollUntilCheckoutCompletion:^(BOOL success, NSError *error) { - if (self.isCancelled ) { - [self finishByCancellation]; - return; - - } else if (success) { - - /* --------------------------------- - * Finally, after the checkout is - * complete, we'll need to fetch the - * completed checkout object. - */ - [self.client getCheckout:self.checkout completion:^(BUYCheckout *checkout, NSError *error) { - if (self.isCancelled) { - [self finishByCancellation]; - return; - - } else if (checkout) { - [self finishWithCheckout:checkout]; - } else { - [self finishWithError:error]; - } - }]; - - } else { - [self finishWithError:error]; - } - }]; - - } else { - [self finishWithError:error]; - } - }]; -} - -#pragma mark - Requests - - -- (void)pollUntilCheckoutCompletion:(void(^)(BOOL success, NSError *error))completion { - [self.client getCompletionStatusOfCheckout:self.checkout completion:^(BUYStatus status, NSError *error) { - if (self.isCancelled) { - [self finishByCancellation]; - return; - - } else if (status == BUYStatusComplete) { - completion(YES, nil); - } else if (error) { - completion(NO, error); - } else { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [self pollUntilCheckoutCompletion:completion]; - }); - } - }]; -} - -@end -- libgit2 0.26.0