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
a80871f6
Commit
a80871f6
authored
Jun 02, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose only NSOperation in public interface, hide private operations.
parent
68c3b520
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
117 additions
and
119 deletions
+117
-119
BUYClientTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
+0
-0
project.pbxproj
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
+5
-5
Buy.h
Mobile Buy SDK/Mobile Buy SDK/Buy.h
+0
-1
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
-1
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
View file @
a80871f6
This diff is collapsed.
Click to expand it.
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
View file @
a80871f6
...
...
@@ -335,8 +335,8 @@
90F5930B1B0D5F4C0026B382
/* BUYObjectTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90F592FF1B0D5F4C0026B382
/* BUYObjectTests.m */
;
};
9A0B0C5D1CE662EC0037D68F
/* 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
,
);
};
};
9A0B0C601CE662EF0037D68F
/* 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 */
;
};
9A0B0C631CE9F8530037D68F
/* BUYRequestOperationTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0B0C621CE9F8530037D68F
/* BUYRequestOperationTests.m */
;
};
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 */
;
};
...
...
@@ -376,8 +376,8 @@
9A47CF201CE50EBB00A6D5BA
/* BUYApplePayTestToken.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF1F1CE50EBB00A6D5BA
/* BUYApplePayTestToken.m */
;
};
9A47CF221CE5112A00A6D5BA
/* BUYAssert.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF211CE5112A00A6D5BA
/* BUYAssert.h */
;
};
9A47CF231CE5112A00A6D5BA
/* BUYAssert.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A47CF211CE5112A00A6D5BA
/* BUYAssert.h */
;
};
9A585C0A1CE6440B001F20F0
/* BUYOperation.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A585C041CE6440B001F20F0
/* BUYOperation.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A585C0B1CE6440B001F20F0
/* 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 */
;
};
9A585C0C1CE6440B001F20F0
/* 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 */
;
};
...
...
@@ -1175,8 +1175,8 @@
F773749F19C77E4E0039681C
/* Classes */
=
{
isa
=
PBXGroup
;
children
=
(
9A585C011CE6440B001F20F0
/* Operations */
,
90DA8DF11BC6A82D0027BCB7
/* Buy.h */
,
9A585C011CE6440B001F20F0
/* Operations */
,
841ADDEA1CB6C942000004B0
/* Additions */
,
F7FDA16F19C93F6100AF4E93
/* Data */
,
F773744419C779C20039681C
/* Models */
,
...
...
Mobile Buy SDK/Mobile Buy SDK/Buy.h
View file @
a80871f6
...
...
@@ -67,7 +67,6 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
#import <Buy/BUYClient+Customers.h>
#import <Buy/BUYClient+Checkout.h>
#import <Buy/BUYClient+Storefront.h>
#import <Buy/BUYRequestOperation.h>
#import <Buy/BUYError.h>
#import <Buy/BUYError+BUYAdditions.h>
#import <Buy/BUYManagedObject.h>
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.h
View file @
a80871f6
...
...
@@ -56,7 +56,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
* @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
...
...
@@ -68,7 +68,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
* @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
...
...
@@ -80,7 +80,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
* @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
...
...
@@ -92,7 +92,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
* @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
...
...
@@ -104,7 +104,7 @@ typedef void (^BUYDataAddressBlock)(BUYAddress * _Nullable address, NSError * _N
*
* @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
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Address.m
View file @
a80871f6
...
...
@@ -33,7 +33,7 @@
@implementation
BUYClient
(
Address
)
-
(
BUYRequest
Operation
*
)
getAddressesForCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressesBlock
)
block
-
(
NS
Operation
*
)
getAddressesForCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataAddressesBlock
)
block
{
NSURL
*
route
=
[
self
urlForCustomersAddressesWithID
:
customerID
];
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -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
];
return
[
self
getRequestForURL
:
route
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -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
];
return
[
self
postRequestForURL
:
route
object
:@{
@"address"
:
address
.
JSONDictionary
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -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."
);
...
...
@@ -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."
);
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.h
View file @
a80871f6
...
...
@@ -80,7 +80,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @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
...
...
@@ -90,7 +90,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @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.
...
...
@@ -101,7 +101,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @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.
...
...
@@ -116,7 +116,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @return The associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
/**
* Retrieves an updated BUYCheckout.
...
...
@@ -126,7 +126,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @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).
...
...
@@ -153,7 +153,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @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`
...
...
@@ -163,7 +163,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @return The associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutURL
:(
NSURL
*
)
url
completion
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutURL
:(
NSURL
*
)
url
completion
:(
BUYDataStatusBlock
)
block
;
#pragma mark - Shipping Rates -
...
...
@@ -176,7 +176,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @return The associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
getShippingRatesForCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataShippingRatesBlock
)
block
;
-
(
NS
Operation
*
)
getShippingRatesForCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataShippingRatesBlock
)
block
;
#pragma mark - Cards -
...
...
@@ -196,7 +196,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @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.
...
...
@@ -207,7 +207,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @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.
...
...
@@ -218,7 +218,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @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 -
...
...
@@ -232,7 +232,7 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
*
* @return The associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
removeProductReservationsFromCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
removeProductReservationsFromCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
;
@end
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.m
View file @
a80871f6
...
...
@@ -47,7 +47,7 @@
#pragma mark - Checkout -
-
(
BUYRequest
Operation
*
)
updateOrCreateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
completion
-
(
NS
Operation
*
)
updateOrCreateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
completion
{
if
([
checkout
hasToken
])
{
return
[
self
updateCheckout
:
checkout
completion
:
completion
];
...
...
@@ -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."
);
...
...
@@ -67,7 +67,7 @@
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"
);
BUYCheckout
*
checkout
=
[
self
.
modelManager
checkoutwithCartToken
:
cartToken
];
...
...
@@ -77,7 +77,7 @@
return
[
self
postCheckout
:
json
completion
:
block
];
}
-
(
BUYRequest
Operation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
{
BUYAssertCheckout
(
checkout
);
...
...
@@ -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
];
}
-
(
BUYRequest
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
{
BUYAssertToken
(
checkoutToken
);
...
...
@@ -109,13 +109,13 @@
return
operation
;
}
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataStatusBlock
)
block
{
BUYAssertToken
(
checkoutToken
);
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
];
...
...
@@ -134,7 +134,7 @@
#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
);
...
...
@@ -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
];
return
[
self
getRequestForURL
:
url
start
:
start
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -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
)
{
[
self
handleCheckoutResponse
:
json
error
:
error
block
:
block
];
...
...
@@ -180,7 +180,7 @@
#pragma mark - Shipping Rates -
-
(
BUYRequest
Operation
*
)
getShippingRatesForCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataShippingRatesBlock
)
block
-
(
NS
Operation
*
)
getShippingRatesForCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataShippingRatesBlock
)
block
{
BUYAssertToken
(
checkoutToken
);
...
...
@@ -188,7 +188,7 @@
@"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
;
if
(
json
&&
!
error
)
{
shippingRates
=
[
self
.
modelManager
insertShippingRatesWithJSONArray
:
json
[
@"shipping_rates"
]];
...
...
@@ -207,7 +207,7 @@
#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
);
BUYAssert
(
creditCard
,
@"Failed to store credit card. No credit card provided."
);
...
...
@@ -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
);
BUYAssert
(
giftCardCode
.
length
>
0
,
@"Failed to apply gift card code. Invalid gift card code."
);
...
...
@@ -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
);
BUYAssert
(
giftCard
.
identifier
,
@"Failed to remove gift card. Gift card must have a valid identifier."
);
...
...
@@ -282,7 +282,7 @@
#pragma mark - Reservations -
-
(
BUYRequest
Operation
*
)
removeProductReservationsFromCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
-
(
NS
Operation
*
)
removeProductReservationsFromCheckoutWithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
{
BUYAssertToken
(
checkoutToken
);
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.h
View file @
a80871f6
...
...
@@ -86,7 +86,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @return The associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
;
-
(
NS
Operation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
;
#pragma mark - Customer -
...
...
@@ -102,7 +102,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @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
...
...
@@ -115,7 +115,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @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
...
...
@@ -127,7 +127,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @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
...
...
@@ -140,7 +140,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @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 -
...
...
@@ -153,7 +153,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @return the associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
;
-
(
NS
Operation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
;
#pragma mark - Login -
...
...
@@ -167,7 +167,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @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
...
...
@@ -179,7 +179,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @return The associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
logoutCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
logoutCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
;
/**
* POST /api/customers/recover
...
...
@@ -190,7 +190,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @return the associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
;
#pragma mark - Orders -
...
...
@@ -203,7 +203,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @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
...
...
@@ -215,7 +215,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
*
* @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
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
View file @
a80871f6
...
...
@@ -38,7 +38,7 @@
#pragma mark - Getting -
-
(
BUYRequest
Operation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
-
(
NS
Operation
*
)
getCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataCustomerBlock
)
block
{
NSURL
*
url
=
[
self
urlForCustomersWithID
:
customerID
];
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -52,7 +52,7 @@
#pragma mark - Customer -
-
(
BUYRequest
Operation
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
-
(
NS
Operation
*
)
createCustomerWithCredentials
:(
BUYAccountCredentials
*
)
credentials
callback
:(
BUYDataCustomerTokenBlock
)
block
{
NSURL
*
url
=
[
self
urlForCustomers
];
return
[
self
postRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -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
}];
...
...
@@ -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
];
return
[
self
putRequestForURL
:
url
object
:
credentials
.
JSONRepresentation
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -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
}];
...
...
@@ -111,7 +111,7 @@
#pragma mark - Token -
-
(
BUYRequest
Operation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
-
(
NS
Operation
*
)
renewCustomerTokenWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataTokenBlock
)
block
{
if
(
self
.
customerToken
)
{
NSURL
*
url
=
[
self
urlForCustomersTokenRenewalWithID
:
customerID
];
...
...
@@ -134,7 +134,7 @@
#pragma mark - Login -
-
(
BUYRequest
Operation
*
)
logoutCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
logoutCustomerID
:(
NSString
*
)
customerID
callback
:(
BUYDataStatusBlock
)
block
{
NSURL
*
url
=
[
self
urlForCustomersTokenWithID
:
customerID
];
return
[
self
deleteRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -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
];
}
-
(
BUYRequest
Operation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
-
(
NS
Operation
*
)
recoverPasswordForCustomer
:(
NSString
*
)
email
callback
:(
BUYDataStatusBlock
)
block
{
NSURL
*
url
=
[
self
urlForCustomersPasswordRecovery
];
return
[
self
postRequestForURL
:
url
object
:@{
@"email"
:
email
}
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -157,7 +157,7 @@
#pragma mark - Orders -
-
(
BUYRequest
Operation
*
)
getOrdersForCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrdersBlock
)
block
-
(
NS
Operation
*
)
getOrdersForCustomerWithID
:(
NSString
*
)
customerID
callback
:(
BUYDataOrdersBlock
)
block
{
NSURL
*
url
=
[
self
urlForCustomersOrdersWithID
:
customerID
];
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -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
];
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
...
...
@@ -185,7 +185,7 @@
#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
];
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 @
a80871f6
...
...
@@ -36,23 +36,23 @@ typedef void (^BUYClientRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResp
@interface
BUYClient
(
Internal
)
-
(
BUYRequest
Operation
*
)
getRequestForURL
:(
NSURL
*
)
url
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYRequest
Operation
*
)
deleteRequestForURL
:(
NSURL
*
)
url
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
getRequestForURL
:(
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
;
-
(
BUYRequest
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
*
)
postRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
putRequestForURL
:(
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
;
-
(
BUYRequest
Operation
*
)
deleteRequestForURL
:(
NSURL
*
)
url
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
NS
Operation
*
)
getRequestForURL
:(
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
;
-
(
BUYRequest
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
*
)
postRequestForURL
:(
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
;
-
(
NS
Operation
*
)
patchRequestForURL
:(
NSURL
*
)
url
object
:(
id
<
BUYSerializable
>
)
object
start
:(
BOOL
)
start
completionHandler
:(
BUYClientRequestJSONCompletion
)
completionHandler
;
-
(
BUYStatus
)
statusForStatusCode
:(
NSUInteger
)
statusCode
error
:(
NSError
*
)
error
;
-
(
void
)
startOperation
:(
BUY
Operation
*
)
operation
;
-
(
void
)
startOperation
:(
NS
Operation
*
)
operation
;
@end
...
...
@@ -62,8 +62,8 @@ typedef void (^BUYClientRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResp
@interface
BUYClient
(
PrivateCheckout
)
-
(
BUYRequest
Operation
*
)
beginCheckoutWithToken
:(
NSString
*
)
checkoutToken
paymentToken
:(
id
<
BUYPaymentToken
>
)
paymentToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
BUYRequest
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
token
start
:(
BOOL
)
start
completion
:(
BUYDataStatusBlock
)
block
;
-
(
BUYRequest
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
beginCheckoutWithToken
:(
NSString
*
)
checkoutToken
paymentToken
:(
id
<
BUYPaymentToken
>
)
paymentToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
NS
Operation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
token
start
:(
BOOL
)
start
completion
:(
BUYDataStatusBlock
)
block
;
-
(
NS
Operation
*
)
getCheckoutWithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
;
@end
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.h
View file @
a80871f6
...
...
@@ -128,7 +128,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
* @return The associated BUYRequestOperation
*/
-
(
BUYRequest
Operation
*
)
getShop
:(
BUYDataShopBlock
)
block
;
-
(
NS
Operation
*
)
getShop
:(
BUYDataShopBlock
)
block
;
/**
* Fetches a single page of products for the shop.
...
...
@@ -138,7 +138,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
* @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.
...
...
@@ -148,7 +148,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
* @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.
...
...
@@ -158,7 +158,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
* @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.
...
...
@@ -168,7 +168,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
* @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
...
...
@@ -178,7 +178,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
* @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
...
...
@@ -190,7 +190,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
* @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
...
...
@@ -202,7 +202,7 @@ typedef void (^BUYDataProductListBlock)(NSArray<BUYProduct *> * _Nullable produc
*
* @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
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.m
View file @
a80871f6
...
...
@@ -47,7 +47,7 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
#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
)
{
BUYShop
*
shop
=
nil
;
...
...
@@ -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
:@{
@"limit"
:
@
(
self
.
pageSize
),
...
...
@@ -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."
);
...
...
@@ -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."
);
...
...
@@ -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."
);
...
...
@@ -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
:@{
@"limit"
:
@
(
self
.
pageSize
),
...
...
@@ -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
];
}
-
(
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."
);
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
a80871f6
...
...
@@ -125,61 +125,61 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
#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
];
}
-
(
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
];
}
-
(
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
];
}
-
(
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
];
}
-
(
BUYRequest
Operation
*
)
deleteRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
-
(
NS
Operation
*
)
deleteRequestForURL
:
(
NSURL
*
)
url
completionHandler
:
(
BUYClientRequestJSONCompletion
)
completionHandler
{
return
[
self
deleteRequestForURL
:
url
start
:
YES
completionHandler
:
completionHandler
];
}
#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
];
}
-
(
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
];
}
-
(
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
];
}
-
(
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
];
}
-
(
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
];
}
#pragma mark - Generic Requests
-
(
void
)
startOperation
:
(
BUY
Operation
*
)
operation
-
(
void
)
startOperation
:
(
NS
Operation
*
)
operation
{
[
self
.
requestQueue
addOperation
:
operation
];
}
...
...
@@ -190,12 +190,12 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
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
];
}
-
(
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
];
if
(
object
)
{
...
...
Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m
View file @
a80871f6
...
...
@@ -95,9 +95,9 @@
[
super
startExecution
];
BUYRequest
Operation
*
beginOperation
=
[
self
createBeginOperation
];
BUYRequest
Operation
*
pollOperation
=
[
self
createPollOperation
];
BUYRequest
Operation
*
getOperation
=
[
self
createGetOperation
];
NS
Operation
*
beginOperation
=
[
self
createBeginOperation
];
NS
Operation
*
pollOperation
=
[
self
createPollOperation
];
NS
Operation
*
getOperation
=
[
self
createGetOperation
];
[
pollOperation
addDependency
:
beginOperation
];
[
getOperation
addDependency
:
pollOperation
];
...
...
@@ -135,7 +135,7 @@
#pragma mark - Operations -
-
(
BUYRequest
Operation
*
)
createBeginOperation
-
(
NS
Operation
*
)
createBeginOperation
{
return
[
self
.
client
beginCheckoutWithToken
:
self
.
checkoutToken
paymentToken
:
self
.
token
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
!
checkout
)
{
...
...
@@ -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
)
{
[
self
finishWithError
:
error
];
}
...
...
@@ -158,7 +158,7 @@
return
operation
;
}
-
(
BUYRequest
Operation
*
)
createGetOperation
-
(
NS
Operation
*
)
createGetOperation
{
return
[
self
.
client
getCheckoutWithToken
:
self
.
checkoutToken
start
:
NO
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
checkout
)
{
...
...
Mobile Buy SDK/Mobile Buy SDK/Static Framework/Buy.h
View file @
a80871f6
...
...
@@ -64,7 +64,6 @@
#import "BUYClient+Checkout.h"
#import "BUYClient+Storefront.h"
#import "BUYRequestOperation.h"
#import "BUYError.h"
#import "BUYError+BUYAdditions.h"
#import "BUYManagedObject.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