Skip to content

Commit

Permalink
s/ElementsContext/ElementsSessionContext
Browse files Browse the repository at this point in the history
  • Loading branch information
mats-stripe committed Sep 25, 2024
1 parent da9c241 commit 78bca0c
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
7 changes: 3 additions & 4 deletions StripeCore/StripeCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
4910B9282C3D8F3F00B030D4 /* Result+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4910B9272C3D8F3F00B030D4 /* Result+Extensions.swift */; };
49ECDA412CA340E100F647F0 /* AsyncTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49ECDA402CA340E100F647F0 /* AsyncTests.swift */; };
493B33062CA3015600E3622F /* LinkMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493B33052CA3015600E3622F /* LinkMode.swift */; };
4955688F2CA1FB8D00518AFD /* ElementsContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4955688E2CA1FB8D00518AFD /* ElementsContext.swift */; };
4B2FAC57E03D8654A177C408 /* Dictionary+Stripe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7727AEEFD2FC880BADDA1872 /* Dictionary+Stripe.swift */; };
53D46A03B77577EE21F4B166 /* StripeCodableTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FCE36551600C3E53BEAF8F0 /* StripeCodableTest.swift */; };
552DA7969984C443617DBC3E /* STPMultipartFormDataPart.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1C72BA9C44FF60A0E7BEF76 /* STPMultipartFormDataPart.swift */; };
Expand Down Expand Up @@ -229,11 +228,11 @@
4689F6B4384244D9FD282560 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
48A3D6592296104A1512AE92 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
4910B9272C3D8F3F00B030D4 /* Result+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Result+Extensions.swift"; sourceTree = "<group>"; };
492039902CA4624600CE2072 /* ElementsSessionContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsSessionContext.swift; sourceTree = "<group>"; };
493B33052CA3015600E3622F /* LinkMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkMode.swift; sourceTree = "<group>"; };
49424775D3233411D9C2473B /* StripeCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StripeCodable.swift; sourceTree = "<group>"; };
49538DBF8457D96707A2DA56 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
49ECDA402CA340E100F647F0 /* AsyncTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncTests.swift; sourceTree = "<group>"; };
4955688E2CA1FB8D00518AFD /* ElementsContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsContext.swift; sourceTree = "<group>"; };
4A8030BF88608CA86E295F18 /* Enums+CustomStringConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Enums+CustomStringConvertible.swift"; sourceTree = "<group>"; };
4C51E3FA5EE3587BB7BBC634 /* STPError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = STPError.swift; sourceTree = "<group>"; };
4EC3BCEEECB3E1485B18F0C4 /* FinancialConnectionsSDKInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FinancialConnectionsSDKInterface.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -451,8 +450,8 @@
6A05FB462BCF24370001D128 /* FinancialConnectionsLinkedBank.swift */,
6A05FB482BCF244A0001D128 /* InstantDebitsLinkedBank.swift */,
6A05FB4A2BCF245C0001D128 /* FinancialConnectionsEvent.swift */,
4955688E2CA1FB8D00518AFD /* ElementsContext.swift */,
493B33052CA3015600E3622F /* LinkMode.swift */,
492039902CA4624600CE2072 /* ElementsSessionContext.swift */,
);
path = "Connections Bindings";
sourceTree = "<group>";
Expand Down Expand Up @@ -981,6 +980,7 @@
02A26B79617FAE660C9EB506 /* StripeError.swift in Sources */,
3B9D69AB1CB61725C7A012B6 /* StripeServiceError.swift in Sources */,
95156E152471058151076A51 /* Analytic.swift in Sources */,
492039912CA4624600CE2072 /* ElementsSessionContext.swift in Sources */,
766FE8E61B44967F057ED424 /* AnalyticLoggableError.swift in Sources */,
3815D229613D52D7799805B0 /* AnalyticsClientV2.swift in Sources */,
35931C64F06BEB233A219869 /* NetworkDetector.swift in Sources */,
Expand Down Expand Up @@ -1014,7 +1014,6 @@
096274D0729AA8849FAD103C /* PaymentsSDKVariant.swift in Sources */,
DA5A05459309B9B77ACDD736 /* STPDeviceUtils.swift in Sources */,
4910B9282C3D8F3F00B030D4 /* Result+Extensions.swift in Sources */,
4955688F2CA1FB8D00518AFD /* ElementsContext.swift in Sources */,
83790210FFC2DD764C042C8E /* STPDispatchFunctions.swift in Sources */,
72DA29CA8A750E8B00DBF3D4 /* STPError.swift in Sources */,
F628BBE9FDA9D3A217ACA753 /* STPNumericStringValidator.swift in Sources */,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ElementsSessionContext.swift
// StripeCore
//
// Created by Mat Schmid on 2024-09-25.
//

