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
ee1b2354
Commit
ee1b2354
authored
May 31, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert getCheckout to use token.
parent
3fe05c4f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
15 deletions
+11
-15
BUYIntegrationTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
+1
-5
BUYClient+Checkout.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.h
+3
-3
BUYClient+Checkout.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.m
+5
-5
BUYClient+Internal.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Internal.h
+1
-1
BUYCheckoutOperation.m
... Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m
+1
-1
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
View file @
ee1b2354
...
...
@@ -933,11 +933,7 @@
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testGetCheckoutWithInvalidToken_0"
useMocks
:[
self
shouldUseMocks
]];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
BUYCheckout
*
badCheckout
=
[[
BUYCheckout
alloc
]
initWithCartToken
:
@""
];
badCheckout
.
token
=
@"zzzzzzzzzzz"
;
[
self
.
client
getCheckout
:
badCheckout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
[
self
.
client
getCheckoutWithToken
:
@"zzzzzzzzzzz"
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
XCTAssertEqual
(
404
,
error
.
code
);
[
expectation
fulfill
];
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.h
View file @
ee1b2354
...
...
@@ -109,17 +109,17 @@ typedef void (^BUYDataGiftCardBlock)(BUYGiftCard * _Nullable giftCard, NSError *
-
(
BUYRequestOperation
*
)
updateCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
/**
* Retrieves an updated
version of a BUYCheckout from Shopify
.
* Retrieves an updated
BUYCheckout
.
*
* Note: There's no guarantee that the BUYCheckout returned will be the same as the one that is passed in.
* We recommended using the BUYCheckout returned in the block.
*
* @param checkout
The BUYCheckout to retrieve (updated) from Shopify
* @param checkout
Token The checkout token for which to retrieve the updated checkout
* @param block (^BUYDataCheckoutBlock)(BUYCheckout *checkout, NSError *error);
*
* @return The associated BUYRequestOperation
*/
-
(
BUYRequestOperation
*
)
getCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
BUYRequestOperation
*
)
getCheckout
WithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
;
/**
* Finalizes the BUYCheckout and charges the payment provider (ex: Credit Card, Apple Pay, etc).
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Checkout.m
View file @
ee1b2354
...
...
@@ -77,16 +77,16 @@
}];
}
-
(
BUYRequestOperation
*
)
getCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
block
-
(
BUYRequestOperation
*
)
getCheckout
WithToken
:(
NSString
*
)
checkoutToken
completion
:(
BUYDataCheckoutBlock
)
block
{
return
[
self
getCheckout
:
checkout
start
:
YES
completion
:
block
];
return
[
self
getCheckout
WithToken
:
checkoutToken
start
:
YES
completion
:
block
];
}
-
(
BUYRequestOperation
*
)
getCheckout
:(
BUYCheckout
*
)
checkout
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
-
(
BUYRequestOperation
*
)
getCheckout
WithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
{
BUYAssert
Checkout
(
checkout
);
BUYAssert
Token
(
checkoutToken
);
NSURL
*
url
=
[
self
urlForCheckoutsWithToken
:
checkout
.
t
oken
];
NSURL
*
url
=
[
self
urlForCheckoutsWithToken
:
checkout
T
oken
];
return
[
self
getRequestForURL
:
url
start
:
start
completionHandler
:^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
[
self
handleCheckoutResponse
:
json
error
:
error
block
:
block
];
}];
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Internal.h
View file @
ee1b2354
...
...
@@ -64,6 +64,6 @@ typedef void (^BUYClientRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResp
-
(
BUYRequestOperation
*
)
beginCheckout
:(
BUYCheckout
*
)
checkout
paymentToken
:(
id
<
BUYPaymentToken
>
)
paymentToken
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
BUYRequestOperation
*
)
getCompletionStatusOfCheckoutWithToken
:(
NSString
*
)
token
start
:(
BOOL
)
start
completion
:(
BUYDataStatusBlock
)
block
;
-
(
BUYRequestOperation
*
)
getCheckout
:(
BUYCheckout
*
)
checkout
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
;
-
(
BUYRequestOperation
*
)
getCheckout
WithToken
:(
NSString
*
)
checkoutToken
start
:(
BOOL
)
start
completion
:(
BUYDataCheckoutBlock
)
block
;
@end
Mobile Buy SDK/Mobile Buy SDK/Operations/BUYCheckoutOperation.m
View file @
ee1b2354
...
...
@@ -161,7 +161,7 @@
-
(
BUYRequestOperation
*
)
createGetOperation
{
return
[
self
.
client
getCheckout
:
self
.
checkout
start
:
NO
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
return
[
self
.
client
getCheckout
WithToken
:
self
.
checkout
.
token
start
:
NO
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
checkout
)
{
[
self
finishWithCheckout
:
checkout
];
}
else
{
...
...
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