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
663d399d
Commit
663d399d
authored
Oct 05, 2015
by
Rune Madsen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4 from Shopify/runmad.3-shop-name-prefetch
Advanced Sample App: Prefetch BUYShop for Apple Pay
parents
16e05356
38502f59
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
CheckoutViewController.m
...d/Mobile Buy SDK Advanced Sample/CheckoutViewController.m
+21
-4
No files found.
Mobile Buy SDK Sample Apps/Sample App Advanced/Mobile Buy SDK Advanced Sample/CheckoutViewController.m
View file @
663d399d
...
...
@@ -38,6 +38,7 @@ NSString * const MerchantId = @"";
@property
(
nonatomic
,
strong
)
BUYCheckout
*
checkout
;
@property
(
nonatomic
,
strong
)
BUYClient
*
client
;
@property
(
nonatomic
,
strong
)
BUYShop
*
shop
;
@property
(
nonatomic
,
strong
)
NSArray
*
summaryItems
;
@property
(
nonatomic
,
strong
)
BUYApplePayHelpers
*
applePayHelper
;
...
...
@@ -100,6 +101,11 @@ NSString * const MerchantId = @"";
self
.
tableView
.
tableFooterView
=
footerView
;
[
self
.
tableView
registerClass
:[
SummaryItemsTableViewCell
class
]
forCellReuseIdentifier
:
@"SummaryCell"
];
// Prefetch the shop object for Apple Pay
[
self
.
client
getShop
:
^
(
BUYShop
*
shop
,
NSError
*
error
)
{
_shop
=
shop
;
}];
}
-
(
void
)
setCheckout
:
(
BUYCheckout
*
)
checkout
...
...
@@ -240,7 +246,7 @@ NSString * const MerchantId = @"";
PKPaymentAuthorizationViewController
*
paymentController
=
[[
PKPaymentAuthorizationViewController
alloc
]
initWithPaymentRequest
:
request
];
self
.
applePayHelper
=
[[
BUYApplePayHelpers
alloc
]
initWithClient
:
self
.
client
checkout
:
self
.
checkout
];
self
.
applePayHelper
=
[[
BUYApplePayHelpers
alloc
]
initWithClient
:
self
.
client
checkout
:
self
.
checkout
shop
:
self
.
shop
];
paymentController
.
delegate
=
self
;
/**
...
...
@@ -272,10 +278,10 @@ NSString * const MerchantId = @"";
[
paymentRequest
setRequiredShippingAddressFields
:
self
.
checkout
.
requiresShipping
?
PKAddressFieldAll
:
PKAddressFieldEmail
|
PKAddressFieldPhone
];
[
paymentRequest
setSupportedNetworks
:@[
PKPaymentNetworkVisa
,
PKPaymentNetworkMasterCard
]];
[
paymentRequest
setMerchantCapabilities
:
PKMerchantCapability3DS
];
[
paymentRequest
setCountryCode
:
@"US"
];
[
paymentRequest
setCurrencyCode
:
@"USD"
];
[
paymentRequest
setCountryCode
:
self
.
shop
.
country
?:
@"US"
];
[
paymentRequest
setCurrencyCode
:
self
.
shop
.
currency
?:
@"USD"
];
[
paymentRequest
setPaymentSummaryItems
:
[
self
.
checkout
buy_summaryItems
]];
[
paymentRequest
setPaymentSummaryItems
:
[
self
.
checkout
buy_summaryItemsWithShopName
:
self
.
shop
.
name
]];
return
paymentRequest
;
}
...
...
@@ -288,6 +294,17 @@ 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
);
}
}];
}
-
(
void
)
paymentAuthorizationViewControllerDidFinish
:
(
PKPaymentAuthorizationViewController
*
)
controller
...
...
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