import Foundation

/// Contains elements session context useful for the Financial Connections SDK.
@_spi(STP) public struct ElementsSessionContext {
@_spi(STP) public let linkMode: LinkMode?

@_spi(STP) public init(linkMode: LinkMode?) {
self.linkMode = linkMode
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import UIKit
apiClient: STPAPIClient,
clientSecret: String,
returnURL: String?,
elementsContext: ElementsContext?,
elementsSessionContext: ElementsSessionContext?,
onEvent: ((FinancialConnectionsEvent) -> Void)?,
from presentingViewController: UIViewController,
completion: @escaping (FinancialConnectionsSDKResult) -> Void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class FinancialConnectionsSDKImplementation: FinancialConnectionsSDKInter
apiClient: STPAPIClient,
clientSecret: String,
returnURL: String?,
elementsContext: ElementsContext?,
elementsSessionContext: ElementsSessionContext?,
onEvent: ((StripeCore.FinancialConnectionsEvent) -> Void)?,
from presentingViewController: UIViewController,
completion: @escaping (FinancialConnectionsSDKResult) -> Void
Expand All @@ -30,7 +30,7 @@ public class FinancialConnectionsSDKImplementation: FinancialConnectionsSDKInter
returnURL: returnURL
)
financialConnectionsSheet.apiClient = apiClient
financialConnectionsSheet.elementsContext = elementsContext
financialConnectionsSheet.elementsSessionContext = elementsSessionContext
financialConnectionsSheet.onEvent = onEvent
// Captures self explicitly until the callback is invoked
financialConnectionsSheet.present(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ final public class FinancialConnectionsSheet {
private var wrapperViewController: ModalPresentationWrapperViewController?

// Any additional Elements context useful for the Financial Connections SDK.
@_spi(STP) public var elementsContext: ElementsContext?
@_spi(STP) public var elementsSessionContext: ElementsSessionContext?

// Analytics client to use for logging analytics
@_spi(STP) public let analyticsClient: STPAnalyticsClientProtocol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ extension PaymentMethodFormViewController {
private var usBankAccountFormElement: USBankAccountPaymentMethodElement? { form as? USBankAccountPaymentMethodElement }
private var instantDebitsFormElement: InstantDebitsPaymentMethodElement? { form as? InstantDebitsPaymentMethodElement }

private var elementsContext: ElementsContext? {
private var elementsSessionContext: ElementsSessionContext? {
let linkMode = elementsSession.linkSettings?.linkMode
return ElementsContext(linkMode: linkMode)
return ElementsSessionContext(linkMode: linkMode)
}

private var shouldOverridePrimaryButton: Bool {
Expand Down Expand Up @@ -317,7 +317,7 @@ extension PaymentMethodFormViewController {
clientSecret: paymentIntent.clientSecret,
returnURL: configuration.returnURL,
additionalParameters: additionalParameters,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: nil,
params: params,
from: viewController,
Expand All @@ -328,7 +328,7 @@ extension PaymentMethodFormViewController {
clientSecret: setupIntent.clientSecret,
returnURL: configuration.returnURL,
additionalParameters: additionalParameters,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: nil,
params: params,
from: viewController,
Expand All @@ -353,7 +353,7 @@ extension PaymentMethodFormViewController {
currency: currency,
onBehalfOf: intentConfig.onBehalfOf,
additionalParameters: additionalParameters,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
from: viewController,
financialConnectionsCompletion: financialConnectionsCompletion
)
Expand Down Expand Up @@ -410,7 +410,7 @@ extension PaymentMethodFormViewController {
clientSecret: paymentIntent.clientSecret,
returnURL: configuration.returnURL,
additionalParameters: additionalParameters,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: nil,
params: params,
from: viewController,
Expand All @@ -421,7 +421,7 @@ extension PaymentMethodFormViewController {
clientSecret: setupIntent.clientSecret,
returnURL: configuration.returnURL,
additionalParameters: additionalParameters,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: nil,
params: params,
from: viewController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public class STPBankAccountCollector: NSObject {
clientSecret: String,
returnURL: String?,
additionalParameters: [String: Any] = [:],
elementsContext: ElementsContext?,
elementsSessionContext: ElementsSessionContext?,
onEvent: ((FinancialConnectionsEvent) -> Void)?,
params: STPCollectBankAccountParams,
from viewController: UIViewController,
Expand All @@ -207,7 +207,7 @@ public class STPBankAccountCollector: NSObject {
clientSecret: clientSecret,
returnURL: returnURL,
additionalParameters: additionalParameters,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: onEvent,
params: params,
from: viewController,
Expand All @@ -219,7 +219,7 @@ public class STPBankAccountCollector: NSObject {
clientSecret: String,
returnURL: String?,
additionalParameters: [String: Any] = [:],
elementsContext: ElementsContext? = nil,
elementsSessionContext: ElementsSessionContext? = nil,
onEvent: ((FinancialConnectionsEvent) -> Void)?,
params: STPCollectBankAccountParams,
from viewController: UIViewController,
Expand Down Expand Up @@ -257,7 +257,7 @@ public class STPBankAccountCollector: NSObject {
apiClient: self.apiClient,
clientSecret: linkAccountSession.clientSecret,
returnURL: returnURL,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: onEvent,
from: viewController
) { result in
Expand Down Expand Up @@ -446,7 +446,7 @@ public class STPBankAccountCollector: NSObject {
clientSecret: String,
returnURL: String?,
additionalParameters: [String: Any] = [:],
elementsContext: ElementsContext? = nil,
elementsSessionContext: ElementsSessionContext? = nil,
onEvent: ((FinancialConnectionsEvent) -> Void)?,
params: STPCollectBankAccountParams,
from viewController: UIViewController,
Expand All @@ -465,7 +465,7 @@ public class STPBankAccountCollector: NSObject {
clientSecret: clientSecret,
returnURL: returnURL,
additionalParameters: additionalParameters,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: onEvent,
params: params,
from: viewController,
Expand All @@ -477,7 +477,7 @@ public class STPBankAccountCollector: NSObject {
clientSecret: String,
returnURL: String?,
additionalParameters: [String: Any] = [:],
elementsContext: ElementsContext?,
elementsSessionContext: ElementsSessionContext?,
onEvent: ((FinancialConnectionsEvent) -> Void)?,
params: STPCollectBankAccountParams,
from viewController: UIViewController,
Expand Down Expand Up @@ -514,7 +514,7 @@ public class STPBankAccountCollector: NSObject {
apiClient: self.apiClient,
clientSecret: linkAccountSession.clientSecret,
returnURL: returnURL,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: onEvent,
from: viewController
) { result in
Expand Down Expand Up @@ -565,7 +565,7 @@ public class STPBankAccountCollector: NSObject {
currency: String?,
onBehalfOf: String?,
additionalParameters: [String: Any] = [:],
elementsContext: ElementsContext?,
elementsSessionContext: ElementsSessionContext?,
from viewController: UIViewController,
financialConnectionsCompletion: @escaping (
FinancialConnectionsSDKResult?, LinkAccountSession?, NSError?
Expand Down Expand Up @@ -605,7 +605,7 @@ public class STPBankAccountCollector: NSObject {
apiClient: self.apiClient,
clientSecret: linkAccountSession.clientSecret,
returnURL: returnURL,
elementsContext: elementsContext,
elementsSessionContext: elementsSessionContext,
onEvent: onEvent,
from: viewController
) { result in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class StubbedConnectionsSDKInterface: FinancialConnectionsSDKInterface {
apiClient: STPAPIClient,
clientSecret: String,
returnURL: String?,
elementsContext: ElementsContext?,
elementsSessionContext: ElementsSessionContext?,
onEvent: ((FinancialConnectionsEvent) -> Void)?,
from presentingViewController: UIViewController,
completion: @escaping (FinancialConnectionsSDKResult) -> Void
Expand Down

0 comments on commit 78bca0c

Please sign in to comment.