Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
a2e76401
Commit
a2e76401
authored
Jun 02, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #207 from Shopify/task/private-operations
Prevent exposing BUYRequestOperation
parents
68c3b520
39dcac73
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
165 additions
and
338 deletions
+165
-338
BUYClientTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
+24
-106
BUYClientTest_Customer.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest_Customer.m
+9
-9
BUYClientTest_Storefront.m
...e Buy SDK/Mobile Buy SDK Tests/BUYClientTest_Storefront.m
+1
-1
BUYIntegrationTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
+1
-1
BUYRequestOperationTests.m
...e Buy SDK/Mobile Buy SDK Tests/BUYRequestOperationTests.m
+10
-10
project.pbxproj
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
+8
-19
NSURLComponents+BUYAdditions.h
...K/Mobile Buy SDK/Additions/NSURLComponents+BUYAdditions.h
+0
-33
NSURLComponents+BUYAdditions.m
...K/Mobile Buy SDK/Additions/NSURLComponents+BUYAdditions.m
+0
-43
Buy.h
Mobile Buy SDK/Mobile Buy SDK/Buy.h
+0
-2
BUYClient+Address.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.h
+5
-5
BUYClient+Address.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.m
+5
-5
BUYClient+Checkout.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.h
+12
-12
BUYClient+Checkout.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.m
+17
-17
BUYClient+Customers.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.h
+11
-11
BUYClient+Customers.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
+12
-12
BUYClient+Internal.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Internal.h
+14
-14
BUYClient+Storefront.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.h
+8
-8
BUYClient+Storefront.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.m
+8
-8
BUYClient.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
+13
-13
BUYCheckoutOperation.m
... Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m
+7
-7
Buy.h
Mobile Buy SDK/Mobile Buy SDK/Static Framework/Buy.h
+0
-2
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
View file @
a2e76401
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#import <Buy/Buy.h>
#import <Buy/Buy.h>
#import "BUYTestConstants.h"
#import "BUYTestConstants.h"
#import "BUYClientTestBase.h"
#import "BUYClientTestBase.h"
#import "NSURLComponents+BUYAdditions.h"
#import "BUYShopifyErrorCodes.h"
#import "BUYShopifyErrorCodes.h"
#import "BUYAccountCredentials.h"
#import "BUYAccountCredentials.h"
#import "BUYClient+Customers.h"
#import "BUYClient+Customers.h"
...
@@ -47,7 +46,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -47,7 +46,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
@implementation
BUYClient_Test
@implementation
BUYClient_Test
-
(
void
)
startOperation
:(
BUY
Operation
*
)
operation
-
(
void
)
startOperation
:(
NS
Operation
*
)
operation
{
{
// Do nothing
// Do nothing
}
}
...
@@ -72,7 +71,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -72,7 +71,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
{
{
BUYCart
*
cart
=
[
self
cart
];
BUYCart
*
cart
=
[
self
cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWithCart
:
cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWithCart
:
cart
];
BUYRequestOperation
*
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}];
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}];
XCTAssertNotNil
(
task
);
XCTAssertNotNil
(
task
);
NSURLRequest
*
request
=
task
.
originalRequest
;
NSURLRequest
*
request
=
task
.
originalRequest
;
...
@@ -104,7 +103,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -104,7 +103,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
XCTAssertThrows
([
checkout
setPartialAddressesValue
:
NO
]);
XCTAssertThrows
([
checkout
setPartialAddressesValue
:
NO
]);
BUYRequestOperation
*
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}];
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}];
NSDictionary
*
json
=
[
NSJSONSerialization
JSONObjectWithData
:
task
.
originalRequest
.
HTTPBody
options
:
0
error
:
nil
];
NSDictionary
*
json
=
[
NSJSONSerialization
JSONObjectWithData
:
task
.
originalRequest
.
HTTPBody
options
:
0
error
:
nil
];
XCTAssertFalse
([
json
[
@"checkout"
][
@"partial_addresses"
]
boolValue
]);
XCTAssertFalse
([
json
[
@"checkout"
][
@"partial_addresses"
]
boolValue
]);
...
@@ -118,7 +117,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -118,7 +117,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
}
}
checkout
.
shippingAddress
=
partialAddress
;
checkout
.
shippingAddress
=
partialAddress
;
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}];
task
=
(
BUYRequestOperation
*
)
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}];
json
=
[
NSJSONSerialization
JSONObjectWithData
:
task
.
originalRequest
.
HTTPBody
options
:
0
error
:
nil
];
json
=
[
NSJSONSerialization
JSONObjectWithData
:
task
.
originalRequest
.
HTTPBody
options
:
0
error
:
nil
];
XCTAssertTrue
([
json
[
@"checkout"
][
@"partial_addresses"
]
boolValue
]);
XCTAssertTrue
([
json
[
@"checkout"
][
@"partial_addresses"
]
boolValue
]);
...
@@ -170,19 +169,22 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -170,19 +169,22 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
XCTAssertEqual
(
BUYStatusComplete
,
status
);
XCTAssertEqual
(
BUYStatusComplete
,
status
);
}
}
-
(
void
)
test
QueryItems
Conversion
-
(
void
)
test
Sort
Conversion
{
{
NSDictionary
*
dictionary
=
@{
@"collection_id"
:
@"1"
,
@"limit"
:
@"25"
,
@"page"
:
@"1"
,
@"sort_by"
:
@"collection-default"
};
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortBestSelling
],
@"best-selling"
);
NSURLComponents
*
components
=
[[
NSURLComponents
alloc
]
init
];
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortCreatedAscending
],
@"created-ascending"
);
[
components
setQueryItemsWithDictionary
:
dictionary
];
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortCreatedDescending
],
@"created-descending"
);
NSSet
*
componentsQueryItems
=
[
NSSet
setWithArray
:
components
.
queryItems
];
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortPriceAscending
],
@"price-ascending"
);
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[[
NSURLQueryItem
queryItemWithName
:
@"collection_id"
value
:
@"1"
],
[
NSURLQueryItem
queryItemWithName
:
@"limit"
value
:
@"25"
],
[
NSURLQueryItem
queryItemWithName
:
@"page"
value
:
@"1"
],
[
NSURLQueryItem
queryItemWithName
:
@"sort_by"
value
:
@"collection-default"
]]];
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortPriceDescending
],
@"price-descending"
);
XCTAssertEqualObjects
(
componentsQueryItems
,
queryItems
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortTitleAscending
],
@"title-ascending"
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
BUYCollectionSortTitleDescending
],
@"title-descending"
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
999
],
@"collection-default"
);
XCTAssertEqualObjects
([
BUYCollection
sortOrderParameterForCollectionSort
:
0
],
@"collection-default"
);
}
}
-
(
void
)
testProductsInCollection
WithSortOrderCollectionDefault
-
(
void
)
testProductsInCollection
{
{
BUYRequestOperation
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
@@ -192,90 +194,6 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -192,90 +194,6 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
}
-
(
void
)
testProductsInCollectionWithSortOrderBestSelling
{
BUYRequestOperation
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortBestSelling
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=best-selling"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderCreatedAscending
{
BUYRequestOperation
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCreatedAscending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=created-ascending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderCreatedDescending
{
BUYRequestOperation
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCreatedDescending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=created-descending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderPriceAscending
{
BUYRequestOperation
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortPriceAscending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=price-ascending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderPriceDescending
{
BUYRequestOperation
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortPriceDescending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=price-descending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderTitleAscending
{
BUYRequestOperation
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortTitleAscending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=title-ascending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
void
)
testProductsInCollectionWithSortOrderTitleDescending
{
BUYRequestOperation
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortTitleDescending
completion
:^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/apps/app_id/product_listings.json"
);
NSSet
*
requestQueryItems
=
[
NSSet
setWithArray
:[
task
.
originalRequest
.
URL
.
query
componentsSeparatedByString
:
@"&"
]];
NSSet
*
queryItems
=
[
NSSet
setWithArray
:@[
@"collection_id=1"
,
@"limit=25"
,
@"page=1"
,
@"sort_by=title-descending"
]];
XCTAssertEqualObjects
(
requestQueryItems
,
queryItems
);
}
-
(
BUYCart
*
)
cart
-
(
BUYCart
*
)
cart
{
{
return
[
self
.
client
.
modelManager
insertCartWithJSONDictionary
:
nil
];
return
[
self
.
client
.
modelManager
insertCartWithJSONDictionary
:
nil
];
...
@@ -294,7 +212,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -294,7 +212,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
];
];
BUYAccountCredentials
*
credentials
=
[
BUYAccountCredentials
credentialsWithItems
:
items
];
BUYAccountCredentials
*
credentials
=
[
BUYAccountCredentials
credentialsWithItems
:
items
];
BUYRequestOperation
*
task
=
[
self
.
client
createCustomerWithCredentials
:
credentials
callback
:
^
(
BUYCustomer
*
customer
,
NSString
*
token
,
NSError
*
error
)
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
createCustomerWithCredentials
:
credentials
callback
:
^
(
BUYCustomer
*
customer
,
NSString
*
token
,
NSError
*
error
)
{
}];
}];
...
@@ -323,7 +241,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -323,7 +241,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
[
BUYAccountCredentialItem
itemWithPassword
:
@"password"
],
[
BUYAccountCredentialItem
itemWithPassword
:
@"password"
],
];
];
BUYAccountCredentials
*
credentials
=
[
BUYAccountCredentials
credentialsWithItems
:
items
];
BUYAccountCredentials
*
credentials
=
[
BUYAccountCredentials
credentialsWithItems
:
items
];
BUYRequestOperation
*
task
=
[
self
.
client
loginCustomerWithCredentials
:
credentials
callback
:
^
(
BUYCustomer
*
customer
,
NSString
*
token
,
NSError
*
error
)
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
loginCustomerWithCredentials
:
credentials
callback
:
^
(
BUYCustomer
*
customer
,
NSString
*
token
,
NSError
*
error
)
{
}];
}];
...
@@ -344,7 +262,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -344,7 +262,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testGetCustomerURL
-
(
void
)
testGetCustomerURL
{
{
BUYRequestOperation
*
task
=
[
self
.
client
getCustomerWithID
:
@""
callback
:
^
(
BUYCustomer
*
customer
,
NSError
*
error
)
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
getCustomerWithID
:
@""
callback
:
^
(
BUYCustomer
*
customer
,
NSError
*
error
)
{
}];
}];
...
@@ -357,7 +275,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -357,7 +275,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testGetOrdersForCustomerURL
-
(
void
)
testGetOrdersForCustomerURL
{
{
BUYRequestOperation
*
task
=
[
self
.
client
getOrdersForCustomerWithID
:
@"99"
callback
:
^
(
NSArray
<
BUYOrder
*>
*
orders
,
NSError
*
error
)
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
getOrdersForCustomerWithID
:
@"99"
callback
:
^
(
NSArray
<
BUYOrder
*>
*
orders
,
NSError
*
error
)
{
}];
}];
...
@@ -371,7 +289,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -371,7 +289,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testCustomerRecovery
-
(
void
)
testCustomerRecovery
{
{
NSString
*
email
=
@"fake@example.com"
;
NSString
*
email
=
@"fake@example.com"
;
BUYRequestOperation
*
task
=
[
self
.
client
recoverPasswordForCustomer
:
email
callback
:
^
(
BUYStatus
status
,
NSError
*
error
)
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
recoverPasswordForCustomer
:
email
callback
:
^
(
BUYStatus
status
,
NSError
*
error
)
{
}];
}];
...
@@ -391,11 +309,11 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -391,11 +309,11 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
{
{
self
.
client
.
customerToken
=
nil
;
self
.
client
.
customerToken
=
nil
;
BUYRequestOperation
*
task
=
[
self
.
client
renewCustomerTokenWithID
:
@""
callback
:
^
(
NSString
*
token
,
NSError
*
error
)
{}];
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
renewCustomerTokenWithID
:
@""
callback
:
^
(
NSString
*
token
,
NSError
*
error
)
{}];
XCTAssertNil
(
task
);
// task should be nil if no customer token was set on the client
XCTAssertNil
(
task
);
// task should be nil if no customer token was set on the client
self
.
client
.
customerToken
=
BUYFakeCustomerToken
;
self
.
client
.
customerToken
=
BUYFakeCustomerToken
;
task
=
[
self
.
client
renewCustomerTokenWithID
:
@"1"
callback
:
^
(
NSString
*
token
,
NSError
*
error
)
{
task
=
(
BUYRequestOperation
*
)
[
self
.
client
renewCustomerTokenWithID
:
@"1"
callback
:
^
(
NSString
*
token
,
NSError
*
error
)
{
}];
}];
...
@@ -413,7 +331,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -413,7 +331,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
BUYAccountCredentials
*
credentials
=
[
BUYAccountCredentials
credentialsWithItems
:
items
];
BUYAccountCredentials
*
credentials
=
[
BUYAccountCredentials
credentialsWithItems
:
items
];
NSString
*
customerID
=
@"12345"
;
NSString
*
customerID
=
@"12345"
;
NSString
*
token
=
@"12345"
;
NSString
*
token
=
@"12345"
;
BUYRequestOperation
*
task
=
[
self
.
client
activateCustomerWithCredentials
:
credentials
customerID
:
customerID
token
:
token
callback
:^
(
BUYCustomer
*
customer
,
NSString
*
token
,
NSError
*
error
)
{
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)
[
self
.
client
activateCustomerWithCredentials
:
credentials
customerID
:
customerID
token
:
token
callback
:^
(
BUYCustomer
*
customer
,
NSString
*
token
,
NSError
*
error
)
{
}];
}];
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest_Customer.m
View file @
a2e76401
...
@@ -161,7 +161,7 @@
...
@@ -161,7 +161,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}
];
}
}
#pragma mark - Orders -
#pragma mark - Orders -
...
@@ -182,7 +182,7 @@
...
@@ -182,7 +182,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
testCustomerOrderWithID
-
(
void
)
testCustomerOrderWithID
...
@@ -198,7 +198,7 @@
...
@@ -198,7 +198,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
#pragma mark - Update -
#pragma mark - Update -
...
@@ -221,7 +221,7 @@
...
@@ -221,7 +221,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}
];
}
}
#pragma mark - Address -
#pragma mark - Address -
...
@@ -245,7 +245,7 @@
...
@@ -245,7 +245,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
testAddressCRUD
-
(
void
)
testAddressCRUD
...
@@ -291,7 +291,7 @@
...
@@ -291,7 +291,7 @@
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
getAddress
-
(
void
)
getAddress
...
@@ -312,7 +312,7 @@
...
@@ -312,7 +312,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
updateAddress
-
(
void
)
updateAddress
...
@@ -345,7 +345,7 @@
...
@@ -345,7 +345,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
deleteAddress
-
(
void
)
deleteAddress
...
@@ -365,7 +365,7 @@
...
@@ -365,7 +365,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}
];
}
}
#pragma mark - Address -
#pragma mark - Address -
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest_Storefront.m
View file @
a2e76401
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
testGetProductById
-
(
void
)
testGetProductById
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
View file @
a2e76401
...
@@ -165,7 +165,7 @@
...
@@ -165,7 +165,7 @@
[
expectation
fulfill
];
[
expectation
fulfill
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
updateCheckout
-
(
void
)
updateCheckout
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYRequestOperationTests.m
View file @
a2e76401
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
[
operation
start
];
[
operation
start
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
#pragma mark - Data Tests -
#pragma mark - Data Tests -
...
@@ -108,7 +108,7 @@
...
@@ -108,7 +108,7 @@
}];
}];
[
self
.
queue
addOperation
:
operation
];
[
self
.
queue
addOperation
:
operation
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
testFailedRequest
-
(
void
)
testFailedRequest
...
@@ -141,7 +141,7 @@
...
@@ -141,7 +141,7 @@
}];
}];
[
self
.
queue
addOperation
:
operation
];
[
self
.
queue
addOperation
:
operation
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
#pragma mark - Dependency Tests -
#pragma mark - Dependency Tests -
...
@@ -166,7 +166,7 @@
...
@@ -166,7 +166,7 @@
[
self
.
queue
addOperation
:
operation2
];
[
self
.
queue
addOperation
:
operation2
];
[
self
.
queue
addOperation
:
operation1
];
[
self
.
queue
addOperation
:
operation1
];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
^
(
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
container
,
@"12"
);
XCTAssertEqualObjects
(
container
,
@"12"
);
}
}
...
@@ -205,7 +205,7 @@
...
@@ -205,7 +205,7 @@
[
self
.
queue
addOperation
:
operation2
];
[
self
.
queue
addOperation
:
operation2
];
[
self
.
queue
addOperation
:
operation1
];
[
self
.
queue
addOperation
:
operation1
];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
10
.
0
handler
:
^
(
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
container
,
@"1134"
);
XCTAssertEqualObjects
(
container
,
@"1134"
);
}
}
...
@@ -244,7 +244,7 @@
...
@@ -244,7 +244,7 @@
};
};
[
self
.
queue
addOperation
:
operation
];
[
self
.
queue
addOperation
:
operation
];
[
self
waitForExpectationsWithTimeout
:
5
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
5
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
testCancellationBeforeExecution
-
(
void
)
testCancellationBeforeExecution
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
[
self
.
queue
addOperation
:
operation
];
[
self
.
queue
addOperation
:
operation
];
[
operation
cancel
];
[
operation
cancel
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
testCancellationDuringExecution
-
(
void
)
testCancellationDuringExecution
...
@@ -277,7 +277,7 @@
...
@@ -277,7 +277,7 @@
[
operation
cancel
];
[
operation
cancel
];
}];
}];
[
self
waitForExpectationsWithTimeout
:
4
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
4
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
testCancellationWithoutQueue
-
(
void
)
testCancellationWithoutQueue
...
@@ -292,7 +292,7 @@
...
@@ -292,7 +292,7 @@
[
operation
cancel
];
[
operation
cancel
];
[
self
createExpectationDelay
];
[
self
createExpectationDelay
];
[
self
waitForExpectationsWithTimeout
:
4
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
4
.
0
handler
:
^
(
NSError
*
error
)
{}
];
}
}
-
(
void
)
testCancellationDuringPolling
-
(
void
)
testCancellationDuringPolling
...
@@ -351,7 +351,7 @@
...
@@ -351,7 +351,7 @@
}];
}];
if
(
block
)
{
if
(
block
)
{
[
self
waitForExpectationsWithTimeout
:
delay
+
0
.
1
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
delay
+
0
.
1
handler
:
^
(
NSError
*
error
)
{}
];
}
}
}
}
...
...
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
View file @
a2e76401
...
@@ -69,10 +69,6 @@
...
@@ -69,10 +69,6 @@
841ADE201CB6C942000004B0
/* NSURL+BUYAdditions.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFB1CB6C942000004B0
/* NSURL+BUYAdditions.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
841ADE201CB6C942000004B0
/* NSURL+BUYAdditions.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFB1CB6C942000004B0
/* NSURL+BUYAdditions.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
841ADE211CB6C942000004B0
/* NSURL+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
;
};
841ADE211CB6C942000004B0
/* NSURL+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
;
};
841ADE221CB6C942000004B0
/* NSURL+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
;
};
841ADE221CB6C942000004B0
/* NSURL+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
;
};
841ADE231CB6C942000004B0
/* NSURLComponents+BUYAdditions.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFD1CB6C942000004B0
/* NSURLComponents+BUYAdditions.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
841ADE241CB6C942000004B0
/* NSURLComponents+BUYAdditions.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFD1CB6C942000004B0
/* NSURLComponents+BUYAdditions.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
841ADE251CB6C942000004B0
/* NSURLComponents+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
;
};
841ADE261CB6C942000004B0
/* NSURLComponents+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
;
};
8443E2D11CE2917500EA08D4
/* BUYPaymentProviderTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8443E2D01CE2917500EA08D4
/* BUYPaymentProviderTests.m */
;
};
8443E2D11CE2917500EA08D4
/* BUYPaymentProviderTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8443E2D01CE2917500EA08D4
/* BUYPaymentProviderTests.m */
;
};
849110311CCE708900E53B93
/* BUYArrayAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
;
};
849110311CCE708900E53B93
/* BUYArrayAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
;
};
849110321CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8491102F1CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m */
;
};
849110321CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8491102F1CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m */
;
};
...
@@ -335,8 +331,8 @@
...
@@ -335,8 +331,8 @@
90F5930B1B0D5F4C0026B382
/* BUYObjectTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90F592FF1B0D5F4C0026B382
/* BUYObjectTests.m */
;
};
90F5930B1B0D5F4C0026B382
/* BUYObjectTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90F592FF1B0D5F4C0026B382
/* BUYObjectTests.m */
;
};
9A0B0C5D1CE662EC0037D68F
/* BUYRequestOperation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C121CE65811001F20F0
/* BUYRequestOperation.m */
;
};
9A0B0C5D1CE662EC0037D68F
/* BUYRequestOperation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C121CE65811001F20F0
/* BUYRequestOperation.m */
;
};
9A0B0C5E1CE662ED0037D68F
/* BUYRequestOperation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C121CE65811001F20F0
/* BUYRequestOperation.m */
;
};
9A0B0C5E1CE662ED0037D68F
/* BUYRequestOperation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C121CE65811001F20F0
/* BUYRequestOperation.m */
;
};
9A0B0C5F1CE662EF0037D68F
/* BUYRequestOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C111CE65811001F20F0
/* BUYRequestOperation.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A0B0C5F1CE662EF0037D68F
/* BUYRequestOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C111CE65811001F20F0
/* BUYRequestOperation.h */
;
};
9A0B0C601CE662EF0037D68F
/* BUYRequestOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C111CE65811001F20F0
/* BUYRequestOperation.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A0B0C601CE662EF0037D68F
/* BUYRequestOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C111CE65811001F20F0
/* BUYRequestOperation.h */
;
};
9A0B0C631CE9F8530037D68F
/* BUYRequestOperationTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0B0C621CE9F8530037D68F
/* BUYRequestOperationTests.m */
;
};
9A0B0C631CE9F8530037D68F
/* BUYRequestOperationTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0B0C621CE9F8530037D68F
/* BUYRequestOperationTests.m */
;
};
9A0B0C661CEA703E0037D68F
/* BUYClient+Routing.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0B0C641CEA703E0037D68F
/* BUYClient+Routing.h */
;
};
9A0B0C661CEA703E0037D68F
/* BUYClient+Routing.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0B0C641CEA703E0037D68F
/* BUYClient+Routing.h */
;
};
9A0B0C671CEA703E0037D68F
/* BUYClient+Routing.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0B0C641CEA703E0037D68F
/* BUYClient+Routing.h */
;
};
9A0B0C671CEA703E0037D68F
/* BUYClient+Routing.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0B0C641CEA703E0037D68F
/* BUYClient+Routing.h */
;
};
...
@@ -376,8 +372,8 @@
...
@@ -376,8 +372,8 @@
9A47CF201CE50EBB00A6D5BA
/* BUYApplePayTestToken.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF1F1CE50EBB00A6D5BA
/* BUYApplePayTestToken.m */
;
};
9A47CF201CE50EBB00A6D5BA
/* BUYApplePayTestToken.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF1F1CE50EBB00A6D5BA
/* BUYApplePayTestToken.m */
;
};
9A47CF221CE5112A00A6D5BA
/* BUYAssert.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF211CE5112A00A6D5BA
/* BUYAssert.h */
;
};
9A47CF221CE5112A00A6D5BA
/* BUYAssert.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF211CE5112A00A6D5BA
/* BUYAssert.h */
;
};
9A47CF231CE5112A00A6D5BA
/* BUYAssert.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF211CE5112A00A6D5BA
/* BUYAssert.h */
;
};
9A47CF231CE5112A00A6D5BA
/* BUYAssert.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF211CE5112A00A6D5BA
/* BUYAssert.h */
;
};
9A585C0A1CE6440B001F20F0
/* BUYOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C041CE6440B001F20F0
/* BUYOperation.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A585C0A1CE6440B001F20F0
/* BUYOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C041CE6440B001F20F0
/* BUYOperation.h */
;
};
9A585C0B1CE6440B001F20F0
/* BUYOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C041CE6440B001F20F0
/* BUYOperation.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A585C0B1CE6440B001F20F0
/* BUYOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C041CE6440B001F20F0
/* BUYOperation.h */
;
};
9A585C0C1CE6440B001F20F0
/* BUYOperation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C051CE6440B001F20F0
/* BUYOperation.m */
;
};
9A585C0C1CE6440B001F20F0
/* BUYOperation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C051CE6440B001F20F0
/* BUYOperation.m */
;
};
9A585C0D1CE6440B001F20F0
/* BUYOperation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C051CE6440B001F20F0
/* BUYOperation.m */
;
};
9A585C0D1CE6440B001F20F0
/* BUYOperation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C051CE6440B001F20F0
/* BUYOperation.m */
;
};
9A6B03791CDA5D4F0054C26E
/* BUYAccountCredentialsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A6B03781CDA5D4F0054C26E
/* BUYAccountCredentialsTests.m */
;
};
9A6B03791CDA5D4F0054C26E
/* BUYAccountCredentialsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A6B03781CDA5D4F0054C26E
/* BUYAccountCredentialsTests.m */
;
};
...
@@ -496,8 +492,6 @@
...
@@ -496,8 +492,6 @@
841ADDFA1CB6C942000004B0
/* NSString+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSString+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
841ADDFA1CB6C942000004B0
/* NSString+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSString+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
841ADDFB1CB6C942000004B0
/* NSURL+BUYAdditions.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"NSURL+BUYAdditions.h"
;
sourceTree
=
"<group>"
;
};
841ADDFB1CB6C942000004B0
/* NSURL+BUYAdditions.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"NSURL+BUYAdditions.h"
;
sourceTree
=
"<group>"
;
};
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSURL+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSURL+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
841ADDFD1CB6C942000004B0
/* NSURLComponents+BUYAdditions.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"NSURLComponents+BUYAdditions.h"
;
sourceTree
=
"<group>"
;
};
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSURLComponents+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
8443E2D01CE2917500EA08D4
/* BUYPaymentProviderTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYPaymentProviderTests.m
;
sourceTree
=
"<group>"
;
};
8443E2D01CE2917500EA08D4
/* BUYPaymentProviderTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYPaymentProviderTests.m
;
sourceTree
=
"<group>"
;
};
8465CF441CC13CFE0010B2E6
/* Templates */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder
;
path
=
Templates
;
sourceTree
=
"<group>"
;
};
8465CF441CC13CFE0010B2E6
/* Templates */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder
;
path
=
Templates
;
sourceTree
=
"<group>"
;
};
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYArrayAdditionsTests.m
;
sourceTree
=
"<group>"
;
};
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYArrayAdditionsTests.m
;
sourceTree
=
"<group>"
;
};
...
@@ -786,8 +780,6 @@
...
@@ -786,8 +780,6 @@
841ADDFA1CB6C942000004B0
/* NSString+BUYAdditions.m */
,
841ADDFA1CB6C942000004B0
/* NSString+BUYAdditions.m */
,
841ADDFB1CB6C942000004B0
/* NSURL+BUYAdditions.h */
,
841ADDFB1CB6C942000004B0
/* NSURL+BUYAdditions.h */
,
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
,
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
,
841ADDFD1CB6C942000004B0
/* NSURLComponents+BUYAdditions.h */
,
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
,
);
);
path
=
Additions
;
path
=
Additions
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -1175,10 +1167,10 @@
...
@@ -1175,10 +1167,10 @@
F773749F19C77E4E0039681C
/* Classes */
=
{
F773749F19C77E4E0039681C
/* Classes */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
9A585C011CE6440B001F20F0
/* Operations */
,
90DA8DF11BC6A82D0027BCB7
/* Buy.h */
,
90DA8DF11BC6A82D0027BCB7
/* Buy.h */
,
F7FDA16F19C93F6100AF4E93
/* Client */
,
9A585C011CE6440B001F20F0
/* Operations */
,
841ADDEA1CB6C942000004B0
/* Additions */
,
841ADDEA1CB6C942000004B0
/* Additions */
,
F7FDA16F19C93F6100AF4E93
/* Data */
,
F773744419C779C20039681C
/* Models */
,
F773744419C779C20039681C
/* Models */
,
84B0A7281CE10ED900253EB0
/* Payment Providers */
,
84B0A7281CE10ED900253EB0
/* Payment Providers */
,
F773744519C779C20039681C
/* Utils */
,
F773744519C779C20039681C
/* Utils */
,
...
@@ -1187,7 +1179,7 @@
...
@@ -1187,7 +1179,7 @@
name
=
Classes
;
name
=
Classes
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
F7FDA16F19C93F6100AF4E93
/*
Data
*/
=
{
F7FDA16F19C93F6100AF4E93
/*
Client
*/
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
8498DCB01CDD1B4A00BD12A8
/* BUYClient+Internal.h */
,
8498DCB01CDD1B4A00BD12A8
/* BUYClient+Internal.h */
,
...
@@ -1204,6 +1196,7 @@
...
@@ -1204,6 +1196,7 @@
9A807E811CF74EBE00023160
/* BUYClient+Address.h */
,
9A807E811CF74EBE00023160
/* BUYClient+Address.h */
,
9A807E821CF74EBE00023160
/* BUYClient+Address.m */
,
9A807E821CF74EBE00023160
/* BUYClient+Address.m */
,
);
);
name
=
Client
;
path
=
Data
;
path
=
Data
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
...
@@ -1263,7 +1256,6 @@
...
@@ -1263,7 +1256,6 @@
84980F531CB7616900CFAB58
/* BUYDecimalNumberTransformer.h in Headers */
,
84980F531CB7616900CFAB58
/* BUYDecimalNumberTransformer.h in Headers */
,
901931421BC5B9BC00D1134E
/* BUYMaskedCreditCard.h in Headers */
,
901931421BC5B9BC00D1134E
/* BUYMaskedCreditCard.h in Headers */
,
841ADE201CB6C942000004B0
/* NSURL+BUYAdditions.h in Headers */
,
841ADE201CB6C942000004B0
/* NSURL+BUYAdditions.h in Headers */
,
841ADE241CB6C942000004B0
/* NSURLComponents+BUYAdditions.h in Headers */
,
B2653EC41CEF55CC0012D57D
/* BUYModelManager+ApplePay.h in Headers */
,
B2653EC41CEF55CC0012D57D
/* BUYModelManager+ApplePay.h in Headers */
,
841ADE141CB6C942000004B0
/* NSException+BUYAdditions.h in Headers */
,
841ADE141CB6C942000004B0
/* NSException+BUYAdditions.h in Headers */
,
841ADE041CB6C942000004B0
/* NSDate+BUYAdditions.h in Headers */
,
841ADE041CB6C942000004B0
/* NSDate+BUYAdditions.h in Headers */
,
...
@@ -1363,7 +1355,6 @@
...
@@ -1363,7 +1355,6 @@
841ADE0F1CB6C942000004B0
/* NSDictionary+BUYAdditions.h in Headers */
,
841ADE0F1CB6C942000004B0
/* NSDictionary+BUYAdditions.h in Headers */
,
841ADE1F1CB6C942000004B0
/* NSURL+BUYAdditions.h in Headers */
,
841ADE1F1CB6C942000004B0
/* NSURL+BUYAdditions.h in Headers */
,
B2653EC31CEF55CC0012D57D
/* BUYModelManager+ApplePay.h in Headers */
,
B2653EC31CEF55CC0012D57D
/* BUYModelManager+ApplePay.h in Headers */
,
841ADE231CB6C942000004B0
/* NSURLComponents+BUYAdditions.h in Headers */
,
84980F2C1CB75B5E00CFAB58
/* BUYModelManagerProtocol.h in Headers */
,
84980F2C1CB75B5E00CFAB58
/* BUYModelManagerProtocol.h in Headers */
,
84D73C031CDD1944000F978A
/* BUYAddress.h in Headers */
,
84D73C031CDD1944000F978A
/* BUYAddress.h in Headers */
,
841ADE131CB6C942000004B0
/* NSException+BUYAdditions.h in Headers */
,
841ADE131CB6C942000004B0
/* NSException+BUYAdditions.h in Headers */
,
...
@@ -1669,7 +1660,6 @@
...
@@ -1669,7 +1660,6 @@
901931121BC5B9BC00D1134E
/* BUYMaskedCreditCard.m in Sources */
,
901931121BC5B9BC00D1134E
/* BUYMaskedCreditCard.m in Sources */
,
901931131BC5B9BC00D1134E
/* BUYCheckout.m in Sources */
,
901931131BC5B9BC00D1134E
/* BUYCheckout.m in Sources */
,
84DD12A61CC63FE600A2442D
/* _BUYOption.m in Sources */
,
84DD12A61CC63FE600A2442D
/* _BUYOption.m in Sources */
,
841ADE261CB6C942000004B0
/* NSURLComponents+BUYAdditions.m in Sources */
,
8498DCAF1CDD1B2F00BD12A8
/* BUYError+BUYAdditions.m in Sources */
,
8498DCAF1CDD1B2F00BD12A8
/* BUYError+BUYAdditions.m in Sources */
,
84DD12D01CC6401400A2442D
/* BUYCustomer.m in Sources */
,
84DD12D01CC6401400A2442D
/* BUYCustomer.m in Sources */
,
84980F391CB75C2900CFAB58
/* NSPropertyDescription+BUYAdditions.m in Sources */
,
84980F391CB75C2900CFAB58
/* NSPropertyDescription+BUYAdditions.m in Sources */
,
...
@@ -1811,7 +1801,6 @@
...
@@ -1811,7 +1801,6 @@
BE5DC3641B71022D00B2BC1E
/* BUYMaskedCreditCard.m in Sources */
,
BE5DC3641B71022D00B2BC1E
/* BUYMaskedCreditCard.m in Sources */
,
BE9A644C1B503C9F0033E558
/* BUYCheckout.m in Sources */
,
BE9A644C1B503C9F0033E558
/* BUYCheckout.m in Sources */
,
84DD128E1CC63FE600A2442D
/* _BUYOption.m in Sources */
,
84DD128E1CC63FE600A2442D
/* _BUYOption.m in Sources */
,
841ADE251CB6C942000004B0
/* NSURLComponents+BUYAdditions.m in Sources */
,
8498DCAD1CDD1B2F00BD12A8
/* BUYError+BUYAdditions.m in Sources */
,
8498DCAD1CDD1B2F00BD12A8
/* BUYError+BUYAdditions.m in Sources */
,
84DD12CE1CC6401400A2442D
/* BUYCustomer.m in Sources */
,
84DD12CE1CC6401400A2442D
/* BUYCustomer.m in Sources */
,
84980F381CB75C2900CFAB58
/* NSPropertyDescription+BUYAdditions.m in Sources */
,
84980F381CB75C2900CFAB58
/* NSPropertyDescription+BUYAdditions.m in Sources */
,
...
...
Mobile Buy SDK/Mobile Buy SDK/Additions/NSURLComponents+BUYAdditions.h
deleted
100644 → 0
View file @
68c3b520
//
// NSURLComponents+BUYAdditions.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
Foundation
;
@interface
NSURLComponents
(
BUYAdditions
)
-
(
void
)
setQueryItemsWithDictionary
:(
NSDictionary
*
)
namesAndValues
;
@end
Mobile Buy SDK/Mobile Buy SDK/Additions/NSURLComponents+BUYAdditions.m
deleted
100644 → 0
View file @
68c3b520
//
// NSURLComponents+BUYAdditions.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 "NSURLComponents+BUYAdditions.h"
@implementation
NSURLComponents
(
BUYAdditions
)
-
(
void
)
setQueryItemsWithDictionary
:(
NSDictionary
*
)
dictionary
{
if
(
dictionary
)
{
NSMutableArray
*
queryItems
=
[
NSMutableArray
array
];
for
(
NSString
*
key
in
[
dictionary
allKeys
])
{
NSString
*
value
=
[
dictionary
[
key
]
length
]
?
dictionary
[
key
]
:
nil
;
[
queryItems
addObject
:[[
NSURLQueryItem
alloc
]
initWithName
:
key
value
:
value
]];
}
self
.
queryItems
=
[
queryItems
copy
];
}
}
@end
Mobile Buy SDK/Mobile Buy SDK/Buy.h
View file @
a2e76401
...
@@ -67,7 +67,6 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
...
@@ -67,7 +67,6 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
#import <Buy/BUYClient+Customers.h>
#import <Buy/BUYClient+Customers.h>
#import <Buy/BUYClient+Checkout.h>
#import <Buy/BUYClient+Checkout.h>
#import <Buy/BUYClient+Storefront.h>
#import <Buy/BUYClient+Storefront.h>
#import <Buy/BUYRequestOperation.h>
#import <Buy/BUYError.h>
#import <Buy/BUYError.h>
#import <Buy/BUYError+BUYAdditions.h>
#import <Buy/BUYError+BUYAdditions.h>
#import <Buy/BUYManagedObject.h>
#import <Buy/BUYManagedObject.h>
...
@@ -91,4 +90,3 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
...
@@ -91,4 +90,3 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
#import <Buy/NSRegularExpression+BUYAdditions.h>
#import <Buy/NSRegularExpression+BUYAdditions.h>
#import <Buy/NSString+BUYAdditions.h>
#import <Buy/NSString+BUYAdditions.h>
#import <Buy/NSURL+BUYAdditions.h>
#import <Buy/NSURL+BUYAdditions.h>
#import <Buy/NSURLComponents+BUYAdditions.h>
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.h
View file @
a2e76401
...
@@ -56,7 +56,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
...
@@ -56,7 +56,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getAddressesForCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressesBlock
)
block
;
-
(
NS
Operation
*
)
getAddressesForCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressesBlock
)
block
;
/**
/**
* GET /api/customers/:customer_id/addresses/:id
* GET /api/customers/:customer_id/addresses/:id
...
@@ -68,7 +68,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
...
@@ -68,7 +68,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getAddressWithID
:(
NSNumber
*
)
addressID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
;
-
(
NS
Operation
*
)
getAddressWithID
:(
NSNumber
*
)
addressID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
;
/**
/**
* POST /api/customers/:customer_id/addresses
* POST /api/customers/:customer_id/addresses
...
@@ -80,7 +80,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
...
@@ -80,7 +80,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
createAddress
:(
BUYAddress
*
)
address
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
;
-
(
NS
Operation
*
)
createAddress
:(
BUYAddress
*
)
address
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
;
/**
/**
* PUT /api/customers/:customer_id/addresses/:id
* PUT /api/customers/:customer_id/addresses/:id
...
@@ -92,7 +92,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
...
@@ -92,7 +92,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
updateAddress
:(
BUYAddress
*
)
address
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
;
-
(
NS
Operation
*
)
updateAddress
:(
BUYAddress
*
)
address
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
;
/**
/**
* DELETE /api/customers/:customer_id/addresses/:id
* DELETE /api/customers/:customer_id/addresses/:id
...
@@ -104,7 +104,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
...
@@ -104,7 +104,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
deleteAddressWithID
:(
NSNumber
*
)
addressID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
deleteAddressWithID
:(
NSNumber
*
)
addressID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
;
@end
@end
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.m
View file @
a2e76401
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
@implementation
BUYClient
(
Address
)
@implementation
BUYClient
(
Address
)
-
(
BUYRequest
Operation
*
)
getAddressesForCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressesBlock
)
block
-
(
NS
Operation
*
)
getAddressesForCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressesBlock
)
block
{
{
NSURL
*
route
=
[
self
urlForCustomersAddressesWithID
:
customerID
];
NSURL
*
route
=
[
self
urlForCustomersAddressesWithID
:
customerID
];
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getAddressWithID
:(
NSNumber
*
)
addressID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
-
(
NS
Operation
*
)
getAddressWithID
:(
NSNumber
*
)
addressID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
{
{
NSURL
*
route
=
[
self
urlForCustomersAddressWithID
:
customerID
addressID
:
addressID
];
NSURL
*
route
=
[
self
urlForCustomersAddressWithID
:
customerID
addressID
:
addressID
];
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
createAddress
:(
BUYAddress
*
)
address
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
-
(
NS
Operation
*
)
createAddress
:(
BUYAddress
*
)
address
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
{
{
NSURL
*
route
=
[
self
urlForCustomersAddressesWithID
:
customerID
];
NSURL
*
route
=
[
self
urlForCustomersAddressesWithID
:
customerID
];
return
[
self
postRequestForURL
:
route
object
:@{
@"address"
:
address
.
JSONDictionary
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
postRequestForURL
:
route
object
:@{
@"address"
:
address
.
JSONDictionary
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -69,7 +69,7 @@
...
@@ -69,7 +69,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
updateAddress
:(
BUYAddress
*
)
address
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
-
(
NS
Operation
*
)
updateAddress
:(
BUYAddress
*
)
address
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressBlock
)
block
{
{
BUYAssert
(
address
.
identifier
,
@"Failed to update address. Address must have a valid identifier."
);
BUYAssert
(
address
.
identifier
,
@"Failed to update address. Address must have a valid identifier."
);
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
deleteAddressWithID
:(
NSNumber
*
)
addressID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
deleteAddressWithID
:(
NSNumber
*
)
addressID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
{
{
BUYAssert
(
addressID
,
@"Failed to update address. Address must have a valid identifier."
);
BUYAssert
(
addressID
,
@"Failed to update address. Address must have a valid identifier."
);
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.h
View file @
a2e76401
...
@@ -80,7 +80,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -80,7 +80,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
updateOrCreateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
completion
;
-
(
NS
Operation
*
)
updateOrCreateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
completion
;
/**
/**
* Builds a checkout on Shopify. The checkout object is used to prepare an order
* Builds a checkout on Shopify. The checkout object is used to prepare an order
...
@@ -90,7 +90,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -90,7 +90,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
createCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
createCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
/**
/**
* Builds a checkout on Shopify using a Cart Token from an existing cart on your Shopify store's storefront.
* Builds a checkout on Shopify using a Cart Token from an existing cart on your Shopify store's storefront.
...
@@ -101,7 +101,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -101,7 +101,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
createCheckoutWithCartToken
:(
NSString
*
)
cartToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
createCheckoutWithCartToken
:(
NSString
*
)
cartToken
completion
:(
BUYDataCheckoutBlock
)
block
;
/**
/**
* Updates a given BUYCheckout on Shopify.
* Updates a given BUYCheckout on Shopify.
...
@@ -116,7 +116,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -116,7 +116,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
/**
/**
* Retrieves an updated BUYCheckout.
* Retrieves an updated BUYCheckout.
...
@@ -126,7 +126,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -126,7 +126,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
;
/**
/**
* Finalizes the BUYCheckout associated with the token and charges the payment provider (ex: Credit Card, Apple Pay, etc).
* Finalizes the BUYCheckout associated with the token and charges the payment provider (ex: Credit Card, Apple Pay, etc).
...
@@ -153,7 +153,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -153,7 +153,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataStatusBlock
)
block
;
/**
/**
* Retrieve the status of a checkout given a URL obtained in the UIApplicationDelegate method `application:sourceApplication:annotation`
* Retrieve the status of a checkout given a URL obtained in the UIApplicationDelegate method `application:sourceApplication:annotation`
...
@@ -163,7 +163,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -163,7 +163,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutURL
:(
NSURL
*
)
url
completion
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutURL
:(
NSURL
*
)
url
completion
:(
BUYDataStatusBlock
)
block
;
#pragma mark - Shipping Rates -
#pragma mark - Shipping Rates -
...
@@ -176,7 +176,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -176,7 +176,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getShippingRatesForCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataShippingRatesBlock
)
block
;
-
(
NS
Operation
*
)
getShippingRatesForCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataShippingRatesBlock
)
block
;
#pragma mark - Cards -
#pragma mark - Cards -
...
@@ -196,7 +196,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -196,7 +196,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
storeCreditCard
:(
BUYCreditCard
*
)
creditCard
checkout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCreditCardBlock
)
block
;
-
(
NS
Operation
*
)
storeCreditCard
:(
BUYCreditCard
*
)
creditCard
checkout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCreditCardBlock
)
block
;
/**
/**
* Applies a gift card code to the checkout.
* Applies a gift card code to the checkout.
...
@@ -207,7 +207,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -207,7 +207,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
applyGiftCardCode
:(
NSString
*
)
giftCardCode
toCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
applyGiftCardCode
:(
NSString
*
)
giftCardCode
toCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
/**
/**
* Removes a gift card from the checkout.
* Removes a gift card from the checkout.
...
@@ -218,7 +218,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -218,7 +218,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
removeGiftCard
:(
BUYGiftCard
*
)
giftCard
fromCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
removeGiftCard
:(
BUYGiftCard
*
)
giftCard
fromCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
#pragma mark - Reservations -
#pragma mark - Reservations -
...
@@ -232,7 +232,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
...
@@ -232,7 +232,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
removeProductReservationsFromCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
removeProductReservationsFromCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
;
@end
@end
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.m
View file @
a2e76401
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
#pragma mark - Checkout -
#pragma mark - Checkout -
-
(
BUYRequest
Operation
*
)
updateOrCreateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
completion
-
(
NS
Operation
*
)
updateOrCreateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
completion
{
{
if
([
checkout
hasToken
])
{
if
([
checkout
hasToken
])
{
return
[
self
updateCheckout
:
checkout
completion
:
completion
];
return
[
self
updateCheckout
:
checkout
completion
:
completion
];
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
}
}
}
}
-
(
BUYRequest
Operation
*
)
createCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
createCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
{
{
BUYAssert
(
checkout
,
@"Failed to create checkout. Invalid checkout object."
);
BUYAssert
(
checkout
,
@"Failed to create checkout. Invalid checkout object."
);
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
return
[
self
postCheckout
:
json
completion
:
block
];
return
[
self
postCheckout
:
json
completion
:
block
];
}
}
-
(
BUYRequest
Operation
*
)
createCheckoutWithCartToken
:(
NSString
*
)
cartToken
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
createCheckoutWithCartToken
:(
NSString
*
)
cartToken
completion
:(
BUYDataCheckoutBlock
)
block
{
{
BUYAssert
(
cartToken
,
@"Failed to create checkout. Invalid cart token"
);
BUYAssert
(
cartToken
,
@"Failed to create checkout. Invalid cart token"
);
BUYCheckout
*
checkout
=
[
self
.
modelManager
checkoutwithCartToken
:
cartToken
];
BUYCheckout
*
checkout
=
[
self
.
modelManager
checkoutwithCartToken
:
cartToken
];
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
return
[
self
postCheckout
:
json
completion
:
block
];
return
[
self
postCheckout
:
json
completion
:
block
];
}
}
-
(
BUYRequest
Operation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
{
{
BUYAssertCheckout
(
checkout
);
BUYAssertCheckout
(
checkout
);
...
@@ -87,12 +87,12 @@
...
@@ -87,12 +87,12 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
{
{
return
[
self
getCheckoutWithToken
:
checkoutToken
start
:
YES
completion
:
block
];
return
[
self
getCheckoutWithToken
:
checkoutToken
start
:
YES
completion
:
block
];
}
}
-
(
BUYRequest
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
{
{
BUYAssertToken
(
checkoutToken
);
BUYAssertToken
(
checkoutToken
);
...
@@ -109,13 +109,13 @@
...
@@ -109,13 +109,13 @@
return
operation
;
return
operation
;
}
}
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataStatusBlock
)
block
{
{
BUYAssertToken
(
checkoutToken
);
BUYAssertToken
(
checkoutToken
);
return
[
self
getCompletionStatusOfCheckoutWithToken
:
checkoutToken
start
:
YES
completion
:
block
];
return
[
self
getCompletionStatusOfCheckoutWithToken
:
checkoutToken
start
:
YES
completion
:
block
];
}
}
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutURL
:(
NSURL
*
)
url
completion
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutURL
:(
NSURL
*
)
url
completion
:(
BUYDataStatusBlock
)
block
{
{
NSURLComponents
*
components
=
[
NSURLComponents
componentsWithURL
:
url
resolvingAgainstBaseURL
:
NO
];
NSURLComponents
*
components
=
[
NSURLComponents
componentsWithURL
:
url
resolvingAgainstBaseURL
:
NO
];
...
@@ -134,7 +134,7 @@
...
@@ -134,7 +134,7 @@
#pragma mark - Checkout Helpers -
#pragma mark - Checkout Helpers -
-
(
BUYRequest
Operation
*
)
beginCheckoutWithToken
:(
NSString
*
)
checkoutToken
paymentToken
:(
id
<
BUYPaymentToken
>
)
paymentToken
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
beginCheckoutWithToken
:(
NSString
*
)
checkoutToken
paymentToken
:(
id
<
BUYPaymentToken
>
)
paymentToken
completion
:(
BUYDataCheckoutBlock
)
block
{
{
BUYAssertToken
(
checkoutToken
);
BUYAssertToken
(
checkoutToken
);
...
@@ -144,7 +144,7 @@
...
@@ -144,7 +144,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
token
start
:(
BOOL
)
start
completion
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
token
start
:(
BOOL
)
start
completion
:(
BUYDataStatusBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCheckoutsProcessingWithToken
:
token
];
NSURL
*
url
=
[
self
urlForCheckoutsProcessingWithToken
:
token
];
return
[
self
getRequestForURL
:
url
start
:
start
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:
url
start
:
start
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -152,7 +152,7 @@
...
@@ -152,7 +152,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
postCheckout
:(
NSDictionary
*
)
checkoutJSON
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
postCheckout
:(
NSDictionary
*
)
checkoutJSON
completion
:(
BUYDataCheckoutBlock
)
block
{
{
return
[
self
postRequestForURL
:[
self
urlForCheckouts
]
object
:
checkoutJSON
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
postRequestForURL
:[
self
urlForCheckouts
]
object
:
checkoutJSON
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
[
self
handleCheckoutResponse
:
json
error
:
error
block
:
block
];
[
self
handleCheckoutResponse
:
json
error
:
error
block
:
block
];
...
@@ -180,7 +180,7 @@
...
@@ -180,7 +180,7 @@
#pragma mark - Shipping Rates -
#pragma mark - Shipping Rates -
-
(
BUYRequest
Operation
*
)
getShippingRatesForCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataShippingRatesBlock
)
block
-
(
NS
Operation
*
)
getShippingRatesForCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataShippingRatesBlock
)
block
{
{
BUYAssertToken
(
checkoutToken
);
BUYAssertToken
(
checkoutToken
);
...
@@ -188,7 +188,7 @@
...
@@ -188,7 +188,7 @@
@"checkout"
:
@""
,
@"checkout"
:
@""
,
}];
}];
BUYRequestOperation
*
operation
=
[
self
getRequestForURL
:
url
start
:
NO
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
BUYRequestOperation
*
operation
=
(
BUYRequestOperation
*
)
[
self
getRequestForURL
:
url
start
:
NO
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
NSArray
*
shippingRates
=
nil
;
NSArray
*
shippingRates
=
nil
;
if
(
json
&&
!
error
)
{
if
(
json
&&
!
error
)
{
shippingRates
=
[
self
.
modelManager
insertShippingRatesWithJSONArray
:
json
[
@"shipping_rates"
]];
shippingRates
=
[
self
.
modelManager
insertShippingRatesWithJSONArray
:
json
[
@"shipping_rates"
]];
...
@@ -207,7 +207,7 @@
...
@@ -207,7 +207,7 @@
#pragma mark - Cards -
#pragma mark - Cards -
-
(
BUYRequest
Operation
*
)
storeCreditCard
:(
BUYCreditCard
*
)
creditCard
checkout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCreditCardBlock
)
completion
-
(
NS
Operation
*
)
storeCreditCard
:(
BUYCreditCard
*
)
creditCard
checkout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCreditCardBlock
)
completion
{
{
BUYAssertCheckout
(
checkout
);
BUYAssertCheckout
(
checkout
);
BUYAssert
(
creditCard
,
@"Failed to store credit card. No credit card provided."
);
BUYAssert
(
creditCard
,
@"Failed to store credit card. No credit card provided."
);
...
@@ -228,7 +228,7 @@
...
@@ -228,7 +228,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
applyGiftCardCode
:(
NSString
*
)
giftCardCode
toCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
applyGiftCardCode
:(
NSString
*
)
giftCardCode
toCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
{
{
BUYAssertCheckout
(
checkout
);
BUYAssertCheckout
(
checkout
);
BUYAssert
(
giftCardCode
.
length
>
0
,
@"Failed to apply gift card code. Invalid gift card code."
);
BUYAssert
(
giftCardCode
.
length
>
0
,
@"Failed to apply gift card code. Invalid gift card code."
);
...
@@ -255,7 +255,7 @@
...
@@ -255,7 +255,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
removeGiftCard
:(
BUYGiftCard
*
)
giftCard
fromCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
removeGiftCard
:(
BUYGiftCard
*
)
giftCard
fromCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
{
{
BUYAssertCheckout
(
checkout
);
BUYAssertCheckout
(
checkout
);
BUYAssert
(
giftCard
.
identifier
,
@"Failed to remove gift card. Gift card must have a valid identifier."
);
BUYAssert
(
giftCard
.
identifier
,
@"Failed to remove gift card. Gift card must have a valid identifier."
);
...
@@ -282,7 +282,7 @@
...
@@ -282,7 +282,7 @@
#pragma mark - Reservations -
#pragma mark - Reservations -
-
(
BUYRequest
Operation
*
)
removeProductReservationsFromCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
removeProductReservationsFromCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
{
{
BUYAssertToken
(
checkoutToken
);
BUYAssertToken
(
checkoutToken
);
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.h
View file @
a2e76401
...
@@ -86,7 +86,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -86,7 +86,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
;
-
(
NS
Operation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
;
#pragma mark - Customer -
#pragma mark - Customer -
...
@@ -102,7 +102,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -102,7 +102,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @discussion The customer is automatically logged in using -loginCustomerWithCredentials:callback:
* @discussion The customer is automatically logged in using -loginCustomerWithCredentials:callback:
*/
*/
-
(
BUYRequest
Operation
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
;
-
(
NS
Operation
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
;
/**
/**
* PUT /api/customers/:customer_id/activate
* PUT /api/customers/:customer_id/activate
...
@@ -115,7 +115,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -115,7 +115,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
activateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
token
:(
NSString
*
)
token
callback
:(
BUYDataCustomerTokenBlock
)
block
;
-
(
NS
Operation
*
)
activateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
token
:(
NSString
*
)
token
callback
:(
BUYDataCustomerTokenBlock
)
block
;
/**
/**
* PUT /api/customers/:customer_id
* PUT /api/customers/:customer_id
...
@@ -127,7 +127,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -127,7 +127,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
updateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
;
-
(
NS
Operation
*
)
updateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
;
/**
/**
* PUT /api/customers/:customer_id/reset
* PUT /api/customers/:customer_id/reset
...
@@ -140,7 +140,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -140,7 +140,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
resetPasswordWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
token
:(
NSString
*
)
token
callback
:(
BUYDataCustomerTokenBlock
)
block
;
-
(
NS
Operation
*
)
resetPasswordWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
token
:(
NSString
*
)
token
callback
:(
BUYDataCustomerTokenBlock
)
block
;
#pragma mark - Token -
#pragma mark - Token -
...
@@ -153,7 +153,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -153,7 +153,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return the associated BUYRequestOperation
* @return the associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
;
-
(
NS
Operation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
;
#pragma mark - Login -
#pragma mark - Login -
...
@@ -167,7 +167,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -167,7 +167,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
loginCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
;
-
(
NS
Operation
*
)
loginCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
;
/**
/**
* DELETE /api/customers/:customer_id/customer_token
* DELETE /api/customers/:customer_id/customer_token
...
@@ -179,7 +179,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -179,7 +179,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
logoutCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
logoutCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
;
/**
/**
* POST /api/customers/recover
* POST /api/customers/recover
...
@@ -190,7 +190,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -190,7 +190,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return the associated BUYRequestOperation
* @return the associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
;
#pragma mark - Orders -
#pragma mark - Orders -
...
@@ -203,7 +203,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -203,7 +203,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getOrdersForCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrdersBlock
)
block
;
-
(
NS
Operation
*
)
getOrdersForCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrdersBlock
)
block
;
/**
/**
* GET /api/customers/:customer_id/orders/:id
* GET /api/customers/:customer_id/orders/:id
...
@@ -215,7 +215,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
...
@@ -215,7 +215,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getOrderWithID
:(
NSNumber
*
)
orderID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrderBlock
)
block
;
-
(
NS
Operation
*
)
getOrderWithID
:(
NSNumber
*
)
orderID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrderBlock
)
block
;
@end
@end
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
View file @
a2e76401
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
#pragma mark - Getting -
#pragma mark - Getting -
-
(
BUYRequest
Operation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
-
(
NS
Operation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersWithID
:
customerID
];
NSURL
*
url
=
[
self
urlForCustomersWithID
:
customerID
];
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
#pragma mark - Customer -
#pragma mark - Customer -
-
(
BUYRequest
Operation
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
NS
Operation
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomers
];
NSURL
*
url
=
[
self
urlForCustomers
];
return
[
self
postRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
postRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
activateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
token
:(
NSString
*
)
token
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
NS
Operation
*
)
activateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
token
:(
NSString
*
)
token
callback
:(
BUYDataCustomerTokenBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersActivationWithID
:
customerID
parameters
:@{
@"token"
:
token
}];
NSURL
*
url
=
[
self
urlForCustomersActivationWithID
:
customerID
parameters
:@{
@"token"
:
token
}];
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
updateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
-
(
NS
Operation
*
)
updateCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersWithID
:
customerID
];
NSURL
*
url
=
[
self
urlForCustomersWithID
:
customerID
];
return
[
self
putRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
putRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
resetPasswordWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
token
:(
NSString
*
)
token
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
NS
Operation
*
)
resetPasswordWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerID
:(
NSString
*
)
customerID
token
:(
NSString
*
)
token
callback
:(
BUYDataCustomerTokenBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersPasswordResetWithID
:
customerID
parameters
:@{
@"token"
:
token
}];
NSURL
*
url
=
[
self
urlForCustomersPasswordResetWithID
:
customerID
parameters
:@{
@"token"
:
token
}];
...
@@ -111,7 +111,7 @@
...
@@ -111,7 +111,7 @@
#pragma mark - Token -
#pragma mark - Token -
-
(
BUYRequest
Operation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
-
(
NS
Operation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
{
{
if
(
self
.
customerToken
)
{
if
(
self
.
customerToken
)
{
NSURL
*
url
=
[
self
urlForCustomersTokenRenewalWithID
:
customerID
];
NSURL
*
url
=
[
self
urlForCustomersTokenRenewalWithID
:
customerID
];
...
@@ -134,7 +134,7 @@
...
@@ -134,7 +134,7 @@
#pragma mark - Login -
#pragma mark - Login -
-
(
BUYRequest
Operation
*
)
logoutCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
logoutCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersTokenWithID
:
customerID
];
NSURL
*
url
=
[
self
urlForCustomersTokenWithID
:
customerID
];
return
[
self
deleteRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
deleteRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -142,12 +142,12 @@
...
@@ -142,12 +142,12 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
loginCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
NS
Operation
*
)
loginCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
{
{
return
[
self
createTokenForCustomerWithCredentials
:
credentials
customerJSON
:
nil
callback
:
block
];
return
[
self
createTokenForCustomerWithCredentials
:
credentials
customerJSON
:
nil
callback
:
block
];
}
}
-
(
BUYRequest
Operation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersPasswordRecovery
];
NSURL
*
url
=
[
self
urlForCustomersPasswordRecovery
];
return
[
self
postRequestForURL
:
url
object
:@{
@"email"
:
email
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
postRequestForURL
:
url
object
:@{
@"email"
:
email
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -157,7 +157,7 @@
...
@@ -157,7 +157,7 @@
#pragma mark - Orders -
#pragma mark - Orders -
-
(
BUYRequest
Operation
*
)
getOrdersForCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrdersBlock
)
block
-
(
NS
Operation
*
)
getOrdersForCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrdersBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersOrdersWithID
:
customerID
];
NSURL
*
url
=
[
self
urlForCustomersOrdersWithID
:
customerID
];
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -170,7 +170,7 @@
...
@@ -170,7 +170,7 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getOrderWithID
:(
NSNumber
*
)
orderID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrderBlock
)
block
-
(
NS
Operation
*
)
getOrderWithID
:(
NSNumber
*
)
orderID
customerID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrderBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersOrdersWithID
:
customerID
orderID
:
orderID
];
NSURL
*
url
=
[
self
urlForCustomersOrdersWithID
:
customerID
orderID
:
orderID
];
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
@@ -185,7 +185,7 @@
...
@@ -185,7 +185,7 @@
#pragma mark - Helpers -
#pragma mark - Helpers -
-
(
BUYRequest
Operation
*
)
createTokenForCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerJSON
:(
NSDictionary
*
)
customerJSON
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
NS
Operation
*
)
createTokenForCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
customerJSON
:(
NSDictionary
*
)
customerJSON
callback
:(
BUYDataCustomerTokenBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCustomersToken
];
NSURL
*
url
=
[
self
urlForCustomersToken
];
return
[
self
postRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
postRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Internal.h
View file @
a2e76401
...
@@ -36,23 +36,23 @@ typedef void (^BUYClientRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResp
...
@@ -36,23 +36,23 @@ typedef void (^BUYClientRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResp
@interface
BUYClient
(
Internal
)
@interface
BUYClient
(
Internal
)
-
(
BUYRequest
Operation
*
)
getRequestForURL
:(
NSURL
*
)
url
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
getRequestForURL
:(
NSURL
*
)
url
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
deleteRequestForURL
:(
NSURL
*
)
url
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
deleteRequestForURL
:(
NSURL
*
)
url
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
postRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
postRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
putRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
putRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
patchRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
patchRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
getRequestForURL
:(
NSURL
*
)
url
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
getRequestForURL
:(
NSURL
*
)
url
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
deleteRequestForURL
:(
NSURL
*
)
url
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
deleteRequestForURL
:(
NSURL
*
)
url
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
postRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
postRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
putRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
putRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
patchRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
patchRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYStatus
)
statusForStatusCode
:(
NSUInteger
)
statusCode
error
:(
NSError
*
)
error
;
-
(
BUYStatus
)
statusForStatusCode
:(
NSUInteger
)
statusCode
error
:(
NSError
*
)
error
;
-
(
void
)
startOperation
:(
BUY
Operation
*
)
operation
;
-
(
void
)
startOperation
:(
NS
Operation
*
)
operation
;
@end
@end
...
@@ -62,8 +62,8 @@ typedef void (^BUYClientRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResp
...
@@ -62,8 +62,8 @@ typedef void (^BUYClientRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResp
@interface
BUYClient
(
PrivateCheckout
)
@interface
BUYClient
(
PrivateCheckout
)
-
(
BUYRequest
Operation
*
)
beginCheckoutWithToken
:(
NSString
*
)
checkoutToken
paymentToken
:(
id
<
BUYPaymentToken
>
)
paymentToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
beginCheckoutWithToken
:(
NSString
*
)
checkoutToken
paymentToken
:(
id
<
BUYPaymentToken
>
)
paymentToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
token
start
:(
BOOL
)
start
completion
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
token
start
:(
BOOL
)
start
completion
:(
BUYDataStatusBlock
)
block
;
-
(
BUYRequest
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
;
@end
@end
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.h
View file @
a2e76401
...
@@ -128,7 +128,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
...
@@ -128,7 +128,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getShop
:(
BUYDataShopBlock
)
block
;
-
(
NS
Operation
*
)
getShop
:(
BUYDataShopBlock
)
block
;
/**
/**
* Fetches a single page of products for the shop.
* Fetches a single page of products for the shop.
...
@@ -138,7 +138,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
...
@@ -138,7 +138,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
completion
:(
BUYDataProductListBlock
)
block
;
-
(
NS
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
completion
:(
BUYDataProductListBlock
)
block
;
/**
/**
* Fetches a single product by the handle of the product.
* Fetches a single product by the handle of the product.
...
@@ -148,7 +148,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
...
@@ -148,7 +148,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getProductByHandle
:(
NSString
*
)
handle
completion
:(
BUYDataProductBlock
)
block
;
-
(
NS
Operation
*
)
getProductByHandle
:(
NSString
*
)
handle
completion
:(
BUYDataProductBlock
)
block
;
/**
/**
* Fetches a single product by the ID of the product.
* Fetches a single product by the ID of the product.
...
@@ -158,7 +158,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
...
@@ -158,7 +158,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getProductById
:(
NSString
*
)
productId
completion
:(
BUYDataProductBlock
)
block
;
-
(
NS
Operation
*
)
getProductById
:(
NSString
*
)
productId
completion
:(
BUYDataProductBlock
)
block
;
/**
/**
* Fetches a list of product by the ID of each product.
* Fetches a list of product by the ID of each product.
...
@@ -168,7 +168,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
...
@@ -168,7 +168,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getProductsByIds
:(
NSArray
<
NSString
*>
*
)
productIds
completion
:(
BUYDataProductsBlock
)
block
;
-
(
NS
Operation
*
)
getProductsByIds
:(
NSArray
<
NSString
*>
*
)
productIds
completion
:(
BUYDataProductsBlock
)
block
;
/**
/**
* Fetches collections based off page
* Fetches collections based off page
...
@@ -178,7 +178,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
...
@@ -178,7 +178,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
*
* @return The associated BUYRequestOperation
* @return The associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getCollectionsPage
:(
NSUInteger
)
page
completion
:(
BUYDataCollectionsListBlock
)
block
;
-
(
NS
Operation
*
)
getCollectionsPage
:(
NSUInteger
)
page
completion
:(
BUYDataCollectionsListBlock
)
block
;
/**
/**
* Fetches the products in the given collection with the collection's
* Fetches the products in the given collection with the collection's
...
@@ -190,7 +190,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
...
@@ -190,7 +190,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
*
* @return the associated BUYRequestOperation
* @return the associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
inCollection
:(
NSNumber
*
)
collectionId
completion
:(
BUYDataProductListBlock
)
block
;
-
(
NS
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
inCollection
:(
NSNumber
*
)
collectionId
completion
:(
BUYDataProductListBlock
)
block
;
/**
/**
* Fetches the products in the given collection with a given sort order
* Fetches the products in the given collection with a given sort order
...
@@ -202,7 +202,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
...
@@ -202,7 +202,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
*
* @return the associated BUYRequestOperation
* @return the associated BUYRequestOperation
*/
*/
-
(
BUYRequest
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
inCollection
:(
NSNumber
*
)
collectionId
sortOrder
:(
BUYCollectionSort
)
sortOrder
completion
:(
BUYDataProductListBlock
)
block
;
-
(
NS
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
inCollection
:(
NSNumber
*
)
collectionId
sortOrder
:(
BUYCollectionSort
)
sortOrder
completion
:(
BUYDataProductListBlock
)
block
;
@end
@end
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.m
View file @
a2e76401
...
@@ -47,7 +47,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
...
@@ -47,7 +47,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
#pragma mark - API -
#pragma mark - API -
-
(
BUYRequest
Operation
*
)
getShop
:(
BUYDataShopBlock
)
block
-
(
NS
Operation
*
)
getShop
:(
BUYDataShopBlock
)
block
{
{
return
[
self
getRequestForURL
:[
self
urlForShop
]
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
return
[
self
getRequestForURL
:[
self
urlForShop
]
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
BUYShop
*
shop
=
nil
;
BUYShop
*
shop
=
nil
;
...
@@ -58,7 +58,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
...
@@ -58,7 +58,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
completion
:(
BUYDataProductListBlock
)
block
-
(
NS
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
completion
:(
BUYDataProductListBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForProductListingsWithParameters
:@{
NSURL
*
url
=
[
self
urlForProductListingsWithParameters
:@{
@"limit"
:
@
(
self
.
pageSize
),
@"limit"
:
@
(
self
.
pageSize
),
...
@@ -75,7 +75,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
...
@@ -75,7 +75,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getProductByHandle
:(
NSString
*
)
handle
completion
:(
BUYDataProductBlock
)
block
-
(
NS
Operation
*
)
getProductByHandle
:(
NSString
*
)
handle
completion
:(
BUYDataProductBlock
)
block
{
{
BUYAssert
(
handle
,
@"Failed to get product by handle. Product handle must not be nil."
);
BUYAssert
(
handle
,
@"Failed to get product by handle. Product handle must not be nil."
);
...
@@ -94,7 +94,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
...
@@ -94,7 +94,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getProductById
:(
NSString
*
)
productId
completion
:(
BUYDataProductBlock
)
block
-
(
NS
Operation
*
)
getProductById
:(
NSString
*
)
productId
completion
:(
BUYDataProductBlock
)
block
{
{
BUYAssert
(
productId
,
@"Failed to get product by ID. Product ID must not be nil."
);
BUYAssert
(
productId
,
@"Failed to get product by ID. Product ID must not be nil."
);
...
@@ -103,7 +103,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
...
@@ -103,7 +103,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getProductsByIds
:(
NSArray
*
)
productIds
completion
:(
BUYDataProductsBlock
)
block
-
(
NS
Operation
*
)
getProductsByIds
:(
NSArray
*
)
productIds
completion
:(
BUYDataProductsBlock
)
block
{
{
BUYAssert
(
productIds
,
@"Failed to get product by IDs. Product IDs array must not be nil."
);
BUYAssert
(
productIds
,
@"Failed to get product by IDs. Product IDs array must not be nil."
);
...
@@ -124,7 +124,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
...
@@ -124,7 +124,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getCollectionsPage
:(
NSUInteger
)
page
completion
:(
BUYDataCollectionsListBlock
)
block
-
(
NS
Operation
*
)
getCollectionsPage
:(
NSUInteger
)
page
completion
:(
BUYDataCollectionsListBlock
)
block
{
{
NSURL
*
url
=
[
self
urlForCollectionListingsWithParameters
:@{
NSURL
*
url
=
[
self
urlForCollectionListingsWithParameters
:@{
@"limit"
:
@
(
self
.
pageSize
),
@"limit"
:
@
(
self
.
pageSize
),
...
@@ -141,12 +141,12 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
...
@@ -141,12 +141,12 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
inCollection
:(
NSNumber
*
)
collectionId
completion
:(
BUYDataProductListBlock
)
block
-
(
NS
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
inCollection
:(
NSNumber
*
)
collectionId
completion
:(
BUYDataProductListBlock
)
block
{
{
return
[
self
getProductsPage
:
page
inCollection
:
collectionId
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:
block
];
return
[
self
getProductsPage
:
page
inCollection
:
collectionId
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:
block
];
}
}
-
(
BUYRequest
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
inCollection
:(
NSNumber
*
)
collectionId
sortOrder
:(
BUYCollectionSort
)
sortOrder
completion
:(
BUYDataProductListBlock
)
block
-
(
NS
Operation
*
)
getProductsPage
:(
NSUInteger
)
page
inCollection
:(
NSNumber
*
)
collectionId
sortOrder
:(
BUYCollectionSort
)
sortOrder
completion
:(
BUYDataProductListBlock
)
block
{
{
BUYAssert
(
collectionId
,
@"Failed to get products page. Invalid collectionID."
);
BUYAssert
(
collectionId
,
@"Failed to get products page. Invalid collectionID."
);
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
a2e76401
...
@@ -125,61 +125,61 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
...
@@ -125,61 +125,61 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
#pragma mark - Auto Starting Convenience Requests
#pragma mark - Auto Starting Convenience Requests
-
(
BUYRequest
Operation
*
)
getRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
getRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
getRequestForURL
:
url
start
:
YES
completionHandler
:
completionHandler
];
return
[
self
getRequestForURL
:
url
start
:
YES
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
postRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
postRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
postRequestForURL
:
url
object
:
object
start
:
YES
completionHandler
:
completionHandler
];
return
[
self
postRequestForURL
:
url
object
:
object
start
:
YES
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
putRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
putRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
putRequestForURL
:
url
object
:
object
start
:
YES
completionHandler
:
completionHandler
];
return
[
self
putRequestForURL
:
url
object
:
object
start
:
YES
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
patchRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
patchRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
patchRequestForURL
:
url
object
:
object
start
:
YES
completionHandler
:
completionHandler
];
return
[
self
patchRequestForURL
:
url
object
:
object
start
:
YES
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
deleteRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
deleteRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
deleteRequestForURL
:
url
start
:
YES
completionHandler
:
completionHandler
];
return
[
self
deleteRequestForURL
:
url
start
:
YES
completionHandler
:
completionHandler
];
}
}
#pragma mark - Convenience Requests
#pragma mark - Convenience Requests
-
(
BUYRequest
Operation
*
)
getRequestForURL
:
(
NSURL
*
)
url
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
getRequestForURL
:
(
NSURL
*
)
url
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
requestForURL
:
url
method
:
@"GET"
object
:
nil
start
:
start
completionHandler
:
completionHandler
];
return
[
self
requestForURL
:
url
method
:
@"GET"
object
:
nil
start
:
start
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
postRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
postRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
requestForURL
:
url
method
:
@"POST"
object
:
object
start
:
start
completionHandler
:
completionHandler
];
return
[
self
requestForURL
:
url
method
:
@"POST"
object
:
object
start
:
start
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
putRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
putRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
requestForURL
:
url
method
:
@"PUT"
object
:
object
start
:
start
completionHandler
:
completionHandler
];
return
[
self
requestForURL
:
url
method
:
@"PUT"
object
:
object
start
:
start
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
patchRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
patchRequestForURL
:
(
NSURL
*
)
url
object
:
(
id
<
BUYSerializable
>
)
object
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
requestForURL
:
url
method
:
@"PATCH"
object
:
object
start
:
start
completionHandler
:
completionHandler
];
return
[
self
requestForURL
:
url
method
:
@"PATCH"
object
:
object
start
:
start
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
deleteRequestForURL
:
(
NSURL
*
)
url
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
deleteRequestForURL
:
(
NSURL
*
)
url
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
requestForURL
:
url
method
:
@"DELETE"
object
:
nil
start
:
start
completionHandler
:
completionHandler
];
return
[
self
requestForURL
:
url
method
:
@"DELETE"
object
:
nil
start
:
start
completionHandler
:
completionHandler
];
}
}
#pragma mark - Generic Requests
#pragma mark - Generic Requests
-
(
void
)
startOperation
:
(
BUY
Operation
*
)
operation
-
(
void
)
startOperation
:
(
NS
Operation
*
)
operation
{
{
[
self
.
requestQueue
addOperation
:
operation
];
[
self
.
requestQueue
addOperation
:
operation
];
}
}
...
@@ -190,12 +190,12 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
...
@@ -190,12 +190,12 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
return
[
NSString
stringWithFormat
:
@"%@ %@"
,
@"Basic"
,
[
data
base64EncodedStringWithOptions
:
0
]];
return
[
NSString
stringWithFormat
:
@"%@ %@"
,
@"Basic"
,
[
data
base64EncodedStringWithOptions
:
0
]];
}
}
-
(
BUYRequest
Operation
*
)
requestForURL
:
(
NSURL
*
)
url
method
:
(
NSString
*
)
method
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
requestForURL
:
(
NSURL
*
)
url
method
:
(
NSString
*
)
method
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
return
[
self
requestForURL
:
url
method
:
method
object
:
object
start
:
YES
completionHandler
:
completionHandler
];
return
[
self
requestForURL
:
url
method
:
method
object
:
object
start
:
YES
completionHandler
:
completionHandler
];
}
}
-
(
BUYRequest
Operation
*
)
requestForURL
:
(
NSURL
*
)
url
method
:
(
NSString
*
)
method
object
:
(
id
<
BUYSerializable
>
)
object
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
requestForURL
:
(
NSURL
*
)
url
method
:
(
NSString
*
)
method
object
:
(
id
<
BUYSerializable
>
)
object
start
:
(
BOOL
)
start
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
{
NSMutableURLRequest
*
request
=
[[
NSMutableURLRequest
alloc
]
initWithURL
:
url
];
NSMutableURLRequest
*
request
=
[[
NSMutableURLRequest
alloc
]
initWithURL
:
url
];
if
(
object
)
{
if
(
object
)
{
...
...
Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m
View file @
a2e76401
...
@@ -95,9 +95,9 @@
...
@@ -95,9 +95,9 @@
[
super
startExecution
];
[
super
startExecution
];
BUYRequest
Operation
*
beginOperation
=
[
self
createBeginOperation
];
NS
Operation
*
beginOperation
=
[
self
createBeginOperation
];
BUYRequest
Operation
*
pollOperation
=
[
self
createPollOperation
];
NS
Operation
*
pollOperation
=
[
self
createPollOperation
];
BUYRequest
Operation
*
getOperation
=
[
self
createGetOperation
];
NS
Operation
*
getOperation
=
[
self
createGetOperation
];
[
pollOperation
addDependency
:
beginOperation
];
[
pollOperation
addDependency
:
beginOperation
];
[
getOperation
addDependency
:
pollOperation
];
[
getOperation
addDependency
:
pollOperation
];
...
@@ -135,7 +135,7 @@
...
@@ -135,7 +135,7 @@
#pragma mark - Operations -
#pragma mark - Operations -
-
(
BUYRequest
Operation
*
)
createBeginOperation
-
(
NS
Operation
*
)
createBeginOperation
{
{
return
[
self
.
client
beginCheckoutWithToken
:
self
.
checkoutToken
paymentToken
:
self
.
token
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
return
[
self
.
client
beginCheckoutWithToken
:
self
.
checkoutToken
paymentToken
:
self
.
token
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
!
checkout
)
{
if
(
!
checkout
)
{
...
@@ -144,9 +144,9 @@
...
@@ -144,9 +144,9 @@
}];
}];
}
}
-
(
BUYRequest
Operation
*
)
createPollOperation
-
(
NS
Operation
*
)
createPollOperation
{
{
BUYRequestOperation
*
operation
=
[
self
.
client
getCompletionStatusOfCheckoutWithToken
:
self
.
checkoutToken
start
:
NO
completion
:^
(
BUYStatus
status
,
NSError
*
error
)
{
BUYRequestOperation
*
operation
=
(
BUYRequestOperation
*
)
[
self
.
client
getCompletionStatusOfCheckoutWithToken
:
self
.
checkoutToken
start
:
NO
completion
:^
(
BUYStatus
status
,
NSError
*
error
)
{
if
(
status
!=
BUYStatusComplete
)
{
if
(
status
!=
BUYStatusComplete
)
{
[
self
finishWithError
:
error
];
[
self
finishWithError
:
error
];
}
}
...
@@ -158,7 +158,7 @@
...
@@ -158,7 +158,7 @@
return
operation
;
return
operation
;
}
}
-
(
BUYRequest
Operation
*
)
createGetOperation
-
(
NS
Operation
*
)
createGetOperation
{
{
return
[
self
.
client
getCheckoutWithToken
:
self
.
checkoutToken
start
:
NO
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
return
[
self
.
client
getCheckoutWithToken
:
self
.
checkoutToken
start
:
NO
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
checkout
)
{
if
(
checkout
)
{
...
...
Mobile Buy SDK/Mobile Buy SDK/Static Framework/Buy.h
View file @
a2e76401
...
@@ -64,7 +64,6 @@
...
@@ -64,7 +64,6 @@
#import "BUYClient+Checkout.h"
#import "BUYClient+Checkout.h"
#import "BUYClient+Storefront.h"
#import "BUYClient+Storefront.h"
#import "BUYRequestOperation.h"
#import "BUYError.h"
#import "BUYError.h"
#import "BUYError+BUYAdditions.h"
#import "BUYError+BUYAdditions.h"
#import "BUYManagedObject.h"
#import "BUYManagedObject.h"
...
@@ -88,4 +87,3 @@
...
@@ -88,4 +87,3 @@
#import "NSRegularExpression+BUYAdditions.h"
#import "NSRegularExpression+BUYAdditions.h"
#import "NSString+BUYAdditions.h"
#import "NSString+BUYAdditions.h"
#import "NSURL+BUYAdditions.h"
#import "NSURL+BUYAdditions.h"
#import "NSURLComponents+BUYAdditions.h"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment