@basis-theory/basis-theory-js 4.2.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/BasisTheory.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { BasisTheoryElements, CardElement, CardExpirationDateElement, CardNumberElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardNumberElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens } from './types/elements';
2
2
  import type { TokenizeData } from './types/models';
3
- import type { Applications, ApplicationTemplates, BasisTheory as IBasisTheory, BasisTheoryInit, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, RequestOptions, Sessions, Tenants, Tokens } from './types/sdk';
3
+ import type { Applications, ApplicationTemplates, BasisTheory as IBasisTheory, BasisTheoryInit, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, RequestOptions, Sessions, Tenants, Tokens, ThreeDS } from './types/sdk';
4
4
  export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
5
5
  private _initStatus;
6
6
  private _initOptions?;
@@ -17,6 +17,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
17
17
  private _proxies?;
18
18
  private _proxy?;
19
19
  private _sessions?;
20
+ private _threeds?;
20
21
  init(apiKey: string | undefined, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
21
22
  init(apiKey: string | undefined, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
22
23
  createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
@@ -43,6 +44,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
43
44
  get proxies(): Proxies;
44
45
  get proxy(): Proxy;
45
46
  get sessions(): Sessions;
47
+ get threeds(): ThreeDS;
46
48
  /**
47
49
  * @deprecated
48
50
  */
package/BasisTheory.js CHANGED
@@ -29,6 +29,8 @@ var _sessions = require("./sessions");
29
29
 
30
30
  var _tenants = require("./tenants");
31
31
 
32
+ var _threeds = require("./threeds");
33
+
32
34
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
33
35
 
34
36
  const defaultInitOptions = {
@@ -135,6 +137,11 @@ class BasisTheory {
135
137
  baseURL: new URL(_common.CLIENT_BASE_PATHS.sessions, baseUrl).toString(),
136
138
  appInfo
137
139
  });
140
+ this._threeds = new _threeds.BasisTheoryThreeDS({
141
+ apiKey,
142
+ baseURL: new URL(_common.CLIENT_BASE_PATHS.threeds, baseUrl).toString(),
143
+ appInfo
144
+ });
138
145
  this._initStatus = 'done';
139
146
  } catch (error) {
140
147
  this._initStatus = 'error';
@@ -238,6 +245,10 @@ class BasisTheory {
238
245
  get sessions() {
239
246
  return (0, _common.assertInit)(this._sessions);
240
247
  }
248
+
249
+ get threeds() {
250
+ return (0, _common.assertInit)(this._threeds);
251
+ }
241
252
  /* eslint-enable accessor-pairs */
242
253
 
243
254
  /**
@@ -38,7 +38,8 @@ const CLIENT_BASE_PATHS = {
38
38
  permissions: 'permissions',
39
39
  proxies: 'proxies',
40
40
  proxy: 'proxy',
41
- sessions: 'sessions'
41
+ sessions: 'sessions',
42
+ threeds: '3ds'
42
43
  };
43
44
  exports.CLIENT_BASE_PATHS = CLIENT_BASE_PATHS;
44
45
  const BROWSER_LIST = [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "4.2.2",
3
+ "version": "4.3.0",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -0,0 +1,8 @@
1
+ import { BasisTheoryService } from '../service';
2
+ import { AuthenticateThreeDSSessionRequest, ThreeDSAuthentication, ThreeDSSession } from '../types/models/threeds';
3
+ import { ThreeDS } from '../types/sdk/services/threeds';
4
+ export declare class BasisTheoryThreeDS extends BasisTheoryService implements ThreeDS {
5
+ getSessionById(sessionId: string): Promise<ThreeDSSession>;
6
+ authenticateSession(sessionId: string, authenticateRequest: AuthenticateThreeDSSessionRequest): Promise<ThreeDSAuthentication>;
7
+ getChallengeResult(sessionId: string): Promise<ThreeDSAuthentication>;
8
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BasisTheoryThreeDS = void 0;
7
+
8
+ var _common = require("./../common");
9
+
10
+ var _service = require("./../service");
11
+
12
+ class BasisTheoryThreeDS extends _service.BasisTheoryService {
13
+ getSessionById(sessionId) {
14
+ return this.client.get(`/${sessionId}`).then(_common.dataExtractor);
15
+ }
16
+
17
+ authenticateSession(sessionId, authenticateRequest) {
18
+ return this.client.post(`/${sessionId}/authenticate`, authenticateRequest).then(_common.dataExtractor);
19
+ }
20
+
21
+ getChallengeResult(sessionId) {
22
+ return this.client.get(`/${sessionId}/challenge-result`).then(_common.dataExtractor);
23
+ }
24
+
25
+ }
26
+
27
+ exports.BasisTheoryThreeDS = BasisTheoryThreeDS;
@@ -0,0 +1 @@
1
+ export * from './BasisTheoryThreeDs';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _BasisTheoryThreeDs = require("./BasisTheoryThreeDs");
8
+
9
+ Object.keys(_BasisTheoryThreeDs).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _BasisTheoryThreeDs[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _BasisTheoryThreeDs[key];
16
+ }
17
+ });
18
+ });
@@ -0,0 +1,188 @@
1
+ interface AuthenticateThreeDSSessionRequest {
2
+ authenticationCategory: string;
3
+ authenticationType: string;
4
+ challengePreference?: string;
5
+ purchaseInfo?: ThreeDSPurchaseInfo;
6
+ merchantInfo?: ThreeDSMerchantInfo;
7
+ requestorInfo?: ThreeDSRequestorInfo;
8
+ cardholderInfo?: ThreeDSCardholderInfo;
9
+ broadcastInfo?: unknown;
10
+ messageExtensions?: ThreeDSMessageExtension[];
11
+ }
12
+ interface ThreeDSPurchaseInfo {
13
+ amount: string;
14
+ currency: string;
15
+ exponent: string;
16
+ date: string;
17
+ transactionType?: string;
18
+ installmentCount?: string;
19
+ recurringExpiration?: string;
20
+ recurringFrequency?: string;
21
+ }
22
+ interface ThreeDSMerchantInfo {
23
+ mid: string;
24
+ acquirerBin: string;
25
+ name: string;
26
+ countryCode: string;
27
+ categoryCode: string;
28
+ riskInfo?: ThreeDSMerchantRiskInfo;
29
+ }
30
+ interface ThreeDSMerchantRiskInfo {
31
+ deliveryEmail?: string;
32
+ deliveryTimeframe?: string;
33
+ giftCardAmount?: string;
34
+ giftCardCount?: string;
35
+ giftCardCurrency?: string;
36
+ preOrderPurchase?: boolean;
37
+ preOrderDate?: string;
38
+ reorderedPurchase?: boolean;
39
+ shippingMethod?: string;
40
+ }
41
+ interface ThreeDSRequestorInfo {
42
+ id: string;
43
+ name: string;
44
+ url: string;
45
+ }
46
+ interface ThreeDSCardholderInfo {
47
+ accountId?: string;
48
+ accountType?: string;
49
+ accountInfo?: ThreeDSCardholderAccountInfo;
50
+ authenticationInfo?: ThreeDSCardholderAuthenticationInfo;
51
+ priorAuthenticationInfo?: ThreeDSPriorAuthenticationInfo;
52
+ name: string;
53
+ email: string;
54
+ phoneNumber?: ThreeDSCardholderPhoneNumber;
55
+ mobilePhoneNumber?: ThreeDSCardholderPhoneNumber;
56
+ workPhoneNumber?: ThreeDSCardholderPhoneNumber;
57
+ billingShippingAddressMatch?: string;
58
+ billingAddress?: ThreeDSAddress;
59
+ shippingAddress?: ThreeDSAddress;
60
+ }
61
+ interface ThreeDSCardholderAccountInfo {
62
+ accountAge?: string;
63
+ accountLastChanged?: string;
64
+ accountChangeDate?: string;
65
+ accountCreatedDate?: string;
66
+ accountPasswordLastChanged?: string;
67
+ accountPasswordChangeDate?: string;
68
+ purchaseCountLastYear?: string;
69
+ transactionCountDay?: string;
70
+ paymentAccountAge?: string;
71
+ transactionCountYear?: string;
72
+ paymentAccountCreated?: string;
73
+ shippingAddressFirstUsed?: string;
74
+ shippingAddressUsageDate?: string;
75
+ shippingAccountNameMatch?: boolean;
76
+ suspiciousActivityObserved?: boolean;
77
+ }
78
+ interface ThreeDSCardholderAuthenticationInfo {
79
+ method?: string;
80
+ timestamp?: string;
81
+ data?: string;
82
+ }
83
+ interface ThreeDSPriorAuthenticationInfo {
84
+ method?: string;
85
+ timestamp?: string;
86
+ referenceId?: string;
87
+ data?: string;
88
+ }
89
+ interface ThreeDSCardholderPhoneNumber {
90
+ countryCode: string;
91
+ number: string;
92
+ }
93
+ interface ThreeDSAddress {
94
+ line1: string;
95
+ line2?: string;
96
+ line3?: string;
97
+ postalCode: string;
98
+ city: string;
99
+ stateCode: string;
100
+ countryCode: string;
101
+ }
102
+ interface ThreeDSMessageExtension {
103
+ id: string;
104
+ name: string;
105
+ critical: boolean | null;
106
+ data: any;
107
+ }
108
+ interface ThreeDSSession {
109
+ id: string;
110
+ tenantId: string;
111
+ panTokenId: string;
112
+ cardBrand: string;
113
+ expirationDate: string;
114
+ createdDate: string;
115
+ createdBy: string;
116
+ modifiedDate: string;
117
+ modifiedBy: string;
118
+ device: string;
119
+ deviceInfo: ThreeDSDeviceInfo;
120
+ version: ThreeDSVersion;
121
+ method: ThreeDSMethod;
122
+ authentication: ThreeDSAuthentication;
123
+ }
124
+ interface ThreeDSDeviceInfo {
125
+ browserAcceptHeader: string;
126
+ browserIpAddress: string;
127
+ browserJavascriptEnabled: boolean | null;
128
+ browserJavaEnabled: boolean | null;
129
+ browserLanguage: string;
130
+ browserColorDepth: string;
131
+ browserScreenHeight: string;
132
+ browserScreenWidth: string;
133
+ browserTimezone: string;
134
+ browserUserAgent: string;
135
+ sdkTransactionId: string;
136
+ sdkApplicationId: string;
137
+ sdkEncryptionData: string;
138
+ sdkEphemeralPublicKey: string;
139
+ sdkMaxTimeout: string;
140
+ sdkReferenceNumber: string;
141
+ sdkRenderOptions: ThreeDSMobileSdkRenderOptions;
142
+ }
143
+ interface ThreeDSMobileSdkRenderOptions {
144
+ sdkInterface: string;
145
+ sdkUiType: string;
146
+ }
147
+ interface ThreeDSVersion {
148
+ recommendedVersion: string;
149
+ availableVersions: string[];
150
+ earliestAcsSupportedVersion: string;
151
+ earliestDsSupportedVersion: string;
152
+ latestAcsSupportedVersion: string;
153
+ latestDsSupportedVersion: string;
154
+ acsInformation: string[];
155
+ }
156
+ interface ThreeDSMethod {
157
+ methodUrl: string;
158
+ methodCompletionIndicator: string;
159
+ }
160
+ interface ThreeDSAuthentication {
161
+ threedsVersion: string;
162
+ acsTransactionId: string | null;
163
+ dsTransactionId: string | null;
164
+ sdkTransactionId: string | null;
165
+ acsReferenceNumber: string;
166
+ dsReferenceNumber: string;
167
+ authenticationValue: string;
168
+ authenticationStatus: string;
169
+ authenticationStatusReason: string;
170
+ eci: string;
171
+ acsChallengeMandated: string;
172
+ acsDecoupledAuthentication: string;
173
+ authenticationChallengeType: string;
174
+ acsRenderingType: ThreeDSAcsRenderingType;
175
+ acsSignedContent: string;
176
+ acsChallengeUrl: string;
177
+ challengeAttempts: string;
178
+ challengeCancelReason: string;
179
+ cardholderInfo: string;
180
+ whitelistStatus: string;
181
+ whitelistStatusSource: string;
182
+ messageExtensions: ThreeDSMessageExtension[];
183
+ }
184
+ interface ThreeDSAcsRenderingType {
185
+ acsInterface: string;
186
+ acsUiTemplate: string;
187
+ }
188
+ export type { AuthenticateThreeDSSessionRequest, ThreeDSPurchaseInfo, ThreeDSMerchantInfo, ThreeDSMerchantRiskInfo, ThreeDSRequestorInfo, ThreeDSCardholderInfo, ThreeDSCardholderAccountInfo, ThreeDSCardholderAuthenticationInfo, ThreeDSPriorAuthenticationInfo, ThreeDSCardholderPhoneNumber, ThreeDSAddress, ThreeDSMessageExtension, ThreeDSSession, ThreeDSDeviceInfo, ThreeDSMobileSdkRenderOptions, ThreeDSVersion, ThreeDSMethod, ThreeDSAuthentication, ThreeDSAcsRenderingType, };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,5 +1,5 @@
1
1
  import type { BasisTheoryElements } from '../../types/elements';
2
- import type { Applications, ApplicationTemplates, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, Sessions, Tenants, Tokenize, Tokens } from './services';
2
+ import type { Applications, ApplicationTemplates, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, Sessions, Tenants, Tokenize, Tokens, ThreeDS } from './services';
3
3
  interface ApplicationInfo {
4
4
  name?: string;
5
5
  version?: string;
@@ -40,6 +40,7 @@ interface BasisTheory extends Tokenize {
40
40
  sessions: Sessions;
41
41
  tenants: Tenants;
42
42
  tokens: Tokens;
43
+ threeds: ThreeDS;
43
44
  }
44
45
  interface ClientUserAgent {
45
46
  client: string;
@@ -12,3 +12,4 @@ export * from './proxy';
12
12
  export * from './sessions';
13
13
  export * from './http';
14
14
  export * from './application-templates';
15
+ export * from './threeds';
@@ -184,4 +184,17 @@ Object.keys(_applicationTemplates).forEach(function (key) {
184
184
  return _applicationTemplates[key];
185
185
  }
186
186
  });
187
+ });
188
+
189
+ var _threeds = require("./threeds");
190
+
191
+ Object.keys(_threeds).forEach(function (key) {
192
+ if (key === "default" || key === "__esModule") return;
193
+ if (key in exports && exports[key] === _threeds[key]) return;
194
+ Object.defineProperty(exports, key, {
195
+ enumerable: true,
196
+ get: function () {
197
+ return _threeds[key];
198
+ }
199
+ });
187
200
  });
@@ -0,0 +1,7 @@
1
+ import { AuthenticateThreeDSSessionRequest, ThreeDSAuthentication, ThreeDSSession } from '../../../types/models/threeds';
2
+ interface ThreeDS {
3
+ getSessionById(sessionId: string): Promise<ThreeDSSession>;
4
+ authenticateSession(sessionId: string, authenticateRequest: AuthenticateThreeDSSessionRequest): Promise<ThreeDSAuthentication>;
5
+ getChallengeResult(sessionId: string): Promise<ThreeDSAuthentication>;
6
+ }
7
+ export type { ThreeDS };
@@ -0,0 +1 @@
1
+ "use strict";