D1Task
public class D1Task
Main class for D1 SDK use cases.
Note
It is recommended to initialize D1Task
as soon as the application is
launched or the earliest possible time.
Since
1.0.0
-
A function to return the SDK version of
D1
and its internal dependencies.Declaration
Swift
public static func getSDKVersions() -> [String : String]
Return Value
A list of SDK versions.
-
D1 Task configurations. It is the entry point for SDK initialization. App can only initialize certain features to reduce waiting time. It is not mandatory to initialize all features in a single call.
Declaration
Swift
public func configure(_ configParams: Set<ConfigParams>, completion: @escaping ([D1Error]?) -> Void)
Parameters
configParams
configurations
completion
The callback is invoked when the configuration is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
Login to the D1 services using the token provided.
Declaration
Swift
public func login(_ issuerToken: inout Data, completion: @escaping (D1Error?) -> Void)
Parameters
issuerToken
Isssuer token used to login to the D1 services.
completion
The callback is invoked when the login process is completed. Possible errors:
-
Logout from the D1 services.
Declaration
Swift
public func logout(_ completion: @escaping (D1Error?) -> Void)
Parameters
completion
The callback is invoked when the logout process is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
Retrieve application instance identifier. Possible errors: -
D1Error.Code.core
Since
3.0.0Declaration
Swift
public static func appInstanceID() throws -> String
-
Reset the SDK. Calling this API will delete all the SDK internal data and the end user wll need to initialize and re-enroll to the SDK services.
Since
3.0.0Declaration
Swift
public static func reset()
-
Retrieves the basic card metadata. Use this API to retrieve last 4 PAN digits value and Card Art.
Declaration
Swift
public func cardMetadata(_ cardID: String, completion: @escaping (CardMetadata?, D1Error?) -> Void)
Parameters
cardID
The card identifier.
completion
The callback is invoked when the operation is completed. When the callback is successful, the card metadata will be returned. Otherwise, the error details will be returned. Possible errors:
-
Retrieves the CardDetails information. Use this API to retrieve Full Card Information, including full PAN value. These values can be used for online transaction.
Declaration
Swift
public func cardDetails(_ cardID: String, completion: @escaping (CardDetails?, D1Error?) -> Void)
Parameters
cardID
The card identifier.
completion
The callback is invoked when the operation is completed. When the callback is successful, the card details info will be returned. Otherwise, the error details will be returned. Possible errors:
-
Displays Card Details information securely.
Use this API to display full card information. Through the UI component in
CardDetailsUI
, the API sets the CardDetails information in the UI. Integrator has full control of the UI appearance and layout.Since
2.1.0
Declaration
Swift
public func displayCardDetails(_ cardID: String, cardDetailsUI ui: CardDetailsUI, completion: @escaping (D1Error?) -> Void)
Parameters
cardID
Card identifier.
cardDetailsUI
The UI to display card details.
completion
The callback invoked when the operation is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
Displays the PIN of the physical card . Use this API to retrieve the PIN attached to a physical card in a secure way.
Since
1.1.0Declaration
Parameters
cardID
The card identifier.
cardPINUI
The UI to display the PIN of the physical card.
completion
The callback is invoked when the operation is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
Sets the PIN of a physical card. Change physical card PIN. This function should be called at the start of UI display. SDK manage the UI entry capture securely and return events through PINEntryUIDelegate.
Since
3.3.0Declaration
Swift
public func changePIN(_ cardID: String, textFieldNew: D1SecureTextField, textFieldConfirm: D1SecureTextField, options: ChangePINOptions, delegate: PINEntryUIDelegate) throws -> PINEntryUI?
Parameters
cardID
The card identifier.
textFieldNew
The new PIN entry field.
textFieldConfirm
The confirm PIN entry field.
options
The PIN entry option.
delegate
PINEntryUIDelegate, possible events: pinMismatch, pinMatch, firstEntry Possible errors:
Return Value
PINEntryUI
instance, the UI to trigger wipe or submit functionality. -
Retrieves the activation method for a physical card. This API identifies the activation method to be used for activating a physical card.
Since
1.1.0Declaration
Swift
public func cardActivationMethod(_ cardID: String, completion: @escaping (CardActivationMethod?, D1Error?) -> Void)
Parameters
cardID
The card identifier.
completion
The callback is invoked when the operation is completed. When the callback is successful, it returns the
CardActivationMethod
as result. Otherwise, the error details will be returned. Possible errors: -
Activates a physical card. Use this API to activate a physical card for usage.
Since
1.1.0Declaration
Parameters
cardID
The card identifier.
entryUI
The UI to display secure text entry. If
activationMethod
isCardActivationMethodNothing
, constructEntryUI
with the value inD1SecureTextField
set to ‘nil’.completion
The callback is invoked when the operation is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
Activates a digital card. Use this API to activate a digital card for usage.
Since
3.2.0Declaration
Swift
public func activateDigitalCard(withDigitalCardID digitalCardID: String, completion: @escaping (D1Error?) -> Void)
Parameters
digitalCardID
The digital card identifier.
completion
The callback is invoked when the operation is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
Update the new push notification token.
Since
3.0.0Declaration
Swift
public func updatePushToken(_ token: String, completion: @escaping (D1Error?) -> Void)
Parameters
token
The latest push notification token.
completion
The callback invoked when the operation is completed. When it succeeds, it returns no error. Otherwise, it returns the error details. Possible errors:
-
Process the push notification data received from the notification server.
Since
3.0.0Declaration
Swift
public func processNotification(_ notification: [String: Any], completion: @escaping ([PushResponse.Key: String]?, D1Error?) -> Void)
Parameters
data
The push notification payload
completion
The callback invoked when the operation is completed. Returns the push notification content. Check
PushResponse.Key.messageType
to identify message type. Possible errors: -
Checks the card digitization details. Use this API to determine if we need to show ‘Add to Apple Pay’, ‘Activate on your phone’, ‘Activate on your watch’ button on the application.
Note
This API contains PKPassLibrary. It is not thread-safe. Use the instances of this class only on a single thread.
Declaration
Swift
public func cardDigitizationState(_ cardID: String, completion: @escaping (CardDigitizationResult?, D1Error?) -> Void)
Parameters
cardID
The card identifier.
completion
The callback is invoked when the operation is completed. When the callback is successful, it returns the
CardDigitizationResult
method. Otherwise, the error details will be returned. Possible errors: -
Add digital card to OEM wallet for a given cardID for Apple Pay
Note
This API contains PKPassLibrary. It is not thread-safe. Use the instances of this class only on a single thread.
Declaration
Swift
public func addDigitalCardToOEM(_ cardID: String, viewController: UIViewController, completion: @escaping (D1Error?) -> Void)
Parameters
cardID
The card identifier.
viewController
The current view controller to present the add card process.
completion
The callback is invoked when the operation is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
Activates the digital card that has the value of
CardDigitizationState
equal toCardDigitizationState.pendingIDVLocal
orCardDigitizationState.pendingIDVRemote
.Note
This API contains PKPassLibrary. It is not thread-safe. Use the instances of this class only on a single thread.
Declaration
Swift
public func activateDigitalCard(_ cardID: String, completion: @escaping (D1Error?) -> Void)
Parameters
cardID
The card identifier.
completion
The callback is invoked when the operation is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
Get the digital card for serial number provided by ApplePay.
Note
This API contains PKPassLibrary. It is not thread-safe. Use the instances of this class only on a single thread.
Since
3.2.0
Declaration
Swift
public func digitalCardPass(forSerialNumber serialNumber: String) throws -> PKPass?
Parameters
serialNumber
The serial number provided by ApplePay.
Return Value
PKPass
instance. -
Retrieves the digital card list for a given cardID.
Note
EachDigitalCard
provides the methodDigitalCard.isOnCurrentDevice
to identify if the digital cards are on the device (only for Apple Pay).Warning
This method requires
D1Task
to be configured first by calling
D1Task.configure(_:completion:)with
ConfigParams.cardConfig(). Otherwise,
NSInvalidArgumentException` will be thrown.Declaration
Swift
public func digitalCardList(_ cardID: String, completion: @escaping ([DigitalCard]?, D1Error?) -> Void)
Parameters
cardID
The card identifier.
completion
The callback is invoked when the operation is completed. When the callback is successful, it returns the list of digital cards. Otherwise, the error details will be returned. Possible errors:
-
Updates the digital card status for a given digital cardID. The following
CardAction
can be performed:- Activates the card
- Suspends the card
- Deletes the card
Declaration
Swift
public func updateDigitalCard(_ cardID: String, digitalCard: DigitalCard, action: CardAction, completion: @escaping (Bool, D1Error?) -> Void)
Parameters
cardID
The card identifier.
digitalCard
The digital card details.
action
The card action to be performed: active, suspend or delete.
completion
The callback is invoked when the operation is completed. When the callback is successful, it returns the operation status. Otherwise, the error details will be returned. Possible errors:
-
Retrieves the eligible token requestor list for a given cardID.
Warning
This method requires
D1Task
to be configured first by calling
D1Task.configure(_:completion:)with
ConfigParams.cardConfig(). Otherwise,
NSInvalidArgumentException` will be thrown.Declaration
Swift
public func tokenRequestorList(_ cardID: String, completion: @escaping ([TokenRequestor]?, D1Error?) -> Void)
Parameters
cardID
The card identifier from
D1Task.consumerDetails(_:)
API.completion
The callback is invoked when the operation is completed. When the callback is successful, it returns the token requestor list. Otherwise, the error details will be returned. Possible errors:
-
Adds a digital card to scheme for a given cardID.
Warning
This method requires
D1Task
to be configured first by callingD1Task.configure(_:completion:)
withConfigParams.cardConfig()
. Otherwise,NSInvalidArgumentException
will be thrown.Declaration
Swift
public func addDigitalCardToScheme(_ cardID: String, tokenRequestor: TokenRequestor, appURL: String, termsAndConditionsAccepted: Bool, completion: @escaping (String?, D1Error?) -> Void)
Parameters
cardID
The card identifier.
tokenRequestor
The target token requestor that the end user has selected.
appURL
Your app’s custom URL scheme that the token requestor calls back upon the completion of tokenization flow to redirect the end user back to the initial page.
termsAndConditionsAccepted
Terms and conditions accepted by the end user. This is only applicable for Visa card scheme. The value is set by the issuer to indicate to the token requestor whether the customer has already accepted the issuer’s terms and conditions. This is required for Secure Remote Commerce service. If the value is
true
, the token requestor can suppress the display of the terms and conditions to the customer and submit the terms and conditions GUID to Visa as though the customer has already accepted the them.completion
The callback is invoked when the operation is completed. When the callback is successful, it returns the push provisioning URL String. Otherwise, the error details will be returned. The push provisioning URL String is used to open and pass the information the Token Requestor app. Possible errors:
-
return an instance of SecureLog object to allow changing log level, getting/deleting log files.
Declaration
Swift
public func secureLog() -> SecureLog?
-
Get
D1PushToECommerce
instance to access scheme push provisioning API methods.Since
3.3.0Declaration
Swift
public func d1PushToECommerce() -> D1PushToECommerce
Return Value
D1PushToECommerce
instance. -
Retrieve D1Authn object for Authn use cases
Since
3.0.0Declaration
Swift
public func d1Authn(_ authnDelegate: AuthnDelegate) -> D1Authn?
Parameters
authnDelegate
delegate for authn use cases