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
f1720a63
Commit
f1720a63
authored
May 12, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor shipping rates to assert instead of return error.
parent
1fec5963
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
BUYClient.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
+11
-17
No files found.
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
f1720a63
...
@@ -498,23 +498,17 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
...
@@ -498,23 +498,17 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
getShippingRatesForCheckout
:
(
BUYCheckout
*
)
checkout
completion
:
(
BUYDataShippingRatesBlock
)
block
-
(
NSURLSessionDataTask
*
)
getShippingRatesForCheckout
:
(
BUYCheckout
*
)
checkout
completion
:
(
BUYDataShippingRatesBlock
)
block
{
{
NSURLSessionDataTask
*
task
=
nil
;
NSAssert
([
checkout
hasToken
],
@"Failed to get completion status of checkout. Checkout must have a valid token associated with it."
);
if
([
checkout
hasToken
])
{
NSURLComponents
*
components
=
[
self
URLComponentsForCheckoutsAppendingPath
:
@"shipping_rates"
checkoutToken
:
checkout
.
token
queryItems
:
@{
@"checkout"
:
@""
}];
NSURLComponents
*
components
=
[
self
URLComponentsForCheckoutsAppendingPath
:
@"shipping_rates"
checkoutToken
:
checkout
.
token
queryItems
:
@{
@"checkout"
:
@""
}];
return
[
self
getRequestForURL
:
components
.
URL
completionHandler
:
^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
task
=
[
self
getRequestForURL
:
components
.
URL
completionHandler
:
^
(
NSDictionary
*
json
,
NSURLResponse
*
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"
]];
}
}
NSInteger
statusCode
=
[(
NSHTTPURLResponse
*
)
response
statusCode
];
NSInteger
statusCode
=
[(
NSHTTPURLResponse
*
)
response
statusCode
];
block
(
shippingRates
,
[
BUYClient
statusForStatusCode
:
statusCode
error
:
error
],
error
);
block
(
shippingRates
,
[
BUYClient
statusForStatusCode
:
statusCode
error
:
error
],
error
);
}];
}];
}
else
{
block
(
nil
,
BUYStatusUnknown
,
[
NSError
errorWithDomain
:
kShopifyError
code
:
BUYShopifyError_InvalidCheckoutObject
userInfo
:
nil
]);
}
return
task
;
}
}
#pragma mark - Payments
#pragma mark - Payments
...
...
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