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
53102c3a
Commit
53102c3a
authored
May 18, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #153 from Shopify/task/payment-providers
Add payment providers
parents
15e8ade1
2b1264cd
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1341 additions
and
11 deletions
+1341
-11
BUYClientTestBase.h
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTestBase.h
+0
-1
BUYPaymentProviderTests.m
...le Buy SDK/Mobile Buy SDK Tests/BUYPaymentProviderTests.m
+262
-0
test_shop_data.json
Mobile Buy SDK/Mobile Buy SDK Tests/test_shop_data.json
+2
-2
project.pbxproj
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
+67
-1
Buy.h
Mobile Buy SDK/Mobile Buy SDK/Buy.h
+7
-0
BUYApplePayPaymentProvider.h
...le Buy SDK/Payment Providers/BUYApplePayPaymentProvider.h
+79
-0
BUYApplePayPaymentProvider.m
...le Buy SDK/Payment Providers/BUYApplePayPaymentProvider.m
+301
-0
BUYClient+Checkout.h
...SDK/Mobile Buy SDK/Payment Providers/BUYClient+Checkout.h
+37
-0
BUYClient+Checkout.m
...SDK/Mobile Buy SDK/Payment Providers/BUYClient+Checkout.m
+40
-0
BUYPaymentController.h
...K/Mobile Buy SDK/Payment Providers/BUYPaymentController.h
+67
-0
BUYPaymentController.m
...K/Mobile Buy SDK/Payment Providers/BUYPaymentController.m
+81
-0
BUYPaymentProvider.h
...SDK/Mobile Buy SDK/Payment Providers/BUYPaymentProvider.h
+145
-0
BUYWebCheckoutPaymentProvider.h
...Buy SDK/Payment Providers/BUYWebCheckoutPaymentProvider.h
+50
-0
BUYWebCheckoutPaymentProvider.m
...Buy SDK/Payment Providers/BUYWebCheckoutPaymentProvider.m
+192
-0
Buy.h
Mobile Buy SDK/Mobile Buy SDK/Static Framework/Buy.h
+10
-3
BUYViewController.m
...y SDK/Mobile Buy SDK/View Controllers/BUYViewController.m
+1
-4
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTestBase.h
View file @
53102c3a
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
extern
NSString
*
const
BUYShopDomain_Placeholder
;
extern
NSString
*
const
BUYShopDomain_Placeholder
;
extern
NSString
*
const
BUYAPIKey_Placeholder
;
extern
NSString
*
const
BUYAPIKey_Placeholder
;
extern
NSString
*
const
BUYAppId_Placeholder
;
extern
NSString
*
const
BUYAppId_Placeholder
;
extern
NSString
*
const
BUYChannelId_Placeholder
;
extern
NSString
*
const
BUYFakeCustomerToken
;
extern
NSString
*
const
BUYFakeCustomerToken
;
@interface
BUYClientTestBase
:
XCTestCase
@interface
BUYClientTestBase
:
XCTestCase
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYPaymentProviderTests.m
0 → 100644
View file @
53102c3a
//
// BUYPaymentProviderTests.m
// Mobile Buy SDK
//
// Created by David Muzi on 2015-12-15.
// Copyright © 2015 Shopify Inc. All rights reserved.
//
@import
XCTest
;
#import <Buy/Buy.h>
#import "BUYApplePayPaymentProvider.h"
#import "BUYWebCheckoutPaymentProvider.h"
#import "BUYClientTestBase.h"
#import "BUYPaymentController.h"
#import <OHHTTPStubs/OHHTTPStubs.h>
@interface
BUYPaymentController
()
-
(
id
<
BUYPaymentProvider
>
)
providerForType
:
(
NSString
*
)
type
;
@end
@interface
BUYPaymentProviderTests
:
XCTestCase
<
BUYPaymentProviderDelegate
>
@property
(
nonatomic
)
NSMutableDictionary
<
NSString
*
,
XCTestExpectation
*>
*
expectations
;
@property
(
nonatomic
)
BUYModelManager
*
modelManager
;
@end
@implementation
BUYPaymentProviderTests
-
(
void
)
setUp
{
[
super
setUp
];
self
.
modelManager
=
[
BUYModelManager
modelManager
];
self
.
expectations
=
[@{}
mutableCopy
];
}
-
(
void
)
tearDown
{
[
super
tearDown
];
[
OHHTTPStubs
removeAllStubs
];
}
-
(
BUYClient
*
)
client
{
return
[[
BUYClient
alloc
]
initWithShopDomain
:
BUYShopDomain_Placeholder
apiKey
:
BUYAPIKey_Placeholder
appId
:
BUYAppId_Placeholder
];
}
-
(
BUYCheckout
*
)
checkout
{
return
[
self
.
modelManager
insertCheckoutWithJSONDictionary
:
nil
];
}
-
(
void
)
mockRequests
{
// This mocks a getShop, and createCheckout request
[
OHHTTPStubs
stubRequestsPassingTest
:
^
BOOL
(
NSURLRequest
*
_Nonnull
request
)
{
return
YES
;
}
withStubResponse
:
^
OHHTTPStubsResponse
*
_Nonnull
(
NSURLRequest
*
_Nonnull
request
)
{
return
[
BUYPaymentProviderTests
responseForRequest
:
request
];
}];
}
+
(
OHHTTPStubsResponse
*
)
responseForRequest
:
(
NSURLRequest
*
)
request
{
NSURLComponents
*
components
=
[
NSURLComponents
componentsWithURL
:
request
.
URL
resolvingAgainstBaseURL
:
NO
];
if
([
components
.
path
isEqualToString
:
@"/meta.json"
])
{
return
[
OHHTTPStubsResponse
responseWithJSONObject
:@{
@"id"
:
@"123"
,
@"country"
:
@"US"
,
@"currency"
:
@"USD"
}
statusCode
:
200
headers
:
nil
];
}
else
if
([
components
.
path
isEqualToString
:
@"/api/checkouts.json"
])
{
return
[
OHHTTPStubsResponse
responseWithJSONObject
:@{
@"checkout"
:
@{
@"payment_due"
:
@
(
99
),
@"web_checkout_url"
:
@"https://example.com"
}}
statusCode
:
200
headers
:
nil
];
}
return
nil
;
}
#pragma mark - Apple Pay
-
(
void
)
testAppleAvailability
{
BUYApplePayPaymentProvider
*
applePay
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@"merchant.id.1"
];
XCTAssertTrue
(
applePay
.
isAvailable
);
BUYApplePayPaymentProvider
*
applePay2
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@""
];
XCTAssertFalse
(
applePay2
.
isAvailable
);
}
-
(
void
)
testApplePayPresentationCallbacks
{
[
self
mockRequests
];
BUYApplePayPaymentProvider
*
applePay
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@"merchant.id.1"
];
applePay
.
delegate
=
self
;
self
.
expectations
[
@"presentController"
]
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
[
applePay
startCheckout
:
self
.
checkout
];
[
self
waitForExpectationsWithTimeout
:
1
handler
:
^
(
NSError
*
error
)
{
XCTAssertNil
(
error
);
}];
}
-
(
void
)
testApplePayProvider
{
BUYApplePayPaymentProvider
*
applePay1
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@"merchant.id.1"
];
XCTAssertEqualObjects
(
applePay1
.
merchantID
,
@"merchant.id.1"
);
// 4 default networks should be configured
XCTAssertEqual
(
applePay1
.
supportedNetworks
.
count
,
4
);
applePay1
.
supportedNetworks
=
@[
PKPaymentNetworkMasterCard
];
XCTAssertEqual
(
applePay1
.
supportedNetworks
.
count
,
1
);
XCTAssertEqualObjects
(
applePay1
.
supportedNetworks
[
0
],
PKPaymentNetworkMasterCard
);
}
-
(
void
)
testCanShowApplePaySetup
{
BUYApplePayPaymentProvider
*
applePay
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@"merchant.id.1"
];
XCTAssertTrue
(
applePay
.
canShowApplePaySetup
);
BUYApplePayPaymentProvider
*
applePay2
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@""
];
XCTAssertFalse
(
applePay2
.
canShowApplePaySetup
);
}
-
(
void
)
testFailedApplePayCallbacks
{
[
OHHTTPStubs
stubRequestsPassingTest
:
^
BOOL
(
NSURLRequest
*
_Nonnull
request
)
{
return
YES
;
}
withStubResponse
:
^
OHHTTPStubsResponse
*
_Nonnull
(
NSURLRequest
*
_Nonnull
request
)
{
return
[
OHHTTPStubsResponse
responseWithJSONObject
:@{}
statusCode
:
400
headers
:
nil
];
}];
BUYApplePayPaymentProvider
*
applePay
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@"merchant.id.1"
];
applePay
.
delegate
=
self
;
self
.
expectations
[
@"failedCheckout"
]
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
self
.
expectations
[
@"failedShop"
]
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
[
applePay
startCheckout
:
self
.
checkout
];
[
self
waitForExpectationsWithTimeout
:
1
handler
:
^
(
NSError
*
error
)
{
XCTAssertNil
(
error
);
}];
}
#pragma mark - Web
-
(
void
)
testWebAvailability
{
BUYWebCheckoutPaymentProvider
*
webProvider
=
[[
BUYWebCheckoutPaymentProvider
alloc
]
initWithClient
:
self
.
client
];
XCTAssertTrue
(
webProvider
.
isAvailable
);
}
-
(
void
)
testWebPresentationCallbacks
{
[
self
mockRequests
];
BUYWebCheckoutPaymentProvider
*
webProvider
=
[[
BUYWebCheckoutPaymentProvider
alloc
]
initWithClient
:
self
.
client
];
webProvider
.
delegate
=
self
;
self
.
expectations
[
@"presentController"
]
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
[
webProvider
startCheckout
:
self
.
checkout
];
[
self
waitForExpectationsWithTimeout
:
1
handler
:
^
(
NSError
*
error
)
{
XCTAssertNil
(
error
);
}];
}
#pragma mark - Payment Controller
-
(
void
)
testPaymentController
{
BUYPaymentController
*
controller
=
[[
BUYPaymentController
alloc
]
init
];
BUYApplePayPaymentProvider
*
applePay1
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@"merchant.id.1"
];
[
controller
addPaymentProvider
:
applePay1
];
XCTAssertEqual
(
controller
.
providers
.
count
,
1
);
id
<
BUYPaymentProvider
>
provider
=
[
controller
providerForType
:
BUYApplePayPaymentProviderId
];
XCTAssertEqualObjects
(
provider
,
applePay1
);
BUYWebCheckoutPaymentProvider
*
webProvider
=
[[
BUYWebCheckoutPaymentProvider
alloc
]
initWithClient
:
self
.
client
];
[
controller
addPaymentProvider
:
webProvider
];
XCTAssertEqual
(
controller
.
providers
.
count
,
2
);
provider
=
[
controller
providerForType
:
BUYWebPaymentProviderId
];
XCTAssertEqualObjects
(
provider
,
webProvider
);
// Attempt to add an alternate Apple Pay provider
BUYApplePayPaymentProvider
*
applePay2
=
[[
BUYApplePayPaymentProvider
alloc
]
initWithClient
:
self
.
client
merchantID
:
@"merchant.id.2"
];
[
controller
addPaymentProvider
:
applePay2
];
XCTAssertEqual
(
controller
.
providers
.
count
,
2
);
}
-
(
void
)
testStartingPaymentWithPaymentController
{
[
self
mockRequests
];
BUYPaymentController
*
controller
=
[[
BUYPaymentController
alloc
]
init
];
BUYWebCheckoutPaymentProvider
*
webProvider
=
[[
BUYWebCheckoutPaymentProvider
alloc
]
initWithClient
:
self
.
client
];
webProvider
.
delegate
=
self
;
[
controller
addPaymentProvider
:
webProvider
];
self
.
expectations
[
@"presentController"
]
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
[
controller
startCheckout
:
self
.
checkout
withProviderType
:
BUYWebPaymentProviderId
];
[
self
waitForExpectationsWithTimeout
:
1
handler
:
^
(
NSError
*
error
)
{
XCTAssertNil
(
error
);
}];
}
#pragma mark - Payment Provider delegate
-
(
void
)
paymentProvider
:
(
id
<
BUYPaymentProvider
>
)
provider
wantsControllerPresented
:
(
UIViewController
*
)
controller
{
[
self
.
expectations
[
@"presentController"
]
fulfill
];
}
-
(
void
)
paymentProviderWantsControllerDismissed
:
(
id
<
BUYPaymentProvider
>
)
provider
{
}
-
(
void
)
paymentProviderWillStartCheckout
:
(
id
<
BUYPaymentProvider
>
)
provider
{
}
-
(
void
)
paymentProviderDidDismissCheckout
:
(
id
<
BUYPaymentProvider
>
)
provider
{
}
-
(
void
)
paymentProvider
:
(
id
<
BUYPaymentProvider
>
)
provider
didFailToUpdateCheckoutWithError
:
(
NSError
*
)
error
{
}
-
(
void
)
paymentProvider
:
(
id
<
BUYPaymentProvider
>
)
provider
didFailCheckoutWithError
:
(
NSError
*
)
error
;
{
if
(
self
.
expectations
[
@"failedCheckout"
])
{
[
self
.
expectations
[
@"failedCheckout"
]
fulfill
];
[
self
.
expectations
removeObjectForKey
:
@"failedCheckout"
];
}
if
(
self
.
expectations
[
@"failedShop"
])
{
[
self
.
expectations
[
@"failedShop"
]
fulfill
];
[
self
.
expectations
removeObjectForKey
:
@"failedShop"
];
}
}
-
(
void
)
paymentProvider
:
(
id
<
BUYPaymentProvider
>
)
provider
didCompleteCheckout
:
(
BUYCheckout
*
)
checkout
withStatus
:
(
BUYStatus
)
status
{
}
@end
Mobile Buy SDK/Mobile Buy SDK Tests/test_shop_data.json
View file @
53102c3a
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
"channel_id"
:
""
,
"channel_id"
:
""
,
"app_id"
:
""
,
"app_id"
:
""
,
"merchant_id"
:
""
,
"merchant_id"
:
""
,
"customer_email"
:
""
,
"customer_email"
:
"
asd@asd.com
"
,
"customer_password"
:
""
,
"customer_password"
:
"
asdasd
"
,
"product_ids"
:
[
"product_ids"
:
[
""
,
""
,
""
""
...
...
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
View file @
53102c3a
...
@@ -73,6 +73,7 @@
...
@@ -73,6 +73,7 @@
841ADE241CB6C942000004B0
/* NSURLComponents+BUYAdditions.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFD1CB6C942000004B0
/* NSURLComponents+BUYAdditions.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
841ADE241CB6C942000004B0
/* NSURLComponents+BUYAdditions.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFD1CB6C942000004B0
/* NSURLComponents+BUYAdditions.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
841ADE251CB6C942000004B0
/* NSURLComponents+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
;
};
841ADE251CB6C942000004B0
/* NSURLComponents+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
;
};
841ADE261CB6C942000004B0
/* NSURLComponents+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
;
};
841ADE261CB6C942000004B0
/* NSURLComponents+BUYAdditions.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
;
};
8443E2D11CE2917500EA08D4
/* BUYPaymentProviderTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8443E2D01CE2917500EA08D4
/* BUYPaymentProviderTests.m */
;
};
849110311CCE708900E53B93
/* BUYArrayAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
;
};
849110311CCE708900E53B93
/* BUYArrayAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
;
};
849110321CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8491102F1CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m */
;
};
849110321CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8491102F1CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m */
;
};
849110331CCE708900E53B93
/* BUYStringAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
849110301CCE708900E53B93
/* BUYStringAdditionsTests.m */
;
};
849110331CCE708900E53B93
/* BUYStringAdditionsTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
849110301CCE708900E53B93
/* BUYStringAdditionsTests.m */
;
};
...
@@ -145,6 +146,24 @@
...
@@ -145,6 +146,24 @@
84B0A71E1CDD253A00253EB0
/* orders.json in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A71D1CDD253A00253EB0
/* orders.json */
;
};
84B0A71E1CDD253A00253EB0
/* orders.json in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A71D1CDD253A00253EB0
/* orders.json */
;
};
84B0A7201CDD261100253EB0
/* BUYSerializable.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A71F1CDD261100253EB0
/* BUYSerializable.m */
;
};
84B0A7201CDD261100253EB0
/* BUYSerializable.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A71F1CDD261100253EB0
/* BUYSerializable.m */
;
};
84B0A7211CDD261100253EB0
/* BUYSerializable.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A71F1CDD261100253EB0
/* BUYSerializable.m */
;
};
84B0A7211CDD261100253EB0
/* BUYSerializable.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A71F1CDD261100253EB0
/* BUYSerializable.m */
;
};
84B0A7301CE10ED900253EB0
/* BUYApplePayPaymentProvider.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A7291CE10ED900253EB0
/* BUYApplePayPaymentProvider.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A7311CE10ED900253EB0
/* BUYApplePayPaymentProvider.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A7291CE10ED900253EB0
/* BUYApplePayPaymentProvider.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A7321CE10ED900253EB0
/* BUYApplePayPaymentProvider.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72A1CE10ED900253EB0
/* BUYApplePayPaymentProvider.m */
;
};
84B0A7331CE10ED900253EB0
/* BUYApplePayPaymentProvider.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72A1CE10ED900253EB0
/* BUYApplePayPaymentProvider.m */
;
};
84B0A7341CE10ED900253EB0
/* BUYPaymentController.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72B1CE10ED900253EB0
/* BUYPaymentController.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A7351CE10ED900253EB0
/* BUYPaymentController.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72B1CE10ED900253EB0
/* BUYPaymentController.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A7361CE10ED900253EB0
/* BUYPaymentController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72C1CE10ED900253EB0
/* BUYPaymentController.m */
;
};
84B0A7371CE10ED900253EB0
/* BUYPaymentController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72C1CE10ED900253EB0
/* BUYPaymentController.m */
;
};
84B0A7381CE10ED900253EB0
/* BUYPaymentProvider.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72D1CE10ED900253EB0
/* BUYPaymentProvider.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A7391CE10ED900253EB0
/* BUYPaymentProvider.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72D1CE10ED900253EB0
/* BUYPaymentProvider.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A73A1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72E1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A73B1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72E1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A73C1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72F1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.m */
;
};
84B0A73D1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A72F1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.m */
;
};
84B0A7401CE10F8100253EB0
/* BUYClient+Checkout.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A73E1CE10F8100253EB0
/* BUYClient+Checkout.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A7411CE10F8100253EB0
/* BUYClient+Checkout.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A73E1CE10F8100253EB0
/* BUYClient+Checkout.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84B0A7421CE10F8100253EB0
/* BUYClient+Checkout.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A73F1CE10F8100253EB0
/* BUYClient+Checkout.m */
;
};
84B0A7431CE10F8100253EB0
/* BUYClient+Checkout.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84B0A73F1CE10F8100253EB0
/* BUYClient+Checkout.m */
;
};
84CD7C2D1CC65D5A00B6EE61
/* _BUYCheckoutAttribute.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84CD7C2B1CC65D5500B6EE61
/* _BUYCheckoutAttribute.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84CD7C2D1CC65D5A00B6EE61
/* _BUYCheckoutAttribute.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84CD7C2B1CC65D5500B6EE61
/* _BUYCheckoutAttribute.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84CD7C2E1CC65D5A00B6EE61
/* _BUYCheckoutAttribute.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84CD7C2B1CC65D5500B6EE61
/* _BUYCheckoutAttribute.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84CD7C2E1CC65D5A00B6EE61
/* _BUYCheckoutAttribute.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84CD7C2B1CC65D5500B6EE61
/* _BUYCheckoutAttribute.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
84CD7C2F1CC65D7B00B6EE61
/* _BUYCheckoutAttribute.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84CD7C2C1CC65D5500B6EE61
/* _BUYCheckoutAttribute.m */
;
};
84CD7C2F1CC65D7B00B6EE61
/* _BUYCheckoutAttribute.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84CD7C2C1CC65D5500B6EE61
/* _BUYCheckoutAttribute.m */
;
};
...
@@ -565,6 +584,7 @@
...
@@ -565,6 +584,7 @@
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSURL+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
841ADDFC1CB6C942000004B0
/* NSURL+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSURL+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
841ADDFD1CB6C942000004B0
/* NSURLComponents+BUYAdditions.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"NSURLComponents+BUYAdditions.h"
;
sourceTree
=
"<group>"
;
};
841ADDFD1CB6C942000004B0
/* NSURLComponents+BUYAdditions.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"NSURLComponents+BUYAdditions.h"
;
sourceTree
=
"<group>"
;
};
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSURLComponents+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
841ADDFE1CB6C942000004B0
/* NSURLComponents+BUYAdditions.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"NSURLComponents+BUYAdditions.m"
;
sourceTree
=
"<group>"
;
};
8443E2D01CE2917500EA08D4
/* BUYPaymentProviderTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYPaymentProviderTests.m
;
sourceTree
=
"<group>"
;
};
8465CF441CC13CFE0010B2E6
/* Templates */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder
;
path
=
Templates
;
sourceTree
=
"<group>"
;
};
8465CF441CC13CFE0010B2E6
/* Templates */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder
;
path
=
Templates
;
sourceTree
=
"<group>"
;
};
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYArrayAdditionsTests.m
;
sourceTree
=
"<group>"
;
};
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYArrayAdditionsTests.m
;
sourceTree
=
"<group>"
;
};
8491102F1CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYRegularExpressionAdditionsTests.m
;
sourceTree
=
"<group>"
;
};
8491102F1CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYRegularExpressionAdditionsTests.m
;
sourceTree
=
"<group>"
;
};
...
@@ -612,6 +632,15 @@
...
@@ -612,6 +632,15 @@
8498DCC81CDD208200BD12A8
/* TestModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
TestModel.m
;
sourceTree
=
"<group>"
;
};
8498DCC81CDD208200BD12A8
/* TestModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
TestModel.m
;
sourceTree
=
"<group>"
;
};
84B0A71D1CDD253A00253EB0
/* orders.json */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.json
;
path
=
orders.json
;
sourceTree
=
"<group>"
;
};
84B0A71D1CDD253A00253EB0
/* orders.json */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.json
;
path
=
orders.json
;
sourceTree
=
"<group>"
;
};
84B0A71F1CDD261100253EB0
/* BUYSerializable.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYSerializable.m
;
sourceTree
=
"<group>"
;
};
84B0A71F1CDD261100253EB0
/* BUYSerializable.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYSerializable.m
;
sourceTree
=
"<group>"
;
};
84B0A7291CE10ED900253EB0
/* BUYApplePayPaymentProvider.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYApplePayPaymentProvider.h
;
sourceTree
=
"<group>"
;
};
84B0A72A1CE10ED900253EB0
/* BUYApplePayPaymentProvider.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYApplePayPaymentProvider.m
;
sourceTree
=
"<group>"
;
};
84B0A72B1CE10ED900253EB0
/* BUYPaymentController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYPaymentController.h
;
sourceTree
=
"<group>"
;
};
84B0A72C1CE10ED900253EB0
/* BUYPaymentController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYPaymentController.m
;
sourceTree
=
"<group>"
;
};
84B0A72D1CE10ED900253EB0
/* BUYPaymentProvider.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYPaymentProvider.h
;
sourceTree
=
"<group>"
;
};
84B0A72E1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYWebCheckoutPaymentProvider.h
;
sourceTree
=
"<group>"
;
};
84B0A72F1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYWebCheckoutPaymentProvider.m
;
sourceTree
=
"<group>"
;
};
84B0A73E1CE10F8100253EB0
/* BUYClient+Checkout.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"BUYClient+Checkout.h"
;
sourceTree
=
"<group>"
;
};
84B0A73F1CE10F8100253EB0
/* BUYClient+Checkout.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"BUYClient+Checkout.m"
;
sourceTree
=
"<group>"
;
};
84CD7C2B1CC65D5500B6EE61
/* _BUYCheckoutAttribute.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
_BUYCheckoutAttribute.h
;
sourceTree
=
"<group>"
;
};
84CD7C2B1CC65D5500B6EE61
/* _BUYCheckoutAttribute.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
_BUYCheckoutAttribute.h
;
sourceTree
=
"<group>"
;
};
84CD7C2C1CC65D5500B6EE61
/* _BUYCheckoutAttribute.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
_BUYCheckoutAttribute.m
;
sourceTree
=
"<group>"
;
};
84CD7C2C1CC65D5500B6EE61
/* _BUYCheckoutAttribute.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
_BUYCheckoutAttribute.m
;
sourceTree
=
"<group>"
;
};
84D73BFE1CDD1931000F978A
/* _BUYAddress.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
_BUYAddress.h
;
sourceTree
=
"<group>"
;
};
84D73BFE1CDD1931000F978A
/* _BUYAddress.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
_BUYAddress.h
;
sourceTree
=
"<group>"
;
};
...
@@ -1012,6 +1041,22 @@
...
@@ -1012,6 +1041,22 @@
path
=
"Value Transformers"
;
path
=
"Value Transformers"
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
84B0A7281CE10ED900253EB0
/* Payment Providers */
=
{
isa
=
PBXGroup
;
children
=
(
84B0A73E1CE10F8100253EB0
/* BUYClient+Checkout.h */
,
84B0A73F1CE10F8100253EB0
/* BUYClient+Checkout.m */
,
84B0A7291CE10ED900253EB0
/* BUYApplePayPaymentProvider.h */
,
84B0A72A1CE10ED900253EB0
/* BUYApplePayPaymentProvider.m */
,
84B0A72B1CE10ED900253EB0
/* BUYPaymentController.h */
,
84B0A72C1CE10ED900253EB0
/* BUYPaymentController.m */
,
84B0A72D1CE10ED900253EB0
/* BUYPaymentProvider.h */
,
84B0A72E1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.h */
,
84B0A72F1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.m */
,
);
path
=
"Payment Providers"
;
sourceTree
=
"<group>"
;
};
906CF1AE1B8B660F001F7D5B
/* PKContact Test Objects */
=
{
906CF1AE1B8B660F001F7D5B
/* PKContact Test Objects */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -1061,6 +1106,7 @@
...
@@ -1061,6 +1106,7 @@
90F592FF1B0D5F4C0026B382
/* BUYObjectTests.m */
,
90F592FF1B0D5F4C0026B382
/* BUYObjectTests.m */
,
849110461CCEA85C00E53B93
/* BUYObserverTests.m */
,
849110461CCEA85C00E53B93
/* BUYObserverTests.m */
,
8498DCC41CDD208200BD12A8
/* BUYOrderTests.m */
,
8498DCC41CDD208200BD12A8
/* BUYOrderTests.m */
,
8443E2D01CE2917500EA08D4
/* BUYPaymentProviderTests.m */
,
8491102F1CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m */
,
8491102F1CCE708900E53B93
/* BUYRegularExpressionAdditionsTests.m */
,
849110301CCE708900E53B93
/* BUYStringAdditionsTests.m */
,
849110301CCE708900E53B93
/* BUYStringAdditionsTests.m */
,
90F593001B0D5F4C0026B382
/* BUYTestConstants.h */
,
90F593001B0D5F4C0026B382
/* BUYTestConstants.h */
,
...
@@ -1319,11 +1365,12 @@
...
@@ -1319,11 +1365,12 @@
F773749F19C77E4E0039681C
/* Classes */
=
{
F773749F19C77E4E0039681C
/* Classes */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
841ADDEA1CB6C942000004B0
/* Additions */
,
90DA8DF11BC6A82D0027BCB7
/* Buy.h */
,
90DA8DF11BC6A82D0027BCB7
/* Buy.h */
,
841ADDEA1CB6C942000004B0
/* Additions */
,
F7FDA16F19C93F6100AF4E93
/* Data */
,
F7FDA16F19C93F6100AF4E93
/* Data */
,
F773744419C779C20039681C
/* Models */
,
F773744419C779C20039681C
/* Models */
,
90FC31AB1B50589800AFAB51
/* Product View */
,
90FC31AB1B50589800AFAB51
/* Product View */
,
84B0A7281CE10ED900253EB0
/* Payment Providers */
,
F773744519C779C20039681C
/* Utils */
,
F773744519C779C20039681C
/* Utils */
,
84980F491CB760FA00CFAB58
/* Value Transformers */
,
84980F491CB760FA00CFAB58
/* Value Transformers */
,
BE1C4DF21AE98F8E00E21624
/* View Controllers */
,
BE1C4DF21AE98F8E00E21624
/* View Controllers */
,
...
@@ -1363,6 +1410,7 @@
...
@@ -1363,6 +1410,7 @@
84DD129D1CC63FE600A2442D
/* _BUYCollection.h in Headers */
,
84DD129D1CC63FE600A2442D
/* _BUYCollection.h in Headers */
,
84DD12A11CC63FE600A2442D
/* _BUYImageLink.h in Headers */
,
84DD12A11CC63FE600A2442D
/* _BUYImageLink.h in Headers */
,
84DD12A51CC63FE600A2442D
/* _BUYOption.h in Headers */
,
84DD12A51CC63FE600A2442D
/* _BUYOption.h in Headers */
,
84B0A7411CE10F8100253EB0
/* BUYClient+Checkout.h in Headers */
,
84D73C041CDD1945000F978A
/* _BUYAddress.h in Headers */
,
84D73C041CDD1945000F978A
/* _BUYAddress.h in Headers */
,
84DD12C31CC63FEE00A2442D
/* _BUYDiscount.h in Headers */
,
84DD12C31CC63FEE00A2442D
/* _BUYDiscount.h in Headers */
,
84DD12A71CC63FE600A2442D
/* _BUYOptionValue.h in Headers */
,
84DD12A71CC63FE600A2442D
/* _BUYOptionValue.h in Headers */
,
...
@@ -1393,8 +1441,10 @@
...
@@ -1393,8 +1441,10 @@
901931371BC5B9BC00D1134E
/* BUYTaxLine.h in Headers */
,
901931371BC5B9BC00D1134E
/* BUYTaxLine.h in Headers */
,
901931381BC5B9BC00D1134E
/* BUYVariantSelectionViewController.h in Headers */
,
901931381BC5B9BC00D1134E
/* BUYVariantSelectionViewController.h in Headers */
,
901931391BC5B9BC00D1134E
/* BUYOptionValueCell.h in Headers */
,
901931391BC5B9BC00D1134E
/* BUYOptionValueCell.h in Headers */
,
84B0A7351CE10ED900253EB0
/* BUYPaymentController.h in Headers */
,
9019313A1BC5B9BC00D1134E
/* BUYImageLink.h in Headers */
,
9019313A1BC5B9BC00D1134E
/* BUYImageLink.h in Headers */
,
9019313B1BC5B9BC00D1134E
/* BUYOptionValue.h in Headers */
,
9019313B1BC5B9BC00D1134E
/* BUYOptionValue.h in Headers */
,
84B0A7311CE10ED900253EB0
/* BUYApplePayPaymentProvider.h in Headers */
,
9019313C1BC5B9BC00D1134E
/* BUYShop.h in Headers */
,
9019313C1BC5B9BC00D1134E
/* BUYShop.h in Headers */
,
9019313D1BC5B9BC00D1134E
/* BUYShippingRate.h in Headers */
,
9019313D1BC5B9BC00D1134E
/* BUYShippingRate.h in Headers */
,
9019313E1BC5B9BC00D1134E
/* BUYApplePayAdditions.h in Headers */
,
9019313E1BC5B9BC00D1134E
/* BUYApplePayAdditions.h in Headers */
,
...
@@ -1415,6 +1465,7 @@
...
@@ -1415,6 +1465,7 @@
84980F2D1CB75B5E00CFAB58
/* BUYModelManagerProtocol.h in Headers */
,
84980F2D1CB75B5E00CFAB58
/* BUYModelManagerProtocol.h in Headers */
,
84D73C051CDD1945000F978A
/* BUYAddress.h in Headers */
,
84D73C051CDD1945000F978A
/* BUYAddress.h in Headers */
,
901931451BC5B9BC00D1134E
/* UIFont+BUYAdditions.h in Headers */
,
901931451BC5B9BC00D1134E
/* UIFont+BUYAdditions.h in Headers */
,
84B0A73B1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.h in Headers */
,
841ADE081CB6C942000004B0
/* NSDateFormatter+BUYAdditions.h in Headers */
,
841ADE081CB6C942000004B0
/* NSDateFormatter+BUYAdditions.h in Headers */
,
841ADE001CB6C942000004B0
/* NSArray+BUYAdditions.h in Headers */
,
841ADE001CB6C942000004B0
/* NSArray+BUYAdditions.h in Headers */
,
841ADE101CB6C942000004B0
/* NSDictionary+BUYAdditions.h in Headers */
,
841ADE101CB6C942000004B0
/* NSDictionary+BUYAdditions.h in Headers */
,
...
@@ -1461,6 +1512,7 @@
...
@@ -1461,6 +1512,7 @@
9019316A1BC5B9BC00D1134E
/* BUYSerializable.h in Headers */
,
9019316A1BC5B9BC00D1134E
/* BUYSerializable.h in Headers */
,
9A47CF041CE3A24600A6D5BA
/* BUYApplePayToken.h in Headers */
,
9A47CF041CE3A24600A6D5BA
/* BUYApplePayToken.h in Headers */
,
9019316B1BC5B9BC00D1134E
/* BUYProductVariant.h in Headers */
,
9019316B1BC5B9BC00D1134E
/* BUYProductVariant.h in Headers */
,
84B0A7391CE10ED900253EB0
/* BUYPaymentProvider.h in Headers */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
@@ -1481,6 +1533,7 @@
...
@@ -1481,6 +1533,7 @@
84DD12911CC63FE600A2442D
/* _BUYOrder.h in Headers */
,
84DD12911CC63FE600A2442D
/* _BUYOrder.h in Headers */
,
84DD12811CC63FE600A2442D
/* _BUYCart.h in Headers */
,
84DD12811CC63FE600A2442D
/* _BUYCart.h in Headers */
,
84DD12851CC63FE600A2442D
/* _BUYCollection.h in Headers */
,
84DD12851CC63FE600A2442D
/* _BUYCollection.h in Headers */
,
84B0A7401CE10F8100253EB0
/* BUYClient+Checkout.h in Headers */
,
84D73C021CDD1944000F978A
/* _BUYAddress.h in Headers */
,
84D73C021CDD1944000F978A
/* _BUYAddress.h in Headers */
,
84DD12891CC63FE600A2442D
/* _BUYImageLink.h in Headers */
,
84DD12891CC63FE600A2442D
/* _BUYImageLink.h in Headers */
,
84DD128D1CC63FE600A2442D
/* _BUYOption.h in Headers */
,
84DD128D1CC63FE600A2442D
/* _BUYOption.h in Headers */
,
...
@@ -1511,8 +1564,10 @@
...
@@ -1511,8 +1564,10 @@
BEB74A7D1B5564870005A300
/* BUYVariantSelectionViewController.h in Headers */
,
BEB74A7D1B5564870005A300
/* BUYVariantSelectionViewController.h in Headers */
,
BE10079B1B6165EC0031CEE7
/* BUYOptionValueCell.h in Headers */
,
BE10079B1B6165EC0031CEE7
/* BUYOptionValueCell.h in Headers */
,
BE9A64591B503CD40033E558
/* BUYImageLink.h in Headers */
,
BE9A64591B503CD40033E558
/* BUYImageLink.h in Headers */
,
84B0A7341CE10ED900253EB0
/* BUYPaymentController.h in Headers */
,
BE9A64681B503D080033E558
/* BUYOptionValue.h in Headers */
,
BE9A64681B503D080033E558
/* BUYOptionValue.h in Headers */
,
BE9A64661B503D010033E558
/* BUYShop.h in Headers */
,
BE9A64661B503D010033E558
/* BUYShop.h in Headers */
,
84B0A7301CE10ED900253EB0
/* BUYApplePayPaymentProvider.h in Headers */
,
BE9A644D1B503CA20033E558
/* BUYShippingRate.h in Headers */
,
BE9A644D1B503CA20033E558
/* BUYShippingRate.h in Headers */
,
BE9A646C1B503D180033E558
/* BUYApplePayAdditions.h in Headers */
,
BE9A646C1B503D180033E558
/* BUYApplePayAdditions.h in Headers */
,
906EAE431B836DE000976165
/* BUYTheme+Additions.h in Headers */
,
906EAE431B836DE000976165
/* BUYTheme+Additions.h in Headers */
,
...
@@ -1533,6 +1588,7 @@
...
@@ -1533,6 +1588,7 @@
84980F2C1CB75B5E00CFAB58
/* BUYModelManagerProtocol.h in Headers */
,
84980F2C1CB75B5E00CFAB58
/* BUYModelManagerProtocol.h in Headers */
,
84D73C031CDD1944000F978A
/* BUYAddress.h in Headers */
,
84D73C031CDD1944000F978A
/* BUYAddress.h in Headers */
,
841ADE131CB6C942000004B0
/* NSException+BUYAdditions.h in Headers */
,
841ADE131CB6C942000004B0
/* NSException+BUYAdditions.h in Headers */
,
84B0A73A1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.h in Headers */
,
841ADE031CB6C942000004B0
/* NSDate+BUYAdditions.h in Headers */
,
841ADE031CB6C942000004B0
/* NSDate+BUYAdditions.h in Headers */
,
841ADE071CB6C942000004B0
/* NSDateFormatter+BUYAdditions.h in Headers */
,
841ADE071CB6C942000004B0
/* NSDateFormatter+BUYAdditions.h in Headers */
,
841ADDFF1CB6C942000004B0
/* NSArray+BUYAdditions.h in Headers */
,
841ADDFF1CB6C942000004B0
/* NSArray+BUYAdditions.h in Headers */
,
...
@@ -1579,6 +1635,7 @@
...
@@ -1579,6 +1635,7 @@
BE9A64651B503CFE0033E558
/* BUYSerializable.h in Headers */
,
BE9A64651B503CFE0033E558
/* BUYSerializable.h in Headers */
,
9A47CF031CE3A24600A6D5BA
/* BUYApplePayToken.h in Headers */
,
9A47CF031CE3A24600A6D5BA
/* BUYApplePayToken.h in Headers */
,
BE9A64631B503CF70033E558
/* BUYProductVariant.h in Headers */
,
BE9A64631B503CF70033E558
/* BUYProductVariant.h in Headers */
,
84B0A7381CE10ED900253EB0
/* BUYPaymentProvider.h in Headers */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
@@ -1790,6 +1847,7 @@
...
@@ -1790,6 +1847,7 @@
901930E91BC5B9BC00D1134E
/* BUYProductVariant.m in Sources */
,
901930E91BC5B9BC00D1134E
/* BUYProductVariant.m in Sources */
,
84D9154E1CC03F1600D334FB
/* BUYManagedObject.m in Sources */
,
84D9154E1CC03F1600D334FB
/* BUYManagedObject.m in Sources */
,
901930EA1BC5B9BC00D1134E
/* BUYProductViewController.m in Sources */
,
901930EA1BC5B9BC00D1134E
/* BUYProductViewController.m in Sources */
,
84B0A7331CE10ED900253EB0
/* BUYApplePayPaymentProvider.m in Sources */
,
841ADE021CB6C942000004B0
/* NSArray+BUYAdditions.m in Sources */
,
841ADE021CB6C942000004B0
/* NSArray+BUYAdditions.m in Sources */
,
901930EC1BC5B9BC00D1134E
/* BUYError.m in Sources */
,
901930EC1BC5B9BC00D1134E
/* BUYError.m in Sources */
,
841ADE0E1CB6C942000004B0
/* NSDecimalNumber+BUYAdditions.m in Sources */
,
841ADE0E1CB6C942000004B0
/* NSDecimalNumber+BUYAdditions.m in Sources */
,
...
@@ -1831,6 +1889,7 @@
...
@@ -1831,6 +1889,7 @@
901931081BC5B9BC00D1134E
/* BUYRuntime.m in Sources */
,
901931081BC5B9BC00D1134E
/* BUYRuntime.m in Sources */
,
84DD12C21CC63FEE00A2442D
/* _BUYCheckout.m in Sources */
,
84DD12C21CC63FEE00A2442D
/* _BUYCheckout.m in Sources */
,
901931091BC5B9BC00D1134E
/* BUYCart.m in Sources */
,
901931091BC5B9BC00D1134E
/* BUYCart.m in Sources */
,
84B0A73D1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.m in Sources */
,
9019310A1BC5B9BC00D1134E
/* BUYPaymentButton.m in Sources */
,
9019310A1BC5B9BC00D1134E
/* BUYPaymentButton.m in Sources */
,
9A47CF061CE3A24600A6D5BA
/* BUYApplePayToken.m in Sources */
,
9A47CF061CE3A24600A6D5BA
/* BUYApplePayToken.m in Sources */
,
84D915521CC03F1600D334FB
/* BUYModelManager.m in Sources */
,
84D915521CC03F1600D334FB
/* BUYModelManager.m in Sources */
,
...
@@ -1864,7 +1923,9 @@
...
@@ -1864,7 +1923,9 @@
841ADE061CB6C942000004B0
/* NSDate+BUYAdditions.m in Sources */
,
841ADE061CB6C942000004B0
/* NSDate+BUYAdditions.m in Sources */
,
901931181BC5B9BC00D1134E
/* BUYGradientView.m in Sources */
,
901931181BC5B9BC00D1134E
/* BUYGradientView.m in Sources */
,
901931191BC5B9BC00D1134E
/* BUYViewController.m in Sources */
,
901931191BC5B9BC00D1134E
/* BUYViewController.m in Sources */
,
84B0A7431CE10F8100253EB0
/* BUYClient+Checkout.m in Sources */
,
9019311A1BC5B9BC00D1134E
/* BUYImageKit.m in Sources */
,
9019311A1BC5B9BC00D1134E
/* BUYImageKit.m in Sources */
,
84B0A7371CE10ED900253EB0
/* BUYPaymentController.m in Sources */
,
9019311C1BC5B9BC00D1134E
/* BUYOption.m in Sources */
,
9019311C1BC5B9BC00D1134E
/* BUYOption.m in Sources */
,
84D73C081CDD194D000F978A
/* _BUYAddress.m in Sources */
,
84D73C081CDD194D000F978A
/* _BUYAddress.m in Sources */
,
9019311D1BC5B9BC00D1134E
/* BUYClient.m in Sources */
,
9019311D1BC5B9BC00D1134E
/* BUYClient.m in Sources */
,
...
@@ -1907,6 +1968,7 @@
...
@@ -1907,6 +1968,7 @@
90F593071B0D5F4C0026B382
/* BUYCheckoutTest.m in Sources */
,
90F593071B0D5F4C0026B382
/* BUYCheckoutTest.m in Sources */
,
90F593091B0D5F4C0026B382
/* BUYClientTest.m in Sources */
,
90F593091B0D5F4C0026B382
/* BUYClientTest.m in Sources */
,
90F5930B1B0D5F4C0026B382
/* BUYObjectTests.m in Sources */
,
90F5930B1B0D5F4C0026B382
/* BUYObjectTests.m in Sources */
,
8443E2D11CE2917500EA08D4
/* BUYPaymentProviderTests.m in Sources */
,
90F593041B0D5F4C0026B382
/* BUYIntegrationTest.m in Sources */
,
90F593041B0D5F4C0026B382
/* BUYIntegrationTest.m in Sources */
,
9A102D1B1CDD1F960026CC43
/* BUYErrorTests.m in Sources */
,
9A102D1B1CDD1F960026CC43
/* BUYErrorTests.m in Sources */
,
90F593081B0D5F4C0026B382
/* BUYClientTest_Storefront.m in Sources */
,
90F593081B0D5F4C0026B382
/* BUYClientTest_Storefront.m in Sources */
,
...
@@ -1945,6 +2007,7 @@
...
@@ -1945,6 +2007,7 @@
BE9A64641B503CFB0033E558
/* BUYProductVariant.m in Sources */
,
BE9A64641B503CFB0033E558
/* BUYProductVariant.m in Sources */
,
84D9154D1CC03F1600D334FB
/* BUYManagedObject.m in Sources */
,
84D9154D1CC03F1600D334FB
/* BUYManagedObject.m in Sources */
,
BEB74A2E1B554E8B0005A300
/* BUYProductViewController.m in Sources */
,
BEB74A2E1B554E8B0005A300
/* BUYProductViewController.m in Sources */
,
84B0A7321CE10ED900253EB0
/* BUYApplePayPaymentProvider.m in Sources */
,
841ADE011CB6C942000004B0
/* NSArray+BUYAdditions.m in Sources */
,
841ADE011CB6C942000004B0
/* NSArray+BUYAdditions.m in Sources */
,
BE4734101B66C4EF00AA721A
/* BUYError.m in Sources */
,
BE4734101B66C4EF00AA721A
/* BUYError.m in Sources */
,
841ADE0D1CB6C942000004B0
/* NSDecimalNumber+BUYAdditions.m in Sources */
,
841ADE0D1CB6C942000004B0
/* NSDecimalNumber+BUYAdditions.m in Sources */
,
...
@@ -1986,6 +2049,7 @@
...
@@ -1986,6 +2049,7 @@
BE9A646F1B503D210033E558
/* BUYRuntime.m in Sources */
,
BE9A646F1B503D210033E558
/* BUYRuntime.m in Sources */
,
84DD12B41CC63FEE00A2442D
/* _BUYCheckout.m in Sources */
,
84DD12B41CC63FEE00A2442D
/* _BUYCheckout.m in Sources */
,
BE9A644A1B503C980033E558
/* BUYCart.m in Sources */
,
BE9A644A1B503C980033E558
/* BUYCart.m in Sources */
,
84B0A73C1CE10ED900253EB0
/* BUYWebCheckoutPaymentProvider.m in Sources */
,
BE9A64831B503DB10033E558
/* BUYPaymentButton.m in Sources */
,
BE9A64831B503DB10033E558
/* BUYPaymentButton.m in Sources */
,
9A47CF051CE3A24600A6D5BA
/* BUYApplePayToken.m in Sources */
,
9A47CF051CE3A24600A6D5BA
/* BUYApplePayToken.m in Sources */
,
84D915511CC03F1600D334FB
/* BUYModelManager.m in Sources */
,
84D915511CC03F1600D334FB
/* BUYModelManager.m in Sources */
,
...
@@ -2019,7 +2083,9 @@
...
@@ -2019,7 +2083,9 @@
841ADE051CB6C942000004B0
/* NSDate+BUYAdditions.m in Sources */
,
841ADE051CB6C942000004B0
/* NSDate+BUYAdditions.m in Sources */
,
BEB74A661B5564030005A300
/* BUYGradientView.m in Sources */
,
BEB74A661B5564030005A300
/* BUYGradientView.m in Sources */
,
BE9A64811B503D9E0033E558
/* BUYViewController.m in Sources */
,
BE9A64811B503D9E0033E558
/* BUYViewController.m in Sources */
,
84B0A7421CE10F8100253EB0
/* BUYClient+Checkout.m in Sources */
,
900E7C851B5DA559006F3C81
/* BUYImageKit.m in Sources */
,
900E7C851B5DA559006F3C81
/* BUYImageKit.m in Sources */
,
84B0A7361CE10ED900253EB0
/* BUYPaymentController.m in Sources */
,
BE9A64601B503CEC0033E558
/* BUYOption.m in Sources */
,
BE9A64601B503CEC0033E558
/* BUYOption.m in Sources */
,
84D73C061CDD194D000F978A
/* _BUYAddress.m in Sources */
,
84D73C061CDD194D000F978A
/* _BUYAddress.m in Sources */
,
BE9A64481B503C900033E558
/* BUYClient.m in Sources */
,
BE9A64481B503C900033E558
/* BUYClient.m in Sources */
,
...
...
Mobile Buy SDK/Mobile Buy SDK/Buy.h
View file @
53102c3a
...
@@ -57,8 +57,14 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
...
@@ -57,8 +57,14 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
#import <Buy/BUYApplePayAdditions.h>
#import <Buy/BUYApplePayAdditions.h>
#import <Buy/BUYApplePayHelpers.h>
#import <Buy/BUYApplePayHelpers.h>
#import <Buy/BUYApplePayPaymentProvider.h>
#import <Buy/BUYPaymentController.h>
#import <Buy/BUYPaymentProvider.h>
#import <Buy/BUYWebCheckoutPaymentProvider.h>
#import <Buy/BUYClient.h>
#import <Buy/BUYClient.h>
#import <Buy/BUYClient+Customers.h>
#import <Buy/BUYClient+Customers.h>
#import <Buy/BUYClient+Checkout.h>
#import <Buy/BUYError.h>
#import <Buy/BUYError.h>
#import <Buy/BUYError+BUYAdditions.h>
#import <Buy/BUYError+BUYAdditions.h>
#import <Buy/BUYManagedObject.h>
#import <Buy/BUYManagedObject.h>
...
@@ -76,6 +82,7 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
...
@@ -76,6 +82,7 @@ FOUNDATION_EXPORT const unsigned char BuyVersionString[];
#import <Buy/BUYViewController.h>
#import <Buy/BUYViewController.h>
#import <Buy/NSArray+BUYAdditions.h>
#import <Buy/NSArray+BUYAdditions.h>
#import <Buy/NSDate+BUYAdditions.h>
#import <Buy/NSDateFormatter+BUYAdditions.h>
#import <Buy/NSDateFormatter+BUYAdditions.h>
#import <Buy/NSDecimalNumber+BUYAdditions.h>
#import <Buy/NSDecimalNumber+BUYAdditions.h>
#import <Buy/NSDictionary+BUYAdditions.h>
#import <Buy/NSDictionary+BUYAdditions.h>
...
...
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYApplePayPaymentProvider.h
0 → 100644
View file @
53102c3a
//
// BUYApplePayPaymentProvider.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import
UIKit
;
#import "BUYPaymentProvider.h"
NS_ASSUME_NONNULL_BEGIN
extern
NSString
*
const
BUYApplePayPaymentProviderId
;
@class
BUYClient
;
@interface
BUYApplePayPaymentProvider
:
NSObject
<
BUYPaymentProvider
>
/**
* Initializer for Apple Pay payment provider
*
* @param client a `BUYClient`
* @param merchantID the merchant ID for Apple Pay
*
* @return an instance of `BUYApplePayPaymentProvider`
*/
-
(
instancetype
)
initWithClient
:
(
BUYClient
*
)
client
merchantID
:
(
NSString
*
)
merchantID
NS_DESIGNATED_INITIALIZER
;
-
(
instancetype
)
init
NS_UNAVAILABLE
;
/**
* The supported credit card payment networks. Default values:
* iOS 8.3: PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa.
* iOS 9.0: PKPaymentNetworkAmex, PKPaymentNetworkDiscover, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa.
*/
@property
(
nonatomic
,
copy
)
NSArray
*
supportedNetworks
;
/**
* The merchant ID required for Apple Pay
*/
@property
(
nonatomic
,
copy
,
readonly
)
NSString
*
merchantID
;
/**
* If the merchantId is set and the device support Apple Pay but no credit card is present this allows the user to add a payment pass to the Wallet.
* The user is given the option to add a payment pass or continue with web checkout. Default is set to true. The Set Up Apple Pay button will, however
* still only show if [PKAddPaymentPassViewController canAddPaymentPass] returns true, merchantId is set and the app is running iOS 9.0 and above.
*/
@property
(
nonatomic
,
assign
)
BOOL
allowApplePaySetup
;
/**
* Whether the device is setup to show the Apple Pay setup sheet.
* `allowApplePaySetup` must be set to YES, and the `merchantId` must also be set in addition to the
* device settings for this method to return YES.
*
* @return YES if the Setup Apple Pay button should be shown
*/
-
(
BOOL
)
canShowApplePaySetup
;
@end
NS_ASSUME_NONNULL_END
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYApplePayPaymentProvider.m
0 → 100644
View file @
53102c3a
//
// BUYApplePayPaymentProvider.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import
PassKit
;
#import "BUYApplePayPaymentProvider.h"
#import "BUYCheckout.h"
#import "BUYApplePayHelpers.h"
#import "BUYApplePayAdditions.h"
#import "BUYShop.h"
#import "BUYClient+Checkout.h"
NSString
*
const
BUYApplePayPaymentProviderId
=
@"BUYApplePayPaymentProviderId"
;
@interface
BUYApplePayPaymentProvider
()
<
PKPaymentAuthorizationViewControllerDelegate
>
@property
(
nonatomic
,
strong
)
BUYShop
*
shop
;
@property
(
nonatomic
,
strong
)
BUYApplePayHelpers
*
applePayHelper
;
@property
(
nonatomic
,
strong
)
BUYCheckout
*
checkout
;
@property
(
nonatomic
,
assign
)
PKPaymentAuthorizationStatus
paymentAuthorizationStatus
;
@property
(
nonatomic
,
strong
)
BUYClient
*
client
;
@property
(
nonatomic
,
assign
)
BOOL
inProgress
;
@end
@implementation
BUYApplePayPaymentProvider
@synthesize
delegate
;
-
(
instancetype
)
initWithClient
:(
BUYClient
*
)
client
merchantID
:(
NSString
*
)
merchantID
{
NSParameterAssert
(
client
);
NSParameterAssert
(
merchantID
);
self
=
[
super
init
];
if
(
self
)
{
_client
=
client
;
_merchantID
=
merchantID
;
_allowApplePaySetup
=
YES
;
}
return
self
;
}
-
(
NSUInteger
)
hash
{
return
self
.
identifier
.
hash
;
}
-
(
BOOL
)
isEqual
:
(
id
)
object
{
return
([
object
isKindOfClass
:[
self
class
]]
&&
[
self
.
identifier
isEqual
:[
object
identifier
]]);
}
-
(
NSString
*
)
identifier
{
return
BUYApplePayPaymentProviderId
;
}
-
(
void
)
startCheckout
:
(
BUYCheckout
*
)
checkout
{
if
(
self
.
isInProgress
)
{
return
;
}
self
.
inProgress
=
YES
;
self
.
checkout
=
checkout
;
// Default to the failure state, since cancelling a payment would not update the state and thus appear as a success
self
.
paymentAuthorizationStatus
=
PKPaymentAuthorizationStatusFailure
;
// download the shop
dispatch_group_t
group
=
dispatch_group_create
();
dispatch_group_enter
(
group
);
[
self
.
client
getShop
:
^
(
BUYShop
*
theShop
,
NSError
*
error
)
{
if
(
error
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailCheckoutWithError
:
error
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailCheckoutNotificationKey
object
:
self
];
}
else
{
self
.
shop
=
theShop
;
}
dispatch_group_leave
(
group
);
}];
dispatch_group_enter
(
group
);
[
self
.
client
handleCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
if
(
error
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailCheckoutWithError
:
error
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailCheckoutNotificationKey
object
:
self
];
}
else
{
self
.
checkout
=
checkout
;
}
dispatch_group_leave
(
group
);
}];
// create the checkout on Shopify
dispatch_group_notify
(
group
,
dispatch_get_main_queue
(),
^
{
if
(
self
.
shop
&&
self
.
checkout
)
{
[
self
proceedWithApplePay
];
}
else
{
[
self
cancelCheckout
];
}
});
}
-
(
void
)
cancelCheckout
{
self
.
inProgress
=
NO
;
self
.
checkout
=
nil
;
}
-
(
BOOL
)
isAvailable
{
// checks if the client is setup to use Apple Pay
// checks if device hardware is capable of using Apple Pay
// checks if the device has a payment card setup
return
(
self
.
merchantID
.
length
&&
[
PKPaymentAuthorizationViewController
canMakePayments
]
&&
[
PKPaymentAuthorizationViewController
canMakePaymentsUsingNetworks
:
self
.
supportedNetworks
]);
}
-
(
BOOL
)
canShowApplePaySetup
{
PKPassLibrary
*
passLibrary
=
[[
PKPassLibrary
alloc
]
init
];
if
([
passLibrary
respondsToSelector
:
@selector
(
canAddPaymentPassWithPrimaryAccountIdentifier
:)]
&&
// Check if the device can add a payment pass
[
PKPaymentAuthorizationViewController
canMakePayments
]
&&
// Check that Apple Pay is enabled for the merchant
[
self
.
merchantID
length
])
{
return
YES
;
}
else
{
return
NO
;
}
}
-
(
void
)
proceedWithApplePay
{
self
.
applePayHelper
=
[[
BUYApplePayHelpers
alloc
]
initWithClient
:
self
.
client
checkout
:
self
.
checkout
shop
:
self
.
shop
];
PKPaymentRequest
*
request
=
[
self
paymentRequest
];
request
.
paymentSummaryItems
=
[
self
.
checkout
buy_summaryItemsWithShopName
:
self
.
shop
.
name
];
PKPaymentAuthorizationViewController
*
controller
=
[[
PKPaymentAuthorizationViewController
alloc
]
initWithPaymentRequest
:
request
];
if
(
controller
)
{
controller
.
delegate
=
self
;
[
self
.
delegate
paymentProvider
:
self
wantsControllerPresented
:
controller
];
}
else
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailCheckoutWithError
:
nil
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailCheckoutNotificationKey
object
:
self
];
}
}
-
(
PKPaymentRequest
*
)
paymentRequest
{
PKPaymentRequest
*
paymentRequest
=
[[
PKPaymentRequest
alloc
]
init
];
[
paymentRequest
setMerchantIdentifier
:
self
.
merchantID
];
[
paymentRequest
setRequiredBillingAddressFields
:
PKAddressFieldAll
];
[
paymentRequest
setRequiredShippingAddressFields
:
self
.
checkout
.
requiresShipping
?
PKAddressFieldAll
:
PKAddressFieldEmail
|
PKAddressFieldPhone
];
[
paymentRequest
setSupportedNetworks
:
self
.
supportedNetworks
];
[
paymentRequest
setMerchantCapabilities
:
PKMerchantCapability3DS
];
[
paymentRequest
setCountryCode
:
self
.
shop
.
country
];
[
paymentRequest
setCurrencyCode
:
self
.
shop
.
currency
];
return
paymentRequest
;
}
-
(
NSArray
*
)
supportedNetworks
{
if
(
_supportedNetworks
==
nil
)
{
if
(
&
PKPaymentNetworkDiscover
!=
NULL
)
{
self
.
supportedNetworks
=
@[
PKPaymentNetworkAmex
,
PKPaymentNetworkMasterCard
,
PKPaymentNetworkVisa
,
PKPaymentNetworkDiscover
];
}
else
{
self
.
supportedNetworks
=
@[
PKPaymentNetworkAmex
,
PKPaymentNetworkMasterCard
,
PKPaymentNetworkVisa
];
}
}
return
_supportedNetworks
;
}
#pragma mark - PKPaymentAuthorizationViewControllerDelegate Methods
-
(
void
)
paymentAuthorizationViewController
:
(
PKPaymentAuthorizationViewController
*
)
controller
didAuthorizePayment
:
(
PKPayment
*
)
payment
completion
:
(
void
(
^
)(
PKPaymentAuthorizationStatus
status
))
completion
{
[
self
.
applePayHelper
paymentAuthorizationViewController
:
controller
didAuthorizePayment
:
payment
completion
:^
(
PKPaymentAuthorizationStatus
status
)
{
self
.
paymentAuthorizationStatus
=
status
;
switch
(
status
)
{
case
PKPaymentAuthorizationStatusFailure
:
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailCheckoutWithError
:
self
.
applePayHelper
.
lastError
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailCheckoutNotificationKey
object
:
self
];
break
;
case
PKPaymentAuthorizationStatusInvalidShippingPostalAddress
:
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailToUpdateCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailToUpdateCheckoutWithError
:
self
.
applePayHelper
.
lastError
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailToUpdateCheckoutNotificationKey
object
:
self
];
break
;
default
:
break
;
}
completion
(
status
);
}];
}
-
(
void
)
paymentAuthorizationViewControllerDidFinish
:
(
PKPaymentAuthorizationViewController
*
)
controller
{
[
self
.
delegate
paymentProviderWantsControllerDismissed
:
self
];
BUYStatus
status
=
(
self
.
paymentAuthorizationStatus
==
PKPaymentAuthorizationStatusSuccess
)
?
BUYStatusComplete
:
BUYStatusFailed
;
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didCompleteCheckout
:
withStatus
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didCompleteCheckout
:
self
.
checkout
withStatus
:
status
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidCompleteCheckoutNotificationKey
object
:
self
];
self
.
inProgress
=
NO
;
}
-
(
void
)
paymentAuthorizationViewController
:
(
PKPaymentAuthorizationViewController
*
)
controller
didSelectShippingMethod
:
(
nonnull
PKShippingMethod
*
)
shippingMethod
completion
:
(
nonnull
void
(
^
)(
PKPaymentAuthorizationStatus
,
NSArray
<
PKPaymentSummaryItem
*>
*
_Nonnull
))
completion
{
[
self
.
applePayHelper
paymentAuthorizationViewController
:
controller
didSelectShippingMethod
:
shippingMethod
completion
:^
(
PKPaymentAuthorizationStatus
status
,
NSArray
<
PKPaymentSummaryItem
*>
*
_Nonnull
summaryItems
)
{
if
(
status
==
PKPaymentAuthorizationStatusInvalidShippingPostalAddress
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailToUpdateCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailToUpdateCheckoutWithError
:
self
.
applePayHelper
.
lastError
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailToUpdateCheckoutNotificationKey
object
:
self
];
}
completion
(
status
,
summaryItems
);
}];
}
-
(
void
)
paymentAuthorizationViewController
:
(
PKPaymentAuthorizationViewController
*
)
controller
didSelectShippingAddress
:
(
ABRecordRef
)
address
completion
:
(
void
(
^
)(
PKPaymentAuthorizationStatus
,
NSArray
<
PKShippingMethod
*>
*
_Nonnull
,
NSArray
<
PKPaymentSummaryItem
*>
*
_Nonnull
))
completion
{
[
self
.
applePayHelper
paymentAuthorizationViewController
:
controller
didSelectShippingAddress
:
address
completion
:^
(
PKPaymentAuthorizationStatus
status
,
NSArray
<
PKShippingMethod
*>
*
_Nonnull
shippingMethods
,
NSArray
<
PKPaymentSummaryItem
*>
*
_Nonnull
summaryItems
)
{
if
(
status
==
PKPaymentAuthorizationStatusInvalidShippingPostalAddress
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailToUpdateCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailToUpdateCheckoutWithError
:
self
.
applePayHelper
.
lastError
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailToUpdateCheckoutNotificationKey
object
:
self
];
}
completion
(
status
,
shippingMethods
,
summaryItems
);
}];
}
-
(
void
)
paymentAuthorizationViewController
:
(
PKPaymentAuthorizationViewController
*
)
controller
didSelectShippingContact
:
(
PKContact
*
)
contact
completion
:
(
void
(
^
)(
PKPaymentAuthorizationStatus
,
NSArray
<
PKShippingMethod
*>
*
_Nonnull
,
NSArray
<
PKPaymentSummaryItem
*>
*
_Nonnull
))
completion
{
[
self
.
applePayHelper
paymentAuthorizationViewController
:
controller
didSelectShippingContact
:
contact
completion
:^
(
PKPaymentAuthorizationStatus
status
,
NSArray
<
PKShippingMethod
*>
*
_Nonnull
shippingMethods
,
NSArray
<
PKPaymentSummaryItem
*>
*
_Nonnull
summaryItems
)
{
if
(
status
==
PKPaymentAuthorizationStatusInvalidShippingPostalAddress
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailToUpdateCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailToUpdateCheckoutWithError
:
self
.
applePayHelper
.
lastError
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailToUpdateCheckoutNotificationKey
object
:
self
];
}
completion
(
status
,
shippingMethods
,
summaryItems
);
}];
}
@end
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYClient+Checkout.h
0 → 100644
View file @
53102c3a
//
// BUYClient+Checkout.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <Buy/Buy.h>
NS_ASSUME_NONNULL_BEGIN
@interface
BUYClient
(
Checkout
)
-
(
NSURLSessionDataTask
*
)
handleCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
completion
;
@end
NS_ASSUME_NONNULL_END
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYClient+Checkout.m
0 → 100644
View file @
53102c3a
//
// BUYClient+Checkout.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "BUYClient+Checkout.h"
@implementation
BUYClient
(
Checkout
)
-
(
NSURLSessionDataTask
*
)
handleCheckout
:(
BUYCheckout
*
)
checkout
completion
:(
BUYDataCheckoutBlock
)
completion
{
if
([
checkout
hasToken
])
{
return
[
self
updateCheckout
:
checkout
completion
:
completion
];
}
else
{
return
[
self
createCheckout
:
checkout
completion
:
completion
];
}
}
@end
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYPaymentController.h
0 → 100644
View file @
53102c3a
//
// BUYPaymentController.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import
Foundation
;
#import "BUYPaymentProvider.h"
NS_ASSUME_NONNULL_BEGIN
@interface
BUYPaymentController
:
NSObject
/**
* The registered payment providers
*/
@property
(
nonatomic
,
strong
,
readonly
)
NSOrderedSet
<
id
<
BUYPaymentProvider
>>
*
providers
;
/**
* Register a payment provider
*
* @param paymentProvider a payment provider
*
* @note can only add 1 provider per type
*/
-
(
void
)
addPaymentProvider
:(
id
<
BUYPaymentProvider
>
)
paymentProvider
;
/**
* Convenience method to retrieve a BUYPaymentProvider by the identifier
*
* @param type The identifier for the payment provider
*
* @return The payment provider matching the given identifier
*/
-
(
id
<
BUYPaymentProvider
>
_Nullable
)
providerForType
:(
NSString
*
)
type
;
/**
* Start a checkout
*
* @param checkout the `BUYCheckout` to start
* @param type the type of payment provider to use
*/
-
(
void
)
startCheckout
:(
BUYCheckout
*
)
checkout
withProviderType
:(
NSString
*
)
typeIdentifier
;
@end
NS_ASSUME_NONNULL_END
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYPaymentController.m
0 → 100644
View file @
53102c3a
//
// BUYPaymentController.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "BUYPaymentController.h"
NSString
*
const
BUYPaymentProviderWillStartCheckoutNotificationKey
=
@"BUYPaymentProviderWillStartCheckoutNotificationKey"
;
NSString
*
const
BUYPaymentProviderDidDismissCheckoutNotificationKey
=
@"BUYPaymentProviderDidDismissCheckoutNotificationKey"
;
NSString
*
const
BUYPaymentProviderDidFailToUpdateCheckoutNotificationKey
=
@"BUYPaymentProviderDidFailToUpdateCheckoutNotificationKey"
;
NSString
*
const
BUYPaymentProviderDidFailCheckoutNotificationKey
=
@"BUYPaymentProviderDidFailCheckoutNotificationKey"
;
NSString
*
const
BUYPaymentProviderDidCompleteCheckoutNotificationKey
=
@"BUYPaymentProviderDidCompleteCheckoutNotificationKey"
;
@interface
BUYPaymentController
()
@property
(
nonatomic
,
strong
)
NSMutableOrderedSet
<
id
<
BUYPaymentProvider
>>
*
mutableProviders
;
@end
@implementation
BUYPaymentController
-
(
void
)
startCheckout
:(
BUYCheckout
*
)
checkout
withProviderType
:(
NSString
*
)
typeIdentifier
;
{
id
<
BUYPaymentProvider
>
provider
=
[
self
providerForType
:
typeIdentifier
];
[
provider
startCheckout
:
checkout
];
}
-
(
void
)
addPaymentProvider
:
(
id
<
BUYPaymentProvider
>
)
paymentProvider
{
if
([
self
.
mutableProviders
containsObject
:
paymentProvider
])
{
NSLog
(
@"Payment provider %@ has already been added"
,
paymentProvider
.
identifier
);
}
[
self
.
mutableProviders
addObject
:
paymentProvider
];
}
-
(
NSSet
<
id
<
BUYPaymentProvider
>>
*
)
providers
{
return
[
self
.
mutableProviders
copy
];
}
-
(
NSMutableOrderedSet
*
)
mutableProviders
{
if
(
_mutableProviders
==
nil
)
{
_mutableProviders
=
[[
NSMutableOrderedSet
alloc
]
init
];
}
return
_mutableProviders
;
}
-
(
id
<
BUYPaymentProvider
>
)
providerForType
:
(
NSString
*
)
type
{
for
(
id
<
BUYPaymentProvider
>
provider
in
self
.
mutableProviders
)
{
if
([
provider
.
identifier
isEqualToString
:
type
])
{
return
provider
;
}
}
return
nil
;
}
@end
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYPaymentProvider.h
0 → 100644
View file @
53102c3a
//
// BUYPaymentProvider.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import
UIKit
;
#import "BUYClient.h"
NS_ASSUME_NONNULL_BEGIN
@class
BUYCheckout
;
@protocol
BUYPaymentProvider
;
extern
NSString
*
const
BUYPaymentProviderWillStartCheckoutNotificationKey
;
extern
NSString
*
const
BUYPaymentProviderDidDismissCheckoutNotificationKey
;
extern
NSString
*
const
BUYPaymentProviderDidFailToUpdateCheckoutNotificationKey
;
extern
NSString
*
const
BUYPaymentProviderDidFailCheckoutNotificationKey
;
extern
NSString
*
const
BUYPaymentProviderDidCompleteCheckoutNotificationKey
;
@protocol
BUYPaymentProviderDelegate
<
NSObject
>
@required
/**
* Called when a view controller needs to be presented
*
* @param provider the `BUYPaymentProvider`
* @param controller the `UIViewController` to be presented
*/
-
(
void
)
paymentProvider
:
(
id
<
BUYPaymentProvider
>
)
provider
wantsControllerPresented
:
(
UIViewController
*
)
controller
;
/**
* Called when the view controller
*
* @param provider the `BUYPaymentProvider`
*/
-
(
void
)
paymentProviderWantsControllerDismissed
:(
id
<
BUYPaymentProvider
>
)
provider
;
@optional
/**
* Called when the checkout process has started
*
* @param provider the `BUYPaymentProvider`
*/
-
(
void
)
paymentProviderWillStartCheckout
:
(
id
<
BUYPaymentProvider
>
)
provider
;
/**
* Called when the checkout has been dismissed
*
* @param provider the `BUYPaymentProvider`
*/
-
(
void
)
paymentProviderDidDismissCheckout
:(
id
<
BUYPaymentProvider
>
)
provider
;
/**
* Called when a checkout failed to update
*
* @param provider the `BUYPaymentProvider`
* @param error the optional `NSError`
*/
-
(
void
)
paymentProvider
:(
id
<
BUYPaymentProvider
>
)
provider
didFailToUpdateCheckoutWithError
:(
NSError
*
)
error
;
/**
* Called when the checkout failed
*
* @param provider the `BUYPaymentProvider`
* @param error the optional `NSError`
*/
-
(
void
)
paymentProvider
:(
id
<
BUYPaymentProvider
>
)
provider
didFailCheckoutWithError
:(
NSError
*
_Nullable
)
error
;
/**
* Called when the checkout has completed
*
* @param provider the `BUYPaymentProvider`
* @param checkout the `BUYCheckout`
* @param status the `BUYStatus` of the checkout
*/
-
(
void
)
paymentProvider
:(
id
<
BUYPaymentProvider
>
)
provider
didCompleteCheckout
:(
BUYCheckout
*
)
checkout
withStatus
:(
BUYStatus
)
status
;
@end
@protocol
BUYPaymentProvider
<
NSObject
>
/**
* Starts the checkout process
*
* @param checkout the `BUYCheckout`
*/
-
(
void
)
startCheckout
:
(
BUYCheckout
*
)
checkout
;
/**
* Clears the current checkout in progress
*/
-
(
void
)
cancelCheckout
;
/**
* The payment type identifier
*/
@property
(
nonatomic
,
readonly
)
NSString
*
identifier
;
/**
* The checkout object. If checkout has started, the checkout token will be set.
*/
@property
(
nonatomic
,
readonly
)
BUYCheckout
*
checkout
;
/**
* Whether the payment provider is currently available given the current device and configuration of the `BUYPaymentProvider`
*/
@property
(
nonatomic
,
readonly
,
getter
=
isAvailable
)
BOOL
available
;
/**
* Returns YES if the checkout is currently in progress. `startPaymentForCheckout` should not be called when a checkout is already in progress
*/
@property
(
nonatomic
,
readonly
,
getter
=
isInProgress
)
BOOL
inProgress
;
/**
* Delegate to receive callback messages
*/
@property
(
nonatomic
,
weak
)
id
<
BUYPaymentProviderDelegate
>
delegate
;
@end
NS_ASSUME_NONNULL_END
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYWebCheckoutPaymentProvider.h
0 → 100644
View file @
53102c3a
//
// BUYWebCheckoutPaymentProvider.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <Foundation/Foundation.h>
#import "BUYPaymentProvider.h"
NS_ASSUME_NONNULL_BEGIN
extern
NSString
*
BUYSafariCallbackURLNotification
;
extern
NSString
*
BUYURLKey
;
extern
NSString
*
const
BUYWebPaymentProviderId
;
@interface
BUYWebCheckoutPaymentProvider
:
NSObject
<
BUYPaymentProvider
>
/**
* Web payment provider
*
* @param client a `BUYClient`
*
* @return an instance of `BUYWebCheckoutPaymentProvider`
*/
-
(
instancetype
)
initWithClient
:
(
BUYClient
*
)
client
NS_DESIGNATED_INITIALIZER
;
-
(
instancetype
)
init
NS_UNAVAILABLE
;
@end
NS_ASSUME_NONNULL_END
Mobile Buy SDK/Mobile Buy SDK/Payment Providers/BUYWebCheckoutPaymentProvider.m
0 → 100644
View file @
53102c3a
//
// BUYWebCheckoutPaymentProvider.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "BUYWebCheckoutPaymentProvider.h"
#import "BUYCheckout.h"
#import "BUYClient+Checkout.h"
@import
SafariServices
;
NSString
*
BUYSafariCallbackURLNotification
=
@"kBUYSafariCallbackURLNotification"
;
NSString
*
BUYURLKey
=
@"url"
;
NSString
*
const
BUYWebPaymentProviderId
=
@"BUYWebPaymentProviderId"
;
static
NSString
*
const
WebCheckoutCustomerAccessToken
=
@"customer_access_token"
;
@interface
BUYWebCheckoutPaymentProvider
()
<
SFSafariViewControllerDelegate
>
@property
(
nonatomic
,
strong
)
BUYCheckout
*
checkout
;
@property
(
nonatomic
,
strong
)
BUYClient
*
client
;
@end
@implementation
BUYWebCheckoutPaymentProvider
@synthesize
delegate
;
-
(
instancetype
)
initWithClient
:(
BUYClient
*
)
client
{
NSParameterAssert
(
client
);
self
=
[
super
init
];
if
(
self
)
{
_client
=
client
;
}
return
self
;
}
-
(
BOOL
)
isInProgress
{
return
(
self
.
checkout
!=
nil
);
}
-
(
NSUInteger
)
hash
{
return
self
.
identifier
.
hash
;
}
-
(
BOOL
)
isEqual
:
(
id
)
object
{
return
([
object
isKindOfClass
:[
self
class
]]
&&
[
self
.
identifier
isEqual
:[
object
identifier
]]);
}
-
(
NSString
*
)
identifier
{
return
BUYWebPaymentProviderId
;
}
-
(
void
)
startCheckout
:
(
BUYCheckout
*
)
checkout
{
if
(
self
.
isInProgress
)
{
[[
NSException
exceptionWithName
:
NSInternalInconsistencyException
reason
:[
NSString
stringWithFormat
:
@"Asked to start checkout; but checkout has already started in %@"
,
self
]
userInfo
:
nil
]
raise
];
}
self
.
checkout
=
checkout
;
[
self
.
client
handleCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
[
self
postCheckoutCompletion
:
checkout
error
:
error
];
}];
}
-
(
void
)
cancelCheckout
{
self
.
checkout
=
nil
;
}
-
(
void
)
cancelCheckoutAndNotify
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
name
:
BUYSafariCallbackURLNotification
object
:
nil
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProviderDidDismissCheckout
:)])
{
[
self
.
delegate
paymentProviderDidDismissCheckout
:
self
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidDismissCheckoutNotificationKey
object
:
self
];
self
.
checkout
=
nil
;
}
-
(
BOOL
)
isAvailable
{
return
YES
;
}
-
(
void
)
postCheckoutCompletion
:
(
BUYCheckout
*
)
checkout
error
:
(
NSError
*
)
error
{
if
(
self
.
checkout
&&
error
==
nil
)
{
self
.
checkout
=
checkout
;
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProviderWillStartCheckout
:)])
{
[
self
.
delegate
paymentProviderWillStartCheckout
:
self
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderWillStartCheckoutNotificationKey
object
:
self
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
didReceiveCallbackURLNotification
:
)
name
:
BUYSafariCallbackURLNotification
object
:
nil
];
[
self
openWebCheckout
:
checkout
];
}
else
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didFailCheckoutWithError
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didFailCheckoutWithError
:
error
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidFailCheckoutNotificationKey
object
:
self
];
self
.
checkout
=
nil
;
}
}
-
(
void
)
openWebCheckout
:
(
BUYCheckout
*
)
checkout
{
NSURL
*
checkoutURL
=
[
self
authenticatedWebCheckoutURL
:
checkout
.
webCheckoutURL
];
if
([
SFSafariViewController
class
])
{
SFSafariViewController
*
safariViewController
=
[[
SFSafariViewController
alloc
]
initWithURL
:
checkoutURL
];
safariViewController
.
delegate
=
self
;
[
self
.
delegate
paymentProvider
:
self
wantsControllerPresented
:
safariViewController
];
}
else
{
[[
UIApplication
sharedApplication
]
openURL
:
checkoutURL
];
}
}
-
(
NSURL
*
)
authenticatedWebCheckoutURL
:
(
NSURL
*
)
url
{
NSString
*
customerToken
=
self
.
client
.
customerToken
;
if
(
!
customerToken
.
length
)
{
return
url
;
}
NSURLQueryItem
*
item
=
[
NSURLQueryItem
queryItemWithName
:
WebCheckoutCustomerAccessToken
value
:
customerToken
];
NSURLComponents
*
authenticatedComponents
=
[
NSURLComponents
componentsWithURL
:
url
resolvingAgainstBaseURL
:
YES
];
authenticatedComponents
.
queryItems
=
authenticatedComponents
.
queryItems
?
[
authenticatedComponents
.
queryItems
arrayByAddingObject
:
item
]
:
@[
item
];
return
authenticatedComponents
.
URL
;
}
#pragma mark - Web Checkout delegate methods
-
(
void
)
safariViewControllerDidFinish
:
(
SFSafariViewController
*
)
controller
;
{
[
self
cancelCheckoutAndNotify
];
}
-
(
void
)
didReceiveCallbackURLNotification
:
(
NSNotification
*
)
notification
{
NSURL
*
url
=
notification
.
userInfo
[
BUYURLKey
];
[
self
.
client
getCompletionStatusOfCheckoutURL
:
url
completion
:
^
(
BUYStatus
status
,
NSError
*
error
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
paymentProvider
:
didCompleteCheckout
:
withStatus
:
)])
{
[
self
.
delegate
paymentProvider
:
self
didCompleteCheckout
:
self
.
checkout
withStatus
:
status
];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
BUYPaymentProviderDidCompleteCheckoutNotificationKey
object
:
self
];
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
name
:
BUYSafariCallbackURLNotification
object
:
nil
];
}];
[
self
.
delegate
paymentProviderWantsControllerDismissed
:
self
];
self
.
checkout
=
nil
;
}
@end
Mobile Buy SDK/Mobile Buy SDK/Static Framework/Buy.h
View file @
53102c3a
...
@@ -36,9 +36,6 @@
...
@@ -36,9 +36,6 @@
#import "BUYCartLineItem.h"
#import "BUYCartLineItem.h"
#import "BUYCheckout.h"
#import "BUYCheckout.h"
#import "BUYCheckoutAttribute.h"
#import "BUYCheckoutAttribute.h"
#import "BUYClient+Test.h"
#import "BUYClient.h"
#import "BUYClient+Customers.h"
#import "BUYCollection.h"
#import "BUYCollection.h"
#import "BUYCreditCard.h"
#import "BUYCreditCard.h"
#import "BUYCustomer.h"
#import "BUYCustomer.h"
...
@@ -56,7 +53,17 @@
...
@@ -56,7 +53,17 @@
#import "BUYShop.h"
#import "BUYShop.h"
#import "BUYTaxLine.h"
#import "BUYTaxLine.h"
#import "BUYApplePayHelpers.h"
#import "BUYApplePayPaymentProvider.h"
#import "BUYPaymentController.h"
#import "BUYPaymentProvider.h"
#import "BUYWebCheckoutPaymentProvider.h"
#import "BUYClient.h"
#import "BUYClient+Customers.h"
#import "BUYClient+Checkout.h"
#import "BUYError.h"
#import "BUYError.h"
#import "BUYError+BUYAdditions.h"
#import "BUYManagedObject.h"
#import "BUYManagedObject.h"
#import "BUYModelManager.h"
#import "BUYModelManager.h"
#import "BUYModelManagerProtocol.h"
#import "BUYModelManagerProtocol.h"
...
...
Mobile Buy SDK/Mobile Buy SDK/View Controllers/BUYViewController.m
View file @
53102c3a
...
@@ -35,10 +35,7 @@
...
@@ -35,10 +35,7 @@
#import "BUYApplePayHelpers.h"
#import "BUYApplePayHelpers.h"
#import "BUYDiscount.h"
#import "BUYDiscount.h"
#import "BUYShop.h"
#import "BUYShop.h"
#import "BUYWebCheckoutPaymentProvider.h"
NSString
*
BUYSafariCallbackURLNotification
=
@"kBUYSafariCallbackURLNotification"
;
NSString
*
BUYURLKey
=
@"url"
;
@interface
BUYViewController
()
<
SFSafariViewControllerDelegate
>
@interface
BUYViewController
()
<
SFSafariViewControllerDelegate
>
...
...
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