@vantagepay/vantagepay 0.17.3 → 0.18.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/package.json CHANGED
@@ -1,26 +1,34 @@
1
1
  {
2
2
  "name": "@vantagepay/vantagepay",
3
- "version": "0.17.3",
3
+ "version": "0.18.0",
4
4
  "description": "VantagePay API wrapper and SDK for integrating into VantagePay payment, consumer and merchant services.",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.mjs",
7
- "unpkg": "./dist/index.umd.js",
8
- "source": "./src/index.ts",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
9
15
  "repository": {
10
16
  "type": "git",
11
17
  "url": ""
12
18
  },
13
19
  "scripts": {
14
- "build": "microbundle --tsconfig tsconfig.json --globals @microsoft/signalr=signalR",
15
- "dev": "microbundle watch --tsconfig tsconfig.json --globals @microsoft/signalr=signalR",
20
+ "generate-types": "barrelsby -c .barrelsbyrc.json",
21
+ "build": "tsup",
22
+ "dev": "tsup --watch",
16
23
  "test": "jest --coverage",
24
+ "test:integration": "jest --config jest.integration.config.js",
17
25
  "format": "npx prettier --write .",
18
26
  "ncu": "npx npm-check-updates --interactive"
19
27
  },
20
28
  "dependencies": {
21
29
  "@microsoft/signalr": "^10.0.0",
22
- "axios": "^1.13.4",
23
- "axios-auth-refresh": "^3.3.6",
30
+ "axios": "^1.16.0",
31
+ "axios-auth-refresh": "^5.0.2",
24
32
  "axios-retry": "^4.5.0",
25
33
  "pubsub-js": "^1.9.5",
26
34
  "qrcode": "^1.5.4"
@@ -30,9 +38,11 @@
30
38
  "@types/jest": "^30.0.0",
31
39
  "@types/pubsub-js": "^1.8.6",
32
40
  "@types/qrcode": "^1.5.6",
33
- "jest": "^30.2.0",
34
- "microbundle": "0.15.1",
35
- "ts-jest": "^29.4.6"
41
+ "barrelsby": "^2.8.1",
42
+ "jest": "^30.4.2",
43
+ "ts-jest": "^29.4.9",
44
+ "tsup": "^8.5.1",
45
+ "typescript": "^6.0.3"
36
46
  },
37
47
  "keywords": [
38
48
  "vantagepay",
@@ -43,6 +53,8 @@
43
53
  "author": "VantagePay <npm@vantagepay.com>",
44
54
  "license": "MIT",
45
55
  "files": [
46
- "dist"
56
+ "dist",
57
+ "CHANGELOG.md",
58
+ "LICENSE"
47
59
  ]
48
60
  }
@@ -1,10 +0,0 @@
1
- import { AxiosRequestHeaders } from 'axios';
2
- export type ApiConfig = {
3
- baseUrl?: string;
4
- headers?: AxiosRequestHeaders;
5
- language?: string;
6
- retries?: number;
7
- consoleLogging?: boolean;
8
- logBatchSize?: number;
9
- logBatchInterval?: number;
10
- };
@@ -1,5 +0,0 @@
1
- export declare class ApiError extends Error {
2
- statusCode: number;
3
- result: any;
4
- constructor(statusCode: number, result: any, message?: string);
5
- }
@@ -1,7 +0,0 @@
1
- declare class ApiTokens {
2
- accessToken: string | null;
3
- refreshToken: string | null;
4
- decodeToken(token?: string): any;
5
- }
6
- declare const _default: ApiTokens;
7
- export default _default;
@@ -1,26 +0,0 @@
1
- import { BaseApi } from '../baseApi';
2
- import { FaceCheckResult } from '../common/types';
3
- import { FaceMovementDetectionLevel } from '../lookups/types';
4
- import { TokenResponse } from './types';
5
- export declare class Authentication extends BaseApi {
6
- isLoggedIn(): boolean;
7
- login(username: string, password: string): Promise<TokenResponse>;
8
- logout(): Promise<void>;
9
- refresh(token?: string): Promise<TokenResponse>;
10
- checkLiveness(base64Images: string[]): Promise<FaceMovementDetectionLevel>;
11
- checkFace(base64Image: string): Promise<FaceCheckResult>;
12
- changePassword(oldPassword: string, newPassword: string): Promise<TokenResponse>;
13
- forgotPassword(username: string): Promise<void>;
14
- validateOtp(otpValue: string): Promise<TokenResponse>;
15
- resendOtp(): Promise<void>;
16
- resendEmailAddressVerification(): Promise<void>;
17
- getCurrentConsumerReference(token?: string): string;
18
- getCurrentMerchantReference(token?: string): string;
19
- getCurrentBusinessReference(token?: string): string;
20
- getCurrentTerminalReference(token?: string): string;
21
- getCurrentUserReference(token?: string): string;
22
- getCurrentUserName(token?: string): string;
23
- getRedirectAction(token?: string): string;
24
- getMobileNumber(token?: string): string;
25
- getEmailAddress(token?: string): string;
26
- }
@@ -1,77 +0,0 @@
1
- /** Model to hold information to change a user's password. */
2
- export declare class ChangePasswordRequest {
3
- /** Gets or sets the old password. */
4
- oldPassword?: string;
5
- /** Gets or sets the new password (required). */
6
- newPassword: string;
7
- /** Gets or sets the reset code that need to be supplied if you are not authenticated. */
8
- resetCode?: string;
9
- /** Gets or sets the reference of the user that is linked to this login information. */
10
- userReference?: string;
11
- }
12
- export declare class ForgotPasswordRequest {
13
- username: string;
14
- }
15
- export declare class LivenessRequest {
16
- base64Images: string[];
17
- }
18
- /** Model to hold login information that can be used to access the system and generate tokens. */
19
- export declare class LoginCredentials {
20
- /** Gets or sets the username (required). */
21
- username: string;
22
- /** Gets or sets the password (required). */
23
- password: string;
24
- /** Indicates whether the user is locked out. */
25
- isLockedOut: boolean;
26
- /** Gets the reason (if any) of why the user has been locked out. */
27
- reasonForLockout?: string;
28
- }
29
- /** Provides details for the reason why a login attempt failed (401 errors). */
30
- export declare class LoginErrorResponse {
31
- /** Gets or sets a value indicating whether either the username or password credentials provided to login are invalid. */
32
- invalidUsernameOrPassword?: boolean;
33
- /** Gets or sets a value indicating whether the user is required to change their password first before attempting to login. */
34
- mustChangePassword?: boolean;
35
- /** Gets or sets a value indicating whether the user is required to validate their phone number first (OTP or phone call) before attempting to login. */
36
- mustValidatePhoneNumber?: boolean;
37
- /** Gets or sets a value indicating whether the user is required to validate their email address first before attempting to login. */
38
- mustValidateEmailAddress?: boolean;
39
- /** Gets or sets a value indicating whether the user has been deactivated. */
40
- deactivated?: boolean;
41
- /** Gets or sets a value indicating whether further information about the user is required and the registration process needs to be complete before attempting to login. */
42
- registrationRequired?: boolean;
43
- /** Gets or sets a value indicating whether the user is currently locked out. */
44
- lockedOut?: boolean;
45
- /** Gets or sets an access token that can be used to call the change password end-point. */
46
- changePasswordAccessToken?: string;
47
- /** Gets or sets an access token that can be used to call the change password end-point. */
48
- validatePhoneNumberAccessToken?: string;
49
- /** Gets or sets an access token that can be used to call the resend email verification end-point, and view current merchant / consumer details. */
50
- resendEmailVerificationToken?: string;
51
- }
52
- /** Model to hold the credentials for a login attempt. */
53
- export declare class LoginRequest {
54
- /** Gets or sets the username (required). */
55
- username: string;
56
- /** Gets or sets the password (required). */
57
- password: string;
58
- }
59
- export declare class OtpVerificationRequest {
60
- otpValue: string;
61
- }
62
- export declare class OtpVerificationResponse {
63
- userAccountExists: boolean;
64
- accessToken: string;
65
- }
66
- export declare class SelfieRequest {
67
- base64Image?: string;
68
- }
69
- /** Provides token information for successful login and refresh operations. */
70
- export declare class TokenResponse {
71
- /** Gets or sets a JWT Refresh token that can be used to request a new Access tokens. */
72
- refreshToken?: string;
73
- /** Gets or sets a JWT Access token that can be used to make API calls. */
74
- accessToken?: string;
75
- /** Gets or sets the amount of time (in seconds) for which the Access token will be valid. */
76
- accessTokenValidForSeconds: number;
77
- }
package/dist/baseApi.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- export { default as ApiTokens } from './apiTokens';
3
- export declare abstract class BaseApi {
4
- private readonly axiosInstance;
5
- protected readonly consoleLogging: boolean;
6
- protected readonly events: PubSubJS.Base<any, PubSubJS.Message>;
7
- constructor(axiosInstance: AxiosInstance, consoleLogging?: boolean);
8
- protected request<T>(endpoint: string, method: string, body?: any, token?: string | null): Promise<T>;
9
- private convertDatesToIso;
10
- }
@@ -1,115 +0,0 @@
1
- import { Country } from '../lookups/types';
2
- import { Currency } from '../lookups/types';
3
- import { IdentityDocumentType } from '../lookups/types';
4
- /** Model to hold address details. */
5
- export declare class Address {
6
- /** Gets the address reference. */
7
- reference?: string;
8
- /** Gets or sets the address external reference if linked to another system. */
9
- yourReference?: string;
10
- /** Gets or sets the type of address the details are referring to. */
11
- addressType: AddressType;
12
- /** Gets or sets first line of the address (required). */
13
- addressLine1: string;
14
- /** Gets or sets second line of the address. */
15
- addressLine2?: string;
16
- /** Gets or sets third line of the address. */
17
- addressLine3?: string;
18
- /** Gets or sets postal code of the address. */
19
- postalCode?: string;
20
- /** Gets or sets 3 character ISO country code the address resides in. */
21
- countryIsoCode: Country;
22
- /** Gets or sets city the address resides in (required). */
23
- city: string;
24
- /** Gets or sets state/province the address resides in. */
25
- state?: string;
26
- /** Gets or sets additional location information for the address so that it can be pinned on a map. */
27
- location?: Location;
28
- /** Gets or sets the description of the address. */
29
- description?: string;
30
- /** Gets a single-line formatted string of the address. */
31
- formatted: string;
32
- isActive: boolean;
33
- }
34
- export declare enum AddressType {
35
- MAIN = "MAIN",
36
- POST = "POST",
37
- BILL = "BILL",
38
- SHIP = "SHIP"
39
- }
40
- /** Model to hold account balance details. */
41
- export declare class Balance {
42
- currency: Currency;
43
- availableAmountInCents?: number;
44
- currentAmountInCents?: number;
45
- }
46
- export declare enum BankAccountType {
47
- SAVINGS = "SAVINGS",
48
- CURRENT = "CURRENT",
49
- FIXED = "FIXED",
50
- MONEYMARKET = "MONEYMARKET",
51
- CODA = "CODA",
52
- BOND = "BOND"
53
- }
54
- /** Model to capture generic contact/lead data. */
55
- export declare class ContactDetails {
56
- details: {
57
- [key: string]: string;
58
- };
59
- }
60
- export declare class FaceCheckResult {
61
- faceCount: number;
62
- containsNoise: boolean;
63
- isLowQuality: boolean;
64
- isOverExposed: boolean;
65
- isUnderExposed: boolean;
66
- isBlurry: boolean;
67
- isWearingMask: boolean;
68
- foreheadNotIncluded: boolean;
69
- eyesNotIncluded: boolean;
70
- mouthNotIncluded: boolean;
71
- faceLeft?: number;
72
- faceTop?: number;
73
- faceWidth?: number;
74
- faceHeight?: number;
75
- problems: string[];
76
- }
77
- /** Model to hold identification details. */
78
- export declare class IdentityDocument {
79
- /** Gets or sets the identification document reference. */
80
- reference?: string;
81
- /** Gets or sets the type of identification document submitted by the consumer. */
82
- identityDocumentType: IdentityDocumentType;
83
- /** Gets or sets the 3 character ISO country code where the document was issued. */
84
- countryIsoCode: Country;
85
- /** Gets or sets the encrypted identification number. */
86
- identityNumber: string;
87
- /** Gets or sets the place of issuance. */
88
- placeOfIssuance?: string;
89
- /** Gets or sets the date at which the identification document was issued. */
90
- effectiveDate?: Date;
91
- /** Gets or sets the date at which the identification document expires. */
92
- expiryDate?: Date;
93
- }
94
- /** Model to hold location data. */
95
- export declare class Location {
96
- /** A latitude value expressed as a 64 bit floating point number (required). */
97
- latitude: number;
98
- /** A longitude value expressed as a 64 bit floating point number (required). */
99
- longitude: number;
100
- /** The time zone for this location. */
101
- timeZone?: string;
102
- /** The description of this location (if available). */
103
- description?: string;
104
- }
105
- export declare class NameAndReference {
106
- name: string;
107
- reference: string;
108
- externalReference: string;
109
- }
110
- /** Model to hold API endpoint and access token for an environment. */
111
- export declare class SwitchEnvironmentInfo {
112
- name: string;
113
- accessToken: string;
114
- apiBaseUrl: string;
115
- }
@@ -1,21 +0,0 @@
1
- import { BaseApi } from '../baseApi';
2
- import { Balance, ContactDetails } from '../common/types';
3
- import { Consumer, ConsumerFile, Message } from './types';
4
- export declare class Consumers extends BaseApi {
5
- createConsumer(request: Consumer): Promise<Consumer>;
6
- updateConsumer(request: Consumer): Promise<Consumer>;
7
- deleteConsumer(): Promise<void>;
8
- getConsumer(): Promise<Consumer>;
9
- getConsumerAgreement(): Promise<string>;
10
- acceptConsumerAgreement(): Promise<void>;
11
- stopCard(cardReference: string, reason?: string): Promise<void>;
12
- stopDebitOrders(debitOrderReferences: string[]): Promise<void>;
13
- disputeDebitOrders(debitOrderReferences: string[]): Promise<void>;
14
- getBankAccountBalance(bankAccountReference: string): Promise<Balance>;
15
- downloadFile(fileReference: string, queryParameters?: Record<string, string>): Promise<ConsumerFile | null>;
16
- submitFeedback(description: string): Promise<void>;
17
- getAllMessages(): Promise<Message[]>;
18
- getMessage(messageReference: string): Promise<Message>;
19
- deleteMessage(messageReference: string): Promise<void>;
20
- contactSupport(request: ContactDetails): Promise<void>;
21
- }