OPPThreeDSService

@objc
public class OPPThreeDSService : NSObject

Class to perform all necessary preparations for the 3-D Secure 2 authentication.

Note

The service should be initialized just once per app session. Call OPPThreeDSService.initialize(transactionMode:paymentBrands:) method to start the service, it will initiate security checks and collecting device data as background task. It’s recommended to initialize the service once the app is launched or at least once checkout is started. Once service is initialized OPPThreeDSTransaction object can be obtained for the specific transaction, please see OPPThreeDSService.createTransaction(paymentBrand:protocolVersion:) method.
  • Single instance of the OPPThreeDSService class.

    Declaration

    Swift

    @objc
    public static let sharedInstance: OPPThreeDSService
  • The list of payment brands specified during initialization OPPThreeDSService.

    Declaration

    Swift

    @objc
    public var paymentBrands: [String]?
  • Configuration object to be used during service initialization.

    Declaration

    Swift

    @objc
    public var config: OPPThreeDSConfig
  • A flag that specifies if service is initialized or not.

    Declaration

    Swift

    @objc
    public private(set) var isInitialized: Bool { get }
  • The listener which will receive events from the OPPThreeDSService

    Declaration

    Swift

    @objc
    public var initCallback: OPPThreeDSServiceCallback?
  • Initializes the service, starts preparation for the 3-D Secure authentication.

    Preparation includes loading DS certificates for the specified payment brands, security checks and collecting device data as background task.

    Note

    You can know that initialization is done by checking OPPThreeDSService.isInitialized or set OPPThreeDSService.initCallback to be notified about the result of initialization.

    Note

    The state of the service is maintained until the OPPThreeDSService.cleanUp() method is called.

    Throws

    Throws:

    • InvalidInputException if list of payment brands is empty, or if some invalid data is passed in OPPThreeDSService.config
    • SDKRuntimeException if some internal error occurred.

    Declaration

    Swift

    @objc
    public func initialize(transactionMode: OPPThreeDSTransactionMode,
                           paymentBrands: [String])

    Parameters

    transactionMode

    the mode to switch between test and live system.

    paymentBrands

    the list of payment brands which support 3-D Secure 2.

  • Creates transaction object for the specific payment brand.

    Note

    A reference should be kept for this transaction through the entire 3-D Secure process. When the transaction is complete, it should be closed via the OPPThreeDSTransaction.close()

    • Parameter

      • paymentBrand: brand of the shopper’s card.
      • protocolVersion: protocol version according to which the transaction shall be created.

    Throws

    Throws:

    • InvalidInputException if payment brand is not valid, e.g. it was not specified at OPPThreeDSService initialization phase.
    • SDKNotInitializedException if service has not yet been initialized.
    • SDKRuntimeException if some internal error occurred.

    Declaration

    Swift

    @objc
    public func createTransaction(paymentBrand: String, protocolVersion: String) throws -> OPPThreeDSTransaction

    Return Value

    Initialized OPPThreeDSTransaction object.

  • The cleanup method frees up resources that are used by the 3DS SDK. It is called only once during a single app session.

    Throws

    • SDKNotInitializedException if service has not yet been initialized.

    Declaration

    Swift

    @objc
    public func cleanUp() throws
  • Returns warnings produced by the security checks during the service initialization.

    Note

    These can be checked by the app to determine whether or not to proceed with the checkout process.

    Throws

    Throws:

    • SDKNotInitializedException if service has not yet been initialized.

    Declaration

    Swift

    @objc
    public func getWarnings() throws -> [Warning]

    Return Value

    The list of warnings produced during initialization.

  • Provides possibility to overwrite standard certificates and use some custom DS information for the specific brands to process transaction. Should be used for test purposes only.

    Declaration

    Swift

    @objc
    public func setCustomSchemeConfig(_ schemeConfigDict: [String : OPPThreeDSSchemeConfig])

    Parameters

    schemeConfigDict

    Scheme config information mapped for specific card brands.

  • Creates transaction object for the specific payment brand.

    Note

    A reference should be kept for this transaction through the entire 3-D Secure process. When the transaction is complete, it should be closed via the OPPThreeDSTransaction.close()

    Throws

    Throws:

    • InvalidInputException if payment brand is not valid, e.g. it was not specified at OPPThreeDSService initialization phase.
    • SDKNotInitializedException if service has not yet been initialized.
    • SDKRuntimeException if some internal error occurred.

    Declaration

    Swift

    @available(*, deprecated, message: "Use createTransaction(paymentBrand: String, protocolVersion: String﹚ instead")
    @objc
    public func createTransaction(paymentBrand: String) throws -> OPPThreeDSTransaction

    Parameters

    paymentBrand

    brand of the shopper’s card.

    Return Value

    Initialized OPPThreeDSTransaction object.