-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update StripeConnect's FinancialConnections integration to work with …
…public key override. (#4379) ## Summary - Ensures the financial connection integration uses the public key override. - Updates implementation to make it more testable.
- Loading branch information
1 parent
672dc10
commit e6546d7
Showing
5 changed files
with
94 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
StripeConnect/StripeConnectTests/Internal/FinancialConnectionsPresenterTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// FinancialConnectionsPresenterTests.swift | ||
// StripeConnect | ||
// | ||
// Created by Chris Mays on 12/18/24. | ||
// | ||
@_spi(PrivateBetaConnect) @_spi(DashboardOnly) @testable import StripeConnect | ||
@testable import StripeFinancialConnections | ||
|
||
import UIKit | ||
import XCTest | ||
|
||
class FinancialConnectionsPresenterTests: XCTestCase { | ||
|
||
@MainActor | ||
func testStandardPresent() { | ||
let presenter = FinancialConnectionsPresenter() | ||
|
||
let clientSecret = "client_secret" | ||
let connectedAccountId = "account_1234" | ||
let publishableKey = "pk_12" | ||
|
||
let componentManager = EmbeddedComponentManager(apiClient: .init(publishableKey: publishableKey), | ||
appearance: .default, | ||
fonts: [], | ||
fetchClientSecret: {return nil}) | ||
|
||
let sheet = presenter.makeSheet(componentManager: componentManager, clientSecret: clientSecret, connectedAccountId: connectedAccountId, from: .init()) | ||
|
||
XCTAssertEqual(sheet.apiClient.publishableKey, publishableKey) | ||
XCTAssertEqual(sheet.apiClient.stripeAccount, connectedAccountId) | ||
} | ||
|
||
@MainActor | ||
func testPresentWithPublicKeyOverride() { | ||
let clientSecret = "client_secret" | ||
let connectedAccountId = "account_1234" | ||
let ukKey = "uk_123" | ||
let publishableKey = "pk_12" | ||
|
||
let presenter = FinancialConnectionsPresenter() | ||
let componentManager = EmbeddedComponentManager(apiClient: .init(publishableKey: ukKey), | ||
appearance: .default, | ||
publicKeyOverride: publishableKey, | ||
baseURLOverride: nil) | ||
|
||
let sheet = presenter.makeSheet(componentManager: componentManager, clientSecret: clientSecret, connectedAccountId: connectedAccountId, from: .init()) | ||
|
||
|
||
XCTAssertEqual(sheet.apiClient.publishableKey, publishableKey) | ||
XCTAssertEqual(sheet.apiClient.stripeAccount, connectedAccountId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters