Skip to content

Commit 08380c3

Browse files
committed
[DNM] FC Lite example app
1 parent 8dce1fa commit 08380c3

File tree

4 files changed

+88
-6
lines changed

4 files changed

+88
-6
lines changed

Example/FinancialConnections Example/FinancialConnections Example.xcodeproj/project.pbxproj

+24
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
49036F242D3951ED00354EA7 /* StripeApplePay.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 49036F162D39518900354EA7 /* StripeApplePay.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
2525
49036F252D3951EF00354EA7 /* Stripe3DS2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49036F132D39515300354EA7 /* Stripe3DS2.framework */; };
2626
49036F262D3951EF00354EA7 /* Stripe3DS2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 49036F132D39515300354EA7 /* Stripe3DS2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
27+
497458A42D67F5C10094BC5F /* FinancialConnectionsLite in Frameworks */ = {isa = PBXBuildFile; productRef = 497458A32D67F5C10094BC5F /* FinancialConnectionsLite */; };
2728
49B5463A2C6E54DB008DC127 /* InstantDebitsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49B546392C6E54DB008DC127 /* InstantDebitsUITests.swift */; };
2829
597C7552115D87218591934C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07DA32DE3842C0AD47047104 /* AppDelegate.swift */; };
2930
59C21AF5DEA23997E909ACA4 /* StripeCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 03E7365D673694C8D7EDFB20 /* StripeCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -158,6 +159,7 @@
158159
DA6FA2C369E10A2B4663B434 /* StripeFinancialConnections.framework in Frameworks */,
159160
49036F0E2D39512B00354EA7 /* StripePaymentSheet.framework in Frameworks */,
160161
49036F252D3951EF00354EA7 /* Stripe3DS2.framework in Frameworks */,
162+
497458A42D67F5C10094BC5F /* FinancialConnectionsLite in Frameworks */,
161163
49036F212D3951EB00354EA7 /* StripePayments.framework in Frameworks */,
162164
49036F1F2D3951EA00354EA7 /* StripePaymentsUI.framework in Frameworks */,
163165
5B38135D1C37FC1812F4203A /* StripeUICore.framework in Frameworks */,
@@ -364,6 +366,9 @@
364366
en,
365367
);
366368
mainGroup = 16B505A9E0578F89DFF3F7BC;
369+
packageReferences = (
370+
497458A22D67F5C10094BC5F /* XCRemoteSwiftPackageReference "FinancialConnectionsLite" */,
371+
);
367372
productRefGroup = EDE09A27F1A22ECA0F4D45B4 /* Products */;
368373
projectDirPath = "";
369374
projectRoot = "";
@@ -561,6 +566,25 @@
561566
defaultConfigurationName = Release;
562567
};
563568
/* End XCConfigurationList section */
569+
570+
/* Begin XCRemoteSwiftPackageReference section */
571+
497458A22D67F5C10094BC5F /* XCRemoteSwiftPackageReference "FinancialConnectionsLite" */ = {
572+
isa = XCRemoteSwiftPackageReference;
573+
repositoryURL = "https://github.com/mats-stripe/FinancialConnectionsLite";
574+
requirement = {
575+
branch = master;
576+
kind = branch;
577+
};
578+
};
579+
/* End XCRemoteSwiftPackageReference section */
580+
581+
/* Begin XCSwiftPackageProductDependency section */
582+
497458A32D67F5C10094BC5F /* FinancialConnectionsLite */ = {
583+
isa = XCSwiftPackageProductDependency;
584+
package = 497458A22D67F5C10094BC5F /* XCRemoteSwiftPackageReference "FinancialConnectionsLite" */;
585+
productName = FinancialConnectionsLite;
586+
};
587+
/* End XCSwiftPackageProductDependency section */
564588
};
565589
rootObject = 82CFE995323E51B8859FE080 /* Project object */;
566590
}

