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
dfa7ecba
Commit
dfa7ecba
authored
May 11, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor remove gift card to assert instead of return error.
parent
6961594a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
BUYClient.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
+10
-16
No files found.
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
dfa7ecba
...
...
@@ -378,23 +378,17 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
removeGiftCard
:
(
BUYGiftCard
*
)
giftCard
fromCheckout
:
(
BUYCheckout
*
)
checkout
completion
:
(
BUYDataCheckoutBlock
)
block
{
NSURLSessionDataTask
*
task
=
nil
;
if
(
giftCard
.
identifier
)
{
NSURLComponents
*
components
=
[
self
URLComponentsForCheckoutsAppendingPath
:[
NSString
stringWithFormat
:
@"gift_cards/%@"
,
giftCard
.
identifier
]
checkoutToken
:
checkout
.
token
queryItems
:
nil
];
task
=
[
self
deleteRequestForURL
:
components
.
URL
completionHandler
:
^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
if
(
!
error
)
{
[
self
updateCheckout
:
checkout
withGiftCardDictionary
:
json
[
@"gift_card"
]
addingGiftCard
:
NO
];
}
block
(
checkout
,
error
);
}];
}
else
{
block
(
nil
,
[
NSError
errorWithDomain
:
kShopifyError
code
:
BUYShopifyError_NoGiftCardSpecified
userInfo
:
nil
]);
}
NSAssert
(
giftCard
.
identifier
,
@"Failed to remove gift card. Gift card must have a valid identifier."
);
return
task
;
NSURLComponents
*
components
=
[
self
URLComponentsForCheckoutsAppendingPath
:[
NSString
stringWithFormat
:
@"gift_cards/%@"
,
giftCard
.
identifier
]
checkoutToken
:
checkout
.
token
queryItems
:
nil
];
return
[
self
deleteRequestForURL
:
components
.
URL
completionHandler
:
^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
if
(
!
error
)
{
[
self
updateCheckout
:
checkout
withGiftCardDictionary
:
json
[
@"gift_card"
]
addingGiftCard
:
NO
];
}
block
(
checkout
,
error
);
}];
}
-
(
void
)
updateCheckout
:
(
BUYCheckout
*
)
checkout
withGiftCardDictionary
:
(
NSDictionary
*
)
giftCardDictionary
addingGiftCard
:
(
BOOL
)
addingGiftCard
...
...
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