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
daa3b57e
Commit
daa3b57e
authored
Oct 13, 2015
by
Rune Madsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated to Advanced Sample App to show the order status page after a completed checkout.
parent
d33f318e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
17 deletions
+35
-17
CheckoutViewController.m
...d/Mobile Buy SDK Advanced Sample/CheckoutViewController.m
+35
-17
No files found.
Mobile Buy SDK Sample Apps/Sample App Advanced/Mobile Buy SDK Advanced Sample/CheckoutViewController.m
View file @
daa3b57e
...
...
@@ -175,12 +175,16 @@ NSString * const MerchantId = @"";
{
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
@"Checkout complete"
message
:
nil
preferredStyle
:
UIAlertControllerStyleAlert
];;
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:
@"
OK
"
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:
@"
Start over
"
style
:
UIAlertActionStyleDefault
handler
:
^
(
UIAlertAction
*
action
)
{
[
self
.
navigationController
popToRootViewControllerAnimated
:
YES
];
}]];
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:
@"Show order status page"
style
:
UIAlertActionStyleDefault
handler
:
^
(
UIAlertAction
*
action
)
{
SFSafariViewController
*
safariViewController
=
[[
SFSafariViewController
alloc
]
initWithURL
:
self
.
checkout
.
order
.
statusURL
];
[
self
presentViewController
:
safariViewController
animated
:
YES
completion
:
NULL
];
}]];
[
self
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
...
...
@@ -228,7 +232,7 @@ NSString * const MerchantId = @"";
NSLog
(
@"Successfully got completion status: %lu"
,
(
unsigned
long
)
completionStatus
);
[
self
showCheckoutConfirmation
];
[
self
getCompletedCheckout
];
}
-
(
void
)
operation
:
(
GetCompletionStatusOperation
*
)
operation
failedToReceiveCompletionStatus
:
(
NSError
*
)
error
...
...
@@ -294,17 +298,9 @@ NSString * const MerchantId = @"";
{
// Add additional methods if needed and forward the callback to BUYApplePayHelpers
[
self
.
applePayHelper
paymentAuthorizationViewController
:
controller
didAuthorizePayment
:
payment
completion
:
completion
];
// Get the completed checkout
[
self
.
client
getCheckout
:
self
.
applePayHelper
.
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
error
)
{
NSLog
(
@"Unable to get completed checkout"
);
NSLog
(
@"%@"
,
error
);
}
if
(
checkout
)
{
NSLog
(
@"%@"
,
checkout
);
}
}];
self
.
checkout
=
self
.
applePayHelper
.
checkout
;
[
self
getCompletedCheckout
];
}
-
(
void
)
paymentAuthorizationViewControllerDidFinish
:
(
PKPaymentAuthorizationViewController
*
)
controller
...
...
@@ -363,9 +359,8 @@ NSString * const MerchantId = @"";
[[
UIApplication
sharedApplication
]
setNetworkActivityIndicatorVisible
:
NO
];
if
(
error
==
nil
&&
status
==
BUYStatusComplete
)
{
NSLog
(
@"Successfully completed checkout"
);
[
welf
showCheckoutConfirmation
];
[
welf
getCompletedCheckout
];
}
else
{
NSLog
(
@"Error completing checkout: %@"
,
error
);
...
...
@@ -374,4 +369,27 @@ NSString * const MerchantId = @"";
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
name
:
CheckoutCallbackNotification
object
:
nil
];
}
-
(
void
)
getCompletedCheckout
{
__weak
CheckoutViewController
*
welf
=
self
;
[[
UIApplication
sharedApplication
]
setNetworkActivityIndicatorVisible
:
YES
];
[
self
.
client
getCheckout
:
self
.
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
[[
UIApplication
sharedApplication
]
setNetworkActivityIndicatorVisible
:
NO
];
if
(
error
)
{
NSLog
(
@"Unable to get completed checkout"
);
NSLog
(
@"%@"
,
error
);
}
if
(
checkout
)
{
welf
.
checkout
=
checkout
;
[
welf
showCheckoutConfirmation
];
NSLog
(
@"%@"
,
checkout
);
}
}];
}
@end
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