Skip to content

Commit

Permalink
Allow setting maxIssuerNumber for Twint via Drop-In configuration (#…
Browse files Browse the repository at this point in the history
…1913)

# Summary
- The `maxIssuerNumber` for Twint can now be set when using Drop-In
- Statically linking the `TwintSDK` to prevent name clashing when using
another library that includes the `TwintSDK` as well (e.g. Datatrans)

# Release notes

<new>
- When using Drop-In: The `maxIssuerNumber` for Twint can now be set
</new>

# Ticket

<ticket>
COIOS-000
</ticket>

---------

Co-authored-by: Alex Guretzki <[email protected]>
  • Loading branch information
goergisn and Alex Guretzki authored Dec 10, 2024
1 parent d3812a3 commit 51b82ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion AdyenActions/AdyenActionComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,35 @@ public final class AdyenActionComponent: ActionComponent, ActionHandlingComponen
public struct Twint {

/// The callback app scheme invoked once the Twint app is done with the payment
///
/// - Important: This value is required to only provide the scheme,
/// without a host/path/.... (e.g. "my-app", not a url "my-app://...")
public var callbackAppScheme: String

/// The issuer number of the highest scheme you listed under `LSApplicationQueriesSchemes`.
/// E.g. pass 39, if you listed all schemes from "twint-issuer1" up to and including "twint-issuer39". The value is clamped between 0 and 39.
///
/// - Important: All apps above "twint-issuer39" will always be returned if one of these apps is installed. For this to work, `LSApplicationQueriesSchemes` must include "twint-extended".
/// If you configure any `maxIssuerNumber` below 39, the result will always contain all apps above `maxIssuerNumber` up to and including 39, even if none of them are installed.
/// Additionally, if the fetch fails and the cache is empty, none of these apps will be found when probing.
public var maxIssuerNumber: Int

/// Initializes a new instance
///
/// - Parameter callbackAppScheme: The callback app scheme invoked once the Twint app is done with the payment
///
/// - Important: The value of ``callbackAppScheme`` is required to only provide the scheme,
/// without a host/path/... (e.g. "my-app", not a url "my-app://...")
public init(callbackAppScheme: String) {
public init(
callbackAppScheme: String,
maxIssuerNumber: Int = .max
) {
if !Self.isCallbackSchemeValid(callbackAppScheme) {
AdyenAssertion.assertionFailure(message: "Format of provided callbackAppScheme '\(callbackAppScheme)' is incorrect.")
}

self.callbackAppScheme = callbackAppScheme
self.maxIssuerNumber = maxIssuerNumber
}

/// Validating whether or not the provided `callbackAppScheme` only contains a scheme
Expand Down Expand Up @@ -265,6 +280,7 @@ public final class AdyenActionComponent: ActionComponent, ActionHandlingComponen
configuration: .init(
style: configuration.style.awaitComponentStyle,
callbackAppScheme: twintConfiguration.callbackAppScheme,
maxIssuerNumber: twintConfiguration.maxIssuerNumber,
localizationParameters: configuration.localizationParameters
)
)
Expand Down
2 changes: 1 addition & 1 deletion AdyenActions/Components/SDK/Twint+Injectable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import Foundation
cancelHandler: @escaping () -> Void
) -> UIAlertController? {
Twint.controller(
for: installedAppConfigurations.map { $0 },
for: installedAppConfigurations,
selectedConfigurationHandler: { selectionHandler($0) },
cancelHandler: { cancelHandler() }
)
Expand Down

0 comments on commit 51b82ab

Please sign in to comment.