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
24fd05e0
Commit
24fd05e0
authored
Oct 21, 2015
by
Rune Madsen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #40 from Shopify/runmad.add-status-url-page-advanced-sample-app
Add status page to Advanced Sample App demo
parents
4c204bf1
f4a90998
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
16 deletions
+34
-16
CheckoutViewController.m
...d/Mobile Buy SDK Advanced Sample/CheckoutViewController.m
+34
-16
No files found.
Mobile Buy SDK Sample Apps/Sample App Advanced/Mobile Buy SDK Advanced Sample/CheckoutViewController.m
View file @
24fd05e0
...
...
@@ -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
...
...
@@ -295,16 +299,8 @@ 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