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
9e50f380
Commit
9e50f380
authored
Jun 13, 2016
by
Brent Gulanowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lift conditional out of method into call sites.
parent
fd81b6e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
22 deletions
+21
-22
BUYApplePayAuthorizationDelegate.m
...K/Mobile Buy SDK/Utils/BUYApplePayAuthorizationDelegate.m
+21
-22
No files found.
Mobile Buy SDK/Mobile Buy SDK/Utils/BUYApplePayAuthorizationDelegate.m
View file @
9e50f380
...
...
@@ -135,13 +135,17 @@ typedef void (^AddressUpdateCompletion)(PKPaymentAuthorizationStatus, NSArray<PK
-
(
void
)
paymentAuthorizationViewController
:(
PKPaymentAuthorizationViewController
*
)
controller
didSelectShippingAddress
:(
ABRecordRef
)
address
completion
:(
AddressUpdateCompletion
)
completion
{
self
.
checkout
.
shippingAddress
=
[
self
buyAddressWithABRecord
:
address
];
[
self
updateCheckoutWithAddressCompletion
:
completion
];
if
([
self
.
checkout
.
shippingAddress
isValidAddressForShippingRates
])
{
[
self
updateCheckoutWithAddressCompletion
:
completion
];
}
}
-
(
void
)
paymentAuthorizationViewController
:(
PKPaymentAuthorizationViewController
*
)
controller
didSelectShippingContact
:(
PKContact
*
)
contact
completion
:(
AddressUpdateCompletion
)
completion
{
self
.
checkout
.
shippingAddress
=
[
self
buyAddressWithContact
:
contact
];
[
self
updateCheckoutWithAddressCompletion
:
completion
];
if
([
self
.
checkout
.
shippingAddress
isValidAddressForShippingRates
])
{
[
self
updateCheckoutWithAddressCompletion
:
completion
];
}
}
-
(
void
)
paymentAuthorizationViewController
:(
PKPaymentAuthorizationViewController
*
)
controller
didSelectShippingMethod
:(
PKShippingMethod
*
)
shippingMethod
completion
:(
void
(
^
)(
PKPaymentAuthorizationStatus
,
NSArray
<
PKPaymentSummaryItem
*>
*
_Nonnull
))
completion
...
...
@@ -171,26 +175,21 @@ typedef void (^AddressUpdateCompletion)(PKPaymentAuthorizationStatus, NSArray<PK
self
.
checkout
.
partialAddresses
=
@YES
;
}
if
([
self
.
checkout
.
shippingAddress
isValidAddressForShippingRates
])
{
[
self
.
client
updateCheckout
:
self
.
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
checkout
&&
!
error
)
{
self
.
checkout
=
checkout
;
}
else
if
(
error
)
{
self
.
lastError
=
error
;
}
if
(
checkout
.
requiresShipping
)
{
self
.
shippingRates
=
@[];
[
self
updateShippingRatesCompletion
:
completion
];
}
else
{
completion
(
PKPaymentAuthorizationStatusSuccess
,
@[],
[
self
.
checkout
buy_summaryItemsWithShopName
:
self
.
shopName
]);
}
}];
}
else
{
completion
(
PKPaymentAuthorizationStatusInvalidShippingPostalAddress
,
@[],
[
self
.
checkout
buy_summaryItemsWithShopName
:
self
.
shopName
]);
}
[
self
.
client
updateCheckout
:
self
.
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
checkout
&&
!
error
)
{
self
.
checkout
=
checkout
;
}
else
if
(
error
)
{
self
.
lastError
=
error
;
}
if
(
checkout
.
requiresShipping
)
{
self
.
shippingRates
=
@[];
[
self
updateShippingRatesCompletion
:
completion
];
}
else
{
completion
(
PKPaymentAuthorizationStatusSuccess
,
@[],
[
self
.
checkout
buy_summaryItemsWithShopName
:
self
.
shopName
]);
}
}];
}
-
(
void
)
updateShippingRatesCompletion
:(
AddressUpdateCompletion
)
completion
...
...
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