Skip to content

Commit

Permalink
allow setting maxIssuerNumber in drop-in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Guretzki committed Dec 4, 2024
1 parent d58ebe3 commit 7d817d1
Showing 1 changed file with 17 additions and 1 deletion.
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

0 comments on commit 7d817d1

Please sign in to comment.