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
79b3edf4
Commit
79b3edf4
authored
Oct 06, 2015
by
Jonathan Baker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add generics and nullability BUYApplePayAdditions.
parent
0dff9eba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
BUYApplePayAdditions.h
Mobile Buy SDK/Mobile Buy SDK/Utils/BUYApplePayAdditions.h
+6
-6
BUYApplePayAdditions.m
Mobile Buy SDK/Mobile Buy SDK/Utils/BUYApplePayAdditions.m
+9
-8
No files found.
Mobile Buy SDK/Mobile Buy SDK/Utils/BUYApplePayAdditions.h
View file @
79b3edf4
...
...
@@ -37,7 +37,7 @@
* Returns an array of summary items for all Apple Pay requests. Will use 'PAY TOTAL' as the summary label. Apple recommends
* including the business name in the summary label, so it is recommended to use `buy_summaryItemsWithShopName` instead.
*/
-
(
NSArray
*
)
buy_summaryItems
;
-
(
nonnull
NSArray
<
PKPaymentSummaryItem
*>
*
)
buy_summaryItems
;
/**
* Returns an array of summary items for all Apple Pay requests using the shop name in the "PAY" section
...
...
@@ -46,7 +46,7 @@
*
* @return An array of PKPaymentSummaryItems
*/
-
(
NSArray
*
)
buy_summaryItemsWithShopName
:(
NSString
*
)
shopName
;
-
(
nonnull
NSArray
<
PKPaymentSummaryItem
*>
*
)
buy_summaryItemsWithShopName
:(
nullable
NSString
*
)
shopName
;
@end
...
...
@@ -59,13 +59,13 @@
*
* @return An array of PKShippingMethods
*/
+
(
NSArray
*
)
buy_convertShippingRatesToShippingMethods
:(
NSArray
*
)
rates
;
+
(
nonnull
NSArray
<
PKShippingMethod
*>
*
)
buy_convertShippingRatesToShippingMethods
:(
nonnull
NSArray
<
BUYShippingRate
*>
*
)
rates
;
@end
@interface
BUYAddress
(
ApplePay
)
+
(
NSString
*
)
buy_emailFromRecord
:(
ABRecordRef
)
record
;
+
(
nullable
NSString
*
)
buy_emailFromRecord
:(
nonnull
ABRecordRef
)
record
;
/**
* Creates a BUYAddress from an ABRecordRef
...
...
@@ -74,7 +74,7 @@
*
* @return The BUYAddress created from an ABRecordRef
*/
+
(
BUYAddress
*
)
buy_addressFromRecord
:(
ABRecordRef
)
record
NS_DEPRECATED_IOS
(
8
_0
,
9
_0
,
"Use the CNContact backed `buy_addressFromContact:` instead"
);
+
(
nonnull
BUYAddress
*
)
buy_addressFromRecord
:(
nonnull
ABRecordRef
)
record
NS_DEPRECATED_IOS
(
8
_0
,
9
_0
,
"Use the CNContact backed `buy_addressFromContact:` instead"
);
/**
* Creates a BUYAddress from a PKContact
...
...
@@ -83,6 +83,6 @@
*
* @return The BUYAddress created from a PKContact
*/
+
(
BUYAddress
*
)
buy_addressFromContact
:(
PKContact
*
)
contact
NS_AVAILABLE_IOS
(
9
_0
);
+
(
nonnull
BUYAddress
*
)
buy_addressFromContact
:(
nonnull
PKContact
*
)
contact
NS_AVAILABLE_IOS
(
9
_0
);
@end
Mobile Buy SDK/Mobile Buy SDK/Utils/BUYApplePayAdditions.m
View file @
79b3edf4
...
...
@@ -38,11 +38,11 @@
@implementation
BUYCheckout
(
ApplePay
)
-
(
NSArray
*
)
buy_summaryItemsWithShopName
:(
NSString
*
)
shopName
{
-
(
nonnull
NSArray
<
PKPaymentSummaryItem
*>
*
)
buy_summaryItemsWithShopName
:(
nullable
NSString
*
)
shopName
{
BOOL
hasDiscount
=
[
self
.
discount
.
amount
compare
:[
NSDecimalNumber
zero
]]
==
NSOrderedDescending
;
NSMutableArray
*
summaryItems
=
[[
NSMutableArray
alloc
]
init
];
NSMutableArray
<
PKPaymentSummaryItem
*>
*
summaryItems
=
[[
NSMutableArray
alloc
]
init
];
if
(
hasDiscount
||
[
self
.
lineItems
count
]
>
1
)
{
NSDecimalNumber
*
lineItemSubtotal
=
[
NSDecimalNumber
zero
];
...
...
@@ -76,10 +76,11 @@
NSString
*
itemLabel
=
shopName
?:
@"TOTAL"
;
[
summaryItems
addObject
:[
PKPaymentSummaryItem
summaryItemWithLabel
:
itemLabel
amount
:
self
.
paymentDue
?:
[
NSDecimalNumber
zero
]]];
return
summaryItems
;
}
-
(
NSArray
*
)
buy_summaryItems
-
(
nonnull
NSArray
<
PKPaymentSummaryItem
*>
*
)
buy_summaryItems
{
return
[
self
buy_summaryItemsWithShopName
:
nil
];
}
...
...
@@ -88,9 +89,9 @@
@implementation
BUYShippingRate
(
ApplePay
)
+
(
NSArray
*
)
buy_convertShippingRatesToShippingMethods
:(
NSArray
*
)
rates
+
(
nonnull
NSArray
<
PKShippingMethod
*>
*
)
buy_convertShippingRatesToShippingMethods
:(
nonnull
NSArray
<
BUYShippingRate
*>
*
)
rates
{
NSMutableArray
*
shippingMethods
=
[[
NSMutableArray
alloc
]
init
];
NSMutableArray
<
PKShippingMethod
*>
*
shippingMethods
=
[[
NSMutableArray
alloc
]
init
];
for
(
BUYShippingRate
*
shippingRate
in
rates
)
{
PKShippingMethod
*
shippingMethod
=
[[
PKShippingMethod
alloc
]
init
];
shippingMethod
.
label
=
shippingRate
.
title
;
...
...
@@ -121,7 +122,7 @@
@implementation
BUYAddress
(
ApplePay
)
+
(
NSString
*
)
buy_emailFromRecord
:(
ABRecordRef
)
record
+
(
nullable
NSString
*
)
buy_emailFromRecord
:(
nonnull
ABRecordRef
)
record
{
ABMultiValueRef
emailMultiValue
=
ABRecordCopyValue
(
record
,
kABPersonEmailProperty
);
CFArrayRef
allEmails
=
ABMultiValueCopyArrayOfAllValues
(
emailMultiValue
);
...
...
@@ -136,7 +137,7 @@
return
email
;
}
+
(
BUYAddress
*
)
buy_addressFromRecord
:(
ABRecordRef
)
record
+
(
nonnull
BUYAddress
*
)
buy_addressFromRecord
:(
nonnull
ABRecordRef
)
record
{
BUYAddress
*
address
=
[[
BUYAddress
alloc
]
init
];
...
...
@@ -193,7 +194,7 @@
return
address
;
}
+
(
BUYAddress
*
)
buy_addressFromContact
:(
PKContact
*
)
contact
+
(
nonnull
BUYAddress
*
)
buy_addressFromContact
:(
nonnull
PKContact
*
)
contact
{
BUYAddress
*
address
=
[[
BUYAddress
alloc
]
init
];
...
...
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