@trustpayments/3ds-sdk-js
v1.2.827
Published
This package is for internal purposes only.
Keywords
Readme
3DS SDK JS
Warning!
This package is for internal purposes only.
Private package registry
@trustpayments/* packages are resolved from the private GitLab Group Package Registry
(securetrading-gl/software-development-kit, group id 9992134) instead of the public npmjs.org.
The scope mapping is committed in .npmrc (and examples/typescript/.npmrc). No auth token is stored
in the repo — you must configure it once in your user-level ~/.npmrc:
//gitlab.com/api/v4/groups/9992134/-/packages/npm/:_authToken=<YOUR_GITLAB_PERSONAL_ACCESS_TOKEN>The token requires read_package_registry scope. In CI the token is injected at runtime via the
GITLAB_API_TOKEN masked CI/CD variable (set on the group by infra/ops).
Config
challengeDisplayMode-POPUP | INLINE. Default:POPUPchallengeDisplayInlineTargetElementId-string. Default:undefined.Must be the existing DOM Element when usingchallengeDisplayMode=INLINE.loggingLevel-ERROR | ALL. Default:ERRORtranslations-{cancel: string; }. Default:{ cancel: 'X' }processingScreenMode-OVERLAY|ATTACH_TO_ELEMENT. Default:OVERLAYATTACH_TO_ELEMENTrequires additional propertyprocessingScreenWrapperElementIdprocessingScreenWrapperElementId-string. Default:undefinedMust be the existing DOM Element when usingprocessingScreenMode=ATTACH_TO_ELEMENT.threeDSMethodTimeout-number. Default:10000(milliseconds)Timeout after which 3DS Method will be resolved withUNCOMPLETEDresult. The value is validated against the range of 1-10000 milliseconds.
API
init$()
Initializes the library and returns the Observable with the config.
init$(config: IConfigInterface): Observable<IConfigInterface | never>;Default values for config are:
challengeDisplayMode = ChallengeDisplayMode.POPUP
loggingLevel: LoggingLevel.ERROR
interface IConfigInterface {
challengeDisplayMode?: ChallengeDisplayMode;
challengeDisplayInlineTargetElementId?: string;
loggingLevel?: LoggingLevel;
}
enum ChallengeDisplayMode {
POPUP = "POPUP",
INLINE = "INLINE",
}
enum LoggingLevel {
ERROR = "ERROR",
ALL = "ALL",
}run3DSMethod$()
Runs 3DS method and returns the result.
run3DSMethod$(transactionId: string, notificationURL: string, methodURL: string): Observable<IMethodURLResultInterface | never>;interface IMethodURLResultInterface {
status: ResultActionCode;
description: string;
transactionId: string;
}
enum ResultActionCode {
SUCCESS = "SUCCESS",
FAILURE = "FAILURE",
ERROR = "ERROR",
NOACTION = "NOACTION",
CANCELLED = "CANCELLED",
COMPLETED = "COMPLETED",
}Possible ResultActionCode values are: SUCCESS, FAILURE, ERROR, and UNCOMPLETED.
UNCOMPLETED timeout can be set via config property threeDSMethodTimeout. Default values is 10 seconds.
doChallenge$()
Initializes the challenge process. This method handles both versions 1.0.0 and 2.1.0 | 2.2.0.
For version 1.0.0, termURL and merchantData parameters are required.
doChallenge$(
version: ThreeDSecureVersion,
threedpayload: string,
challengeURL: string,
termURL?: string,
merchantData?: string,
): Observable<IChallengeResultInterface | never>;export interface IChallengeResultInterface {
status: ResultActionCode; // ResultActionCode is shared between challenge and method URL
description: string;
transactionId?: string;
data?: string;
}Possible ResultActionCode values are: SUCCESS, FAILURE, ERROR, CANCELLED, and COMPLETED.
getBrowserData()
getBrowserData()returns an object with the following interface:
interface IBrowserDataInterface {
browserJavaEnabled: boolean;
browserJavascriptEnabled: boolean;
browserLanguage: string;
browserScreenWidth: number;
browserScreenHeight: number;
browserColorDepth: number;
browserUserAgent: string;
browserTZ: number; // in minutes
}showProcessingScreen()
showProcessingScreen(cardType: CardType)displays processing screen with predefined mode propertyprocessingScreenModeand optionalprocessingScreenWrapperElementId.
export enum CardType {
MASTER_CARD = "MASTERCARD",
VISA = "VISA",
}hideProcessingScreen()
hideProcessingScreen()hides processing screen.