Example/FinancialConnections Example/FinancialConnections Example/Playground/PlaygroundConfiguration.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ final class PlaygroundConfiguration {
3737
enum IntegrationType: String, CaseIterable, Identifiable, Hashable {
3838
case standalone = "standalone"
3939
case paymentElement = "payment_element"
40+
case fcLite = "fc_lite"
4041

4142
var displayName: String {
4243
switch self {
4344
case .standalone: "Standalone"
44-
case .paymentElement: "Payment Element"
45+
case .paymentElement: "MPE"
46+
case .fcLite: "FC Lite"
4547
}
4648
}
4749

Example/FinancialConnections Example/FinancialConnections Example/Playground/PlaygroundViewModel.swift

+47
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import Combine
10+
import FinancialConnectionsLite
1011
import Foundation
1112
@_spi(STP) import StripeCore
1213
@_spi(STP) import StripeFinancialConnections
@@ -292,6 +293,8 @@ final class PlaygroundViewModel: ObservableObject {
292293
setupStandalone()
293294
case .paymentElement:
294295
setupPaymentElement()
296+
case .fcLite:
297+
setupFcLite()
295298
}
296299
}
297300

@@ -346,6 +349,50 @@ final class PlaygroundViewModel: ObservableObject {
346349
}
347350
}
348351

352+
private func setupFcLite() {
353+
isLoading = true
354+
SetupPlayground(
355+
configurationDictionary: playgroundConfiguration.configurationDictionary
356+
) { [weak self] setupPlaygroundResponse in
357+
guard let self else { return }
358+
if let setupPlaygroundResponse {
359+
if let error = setupPlaygroundResponse["error"] {
360+
print("**** Error in playground setup response: \(error)")
361+
return
362+
}
363+
364+
guard let clientSecret = setupPlaygroundResponse["client_secret"] else {
365+
print("**** No client_secret in response")
366+
return
367+
}
368+
guard let publishableKey = setupPlaygroundResponse["publishable_key"] else {
369+
print("**** No publishable_key in response")
370+
return
371+
}
372+
373+
DispatchQueue.main.async {
374+
let topMostViewController = UIViewController.topMostViewController()!
375+
let fc = FinancialConnectionsLite(
376+
clientSecret: clientSecret,
377+
publishableKey: publishableKey,
378+
returnUrl: URL(string: "financial-connections-example://redirect")!
379+
)
380+
fc.present(from: topMostViewController) { result in
381+
print("**** ", result)
382+
}
383+
}
384+
} else {
385+
UIAlertController.showAlert(
386+
title: "Playground App Setup Failed",
387+
message: "Try clearing 'Custom Keys' or delete & re-install the app."
388+
)
389+
}
390+
DispatchQueue.main.async {
391+
self.isLoading = false
392+
}
393+
}
394+
}
395+
349396
private func setupStandalone() {
350397
isLoading = true
351398
SetupPlayground(

Stripe.xcworkspace/xcshareddata/swiftpm/Package.resolved

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"originHash" : "2ad13697f5d60ad400147e34535361f52e72d2f7a280df77bb3c3521cc5623bc",
2+
"originHash" : "f0cd67c75fa30e4b30018ef0c98fc5bf83741605f1b6ab008517c847962a8c51",
33
"pins" : [
44
{
55
"identity" : "capture-core-sp",
@@ -10,6 +10,15 @@
1010
"version" : "1.2.3"
1111
}
1212
},
13+
{
14+
"identity" : "financialconnectionslite",
15+
"kind" : "remoteSourceControl",
16+
"location" : "https://github.com/mats-stripe/FinancialConnectionsLite",
17+
"state" : {
18+
"branch" : "master",
19+
"revision" : "722dc11818f2a62b949cf06b51a454c55d617ebe"
20+
}
21+
},
1322
{
1423
"identity" : "ios-snapshot-test-case",
1524
"kind" : "remoteSourceControl",
@@ -50,10 +59,10 @@
5059
"kind" : "remoteSourceControl",
5160
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
5261
"state" : {
53-
"revision" : "a3f634d1a409c7979cabc0a71b3f26ffa9fc8af1",
54-
"version" : "1.4.3"
62+
"revision" : "b444594f79844b0d6d76d70fbfb3f7f71728f938",
63+
"version" : "1.5.1"
5564
}
5665
}
5766
],
58-
"version" : 2
59-
}
67+
"version" : 3
68+
}

0 commit comments

Comments
 (0)