Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vonage/verify

Package Overview
Dependencies
Maintainers
37
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/verify - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

dist/classes/index.d.ts

12

dist/classes/PSD2.d.ts

@@ -1,13 +0,15 @@

import { PSD2Request } from '../interfaces/PSD2Request';
export declare class PSD2 implements PSD2Request {
import { PSD2Parameters } from '../types/index';
import { VerifyWorkflows, VerifyLanguages } from '../enums/index';
export declare class PSD2 implements PSD2Parameters {
number: string;
payee: string;
amount: string;
amount: number;
country?: string;
codeLength?: number;
lg?: VerifyLanguages;
language?: string;
pinExpiry?: number;
nextEventWait?: number;
workflowId?: number;
constructor(phoneNumber: string, payee: string, amount: string, country?: string, codeLength?: number, language?: string, pinExpiry?: number, nextEventWait?: number, workflowId?: number);
workflowId?: VerifyWorkflows;
constructor(phoneNumber: string, payee: string, amount: number, country?: string, codeLength?: number, language?: VerifyLanguages, lg?: VerifyLanguages, pinExpiry?: number, nextEventWait?: number, workflowId?: VerifyWorkflows);
}

@@ -5,3 +5,13 @@ "use strict";

class PSD2 {
constructor(phoneNumber, payee, amount, country, codeLength, language, pinExpiry, nextEventWait, workflowId) {
number;
payee;
amount;
country;
codeLength;
lg;
language;
pinExpiry;
nextEventWait;
workflowId;
constructor(phoneNumber, payee, amount, country, codeLength, language, lg, pinExpiry, nextEventWait, workflowId) {
this.number = phoneNumber;

@@ -21,2 +31,3 @@ if (country) {

if (language) {
this.lg = language;
this.language = language;

@@ -23,0 +34,0 @@ }

@@ -1,3 +0,4 @@

import { VerificationRequest } from '../interfaces/VerificationRequest';
export declare class Verification implements VerificationRequest {
import { VerificationParameters } from '../types/index';
import { VerifyWorkflows, VerifyLanguages } from '../enums/index';
export declare class Verification implements VerificationParameters {
number: string;

@@ -9,6 +10,7 @@ brand: string;

language?: string;
lg?: VerifyLanguages;
pinExpiry?: number;
nextEventWait?: number;
workflowId?: number;
constructor(phoneNumber: string, brand: string, country?: string, senderId?: string, codeLength?: number, language?: string, pinExpiry?: number, nextEventWait?: number, workflowId?: number);
workflowId?: VerifyWorkflows;
constructor(phoneNumber: string, brand: string, country?: string, senderId?: string, codeLength?: number, language?: VerifyLanguages, lg?: VerifyLanguages, pinExpiry?: number, nextEventWait?: number, workflowId?: VerifyWorkflows);
}

@@ -5,3 +5,13 @@ "use strict";

class Verification {
constructor(phoneNumber, brand, country, senderId, codeLength, language, pinExpiry, nextEventWait, workflowId) {
number;
brand;
country;
senderId;
codeLength;
language;
lg;
pinExpiry;
nextEventWait;
workflowId;
constructor(phoneNumber, brand, country, senderId, codeLength, language, lg, pinExpiry, nextEventWait, workflowId) {
this.number = phoneNumber;

@@ -19,2 +29,3 @@ this.brand = brand;

if (language) {
this.lg = language;
this.language = language;

@@ -21,0 +32,0 @@ }

@@ -1,3 +0,5 @@

export { PSD2 } from './classes/PSD2';
export { Verification } from './classes/Verification';
export { Verify } from './verify';
export * from './classes/index';
export * from './enums/index';
export * from './interfaces/index';
export * from './types/index';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Verify = exports.Verification = exports.PSD2 = void 0;
var PSD2_1 = require("./classes/PSD2");
Object.defineProperty(exports, "PSD2", { enumerable: true, get: function () { return PSD2_1.PSD2; } });
var Verification_1 = require("./classes/Verification");
Object.defineProperty(exports, "Verification", { enumerable: true, get: function () { return Verification_1.Verification; } });
exports.Verify = void 0;
var verify_1 = require("./verify");
Object.defineProperty(exports, "Verify", { enumerable: true, get: function () { return verify_1.Verify; } });
__exportStar(require("./classes/index"), exports);
__exportStar(require("./enums/index"), exports);
__exportStar(require("./interfaces/index"), exports);
__exportStar(require("./types/index"), exports);
//# sourceMappingURL=index.js.map

@@ -1,11 +0,2 @@

export interface PSD2Request {
number: string;
payee: string;
amount: string;
country?: string;
codeLength?: number;
language?: string;
pinExpiry?: number;
nextEventWait?: number;
workflowId?: number;
}
import { PSD2Parameters } from '../types/index';
export type PSD2Request = PSD2Parameters;

@@ -1,6 +0,2 @@

export interface CheckInformation {
date_recieved: string;
code: string;
status: string;
ip_address: string;
}
import { SearchEventInformationResponse } from './SearchEventInformationResponse';
export type CheckInformation = SearchEventInformationResponse;

@@ -1,4 +0,2 @@

export interface EventInformation {
type: string;
id: string;
}
import { SearchEventInformationResponse } from './SearchEventInformationResponse';
export type EventInformation = SearchEventInformationResponse;

@@ -1,4 +0,2 @@

export interface VerifyRequestResponse {
request_id: string;
status: string;
}
import { VerifyRequestResponse } from './VerifyRequestResponse';
export type VerifyPDS2Response = VerifyRequestResponse;

@@ -1,5 +0,2 @@

export interface VerifyRequestError {
request_id: string;
status: string;
error_text: string;
}
import { VerifyCheckResponse } from './VerifyCheckResponse';
export type VerifyRequestError = VerifyCheckResponse;

@@ -0,8 +1,10 @@

import { CheckStatus } from '../../enums/index';
export interface VerifyCheckResponse {
request_id: string;
event_id: string;
status: string;
price: string;
currency: string;
estimated_price_messages_sent: string;
status: CheckStatus;
event_id?: string;
price?: string;
currency?: string;
estimated_price_messages_sent?: string;
error_text?: string;
}

@@ -1,4 +0,5 @@

export interface VerifyControlError {
status: string;
import { CheckStatus } from '../../enums/index';
export interface VerifyControlErrorResponse {
status: CheckStatus;
error_text: string;
}

@@ -0,4 +1,5 @@

import { Command } from '../../enums/index';
export interface VerifyControlResponse {
status: string;
command: string;
command: Command;
}

@@ -1,5 +0,6 @@

export interface VerifyRequestError {
request_id: string;
export interface VerifyRequestErrorResponse {
request_id?: string;
status: string;
error_text: string;
network?: string;
}

@@ -1,3 +0,5 @@

import { VetchResponse } from '@vonage/vetch';
export interface VoiceResponse<T> extends VetchResponse<T> {
import { CheckStatus } from '../../enums/index';
export interface VerifyResponse {
request_id: string;
status: CheckStatus;
}

@@ -1,7 +0,8 @@

import { CheckInformation } from './CheckInformation';
import { EventInformation } from './EventInformation';
import { SearchCheckInformationResponse } from './SearchCheckInformationResponse';
import { SearchEventInformationResponse } from './SearchEventInformationResponse';
import { SearchStatus } from './../../enums/index';
export interface VerifySearchResponse {
request_id: string;
account_id: string;
status: string;
status: SearchStatus;
number: string;

@@ -13,7 +14,7 @@ price: string;

date_finalized: string;
first_event_date?: string;
last_event_date?: string;
checks?: CheckInformation[];
events?: EventInformation[];
estimated_price_messages_sent: any;
first_event_date: string;
last_event_date: string;
checks: SearchCheckInformationResponse[];
events: SearchEventInformationResponse[];
estimated_price_messages_sent: string;
}

@@ -1,11 +0,2 @@

export interface VerificationRequest {
number: string;
brand: string;
country?: string;
senderId?: string;
codeLength?: number;
language?: string;
pinExpiry?: number;
nextEventWait?: number;
workflowId?: number;
}
import { VerificationParameters } from '../types/index';
export type VerificationRequest = VerificationParameters;
import { Client } from '@vonage/server-client';
import { PSD2Request } from './interfaces/PSD2Request';
import { VerifyCheckResponse } from './interfaces/Response/VerifyCheckResponse';
import { VerifyControlResponse } from './interfaces/Response/VerifyControlResponse';
import { VerifySearchResponse } from './interfaces/Response/VerifySearchResponse';
import { VerificationRequest } from './interfaces/VerificationRequest';
import { Command } from './enums/index';
import { VerifyControl, VerifyControlError, VerifyCheckError, VerifyCheck, VerifySearch, VerifySearchError, VerifyError, VerifyRequest } from './interfaces/index';
import { VerificationParameters, PSD2Parameters } from './types/index';
export declare class Verify extends Client {
cancel(requestId: string): Promise<VerifyControlResponse>;
check(requestId: string, code: string): Promise<VerifyCheckResponse>;
search(requestId: string): Promise<VerifySearchResponse>;
start(request: VerificationRequest | PSD2Request): Promise<VerifyCheckResponse>;
trigger(requestId: string): Promise<VerifyControlResponse>;
sendControl(command: Command, requestId: string): Promise<VerifyControl | VerifyControlError>;
cancel(requestId: string): Promise<VerifyControl | VerifyControlError>;
trigger(requestId: string): Promise<VerifyControl | VerifyControlError>;
check(requestId: string, code: string): Promise<VerifyCheck | VerifyCheckError>;
search(requestId: string): Promise<VerifySearch | VerifySearchError>;
start(request: VerificationParameters | PSD2Parameters): Promise<VerifyError | VerifyRequest>;
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};

@@ -14,96 +8,39 @@ Object.defineProperty(exports, "__esModule", { value: true });

const server_client_1 = require("@vonage/server-client");
const Command_1 = require("./enums/Command");
const remapObjects = (mapping, newObject, oldObject) => {
for (const key in mapping) {
if (oldObject[mapping[key]]) {
newObject[key] = oldObject[mapping[key]];
delete oldObject[mapping[key]];
}
}
newObject = Object.assign(Object.assign({}, newObject), oldObject);
return newObject;
};
const index_1 = require("./enums/index");
const lodash_omit_1 = __importDefault(require("lodash.omit"));
class Verify extends server_client_1.Client {
cancel(requestId) {
return __awaiter(this, void 0, void 0, function* () {
const data = {
request_id: requestId,
cmd: Command_1.Command.CANCEL,
};
const resp = yield this.sendPostRequest(`${this.config.apiHost}/verify/control/json`, data);
return resp.data;
});
async sendControl(command, requestId) {
const data = {
request_id: requestId,
cmd: index_1.Command.CANCEL,
};
const resp = await this.sendPostRequest(`${this.config.apiHost}/verify/control/json`, data);
return server_client_1.Client.transformers.camelCaseObjectKeys(resp.data, true, true);
}
check(requestId, code) {
return __awaiter(this, void 0, void 0, function* () {
const data = {
request_id: requestId,
code,
};
const resp = yield this.sendPostRequest(`${this.config.apiHost}/verify/check/json`, data);
return resp.data;
});
async cancel(requestId) {
return this.sendControl(index_1.Command.CANCEL, requestId);
}
search(requestId) {
return __awaiter(this, void 0, void 0, function* () {
const resp = yield this.sendGetRequest(`${this.config.apiHost}/verify/search/json`, { request_id: requestId });
return resp.data;
});
async trigger(requestId) {
return this.sendControl(index_1.Command.TRIGGER_NEXT_EVENT, requestId);
}
start(request) {
return __awaiter(this, void 0, void 0, function* () {
let url = '';
if ('brand' in request) {
url = `${this.config.apiHost}/verify/json`;
}
else {
url = `${this.config.apiHost}/verify/psd2/json`;
}
let newRequest;
let mapping;
if ('brand' in request) {
newRequest = {
number: request.number,
brand: request.brand,
};
mapping = {
sender_id: 'senderId',
code_length: 'codeLength',
pin_expiry: 'pinExpiry',
lg: 'language',
next_event_wait: 'nextEventWait',
workflow_id: 'workflowId',
};
}
else {
newRequest = {
number: request.number,
payee: request.payee,
amount: request.amount,
};
mapping = {
code_length: 'codeLength',
pin_expiry: 'pinExpiry',
lg: 'language',
next_event_wait: 'nextEventWait',
workflow_id: 'workflowId',
};
}
newRequest = remapObjects(mapping, newRequest, request);
const resp = yield this.sendPostRequest(url, newRequest);
return resp.data;
async check(requestId, code) {
const resp = await this.sendPostRequest(`${this.config.apiHost}/verify/check/json`, {
request_id: requestId,
code: code,
});
return server_client_1.Client.transformers.camelCaseObjectKeys(resp.data, true, true);
}
trigger(requestId) {
return __awaiter(this, void 0, void 0, function* () {
const data = {
request_id: requestId,
cmd: Command_1.Command.TRIGGER_NEXT_EVENT,
};
const resp = yield this.sendPostRequest(`${this.config.apiHost}/verify/control/json`, data);
return resp.data;
});
async search(requestId) {
const resp = await this.sendGetRequest(`${this.config.apiHost}/verify/search/json`, { request_id: requestId });
return server_client_1.Client.transformers.camelCaseObjectKeys(resp.data, true, true);
}
async start(request) {
const url = 'brand' in request
? `${this.config.apiHost}/verify/json`
: `${this.config.apiHost}/verify/psd2/json`;
const resp = await this.sendPostRequest(url, server_client_1.Client.transformers.snakeCaseObjectKeys((0, lodash_omit_1.default)(request, ['language'])));
return server_client_1.Client.transformers.camelCaseObjectKeys(resp.data, true, true);
}
}
exports.Verify = Verify;
//# sourceMappingURL=verify.js.map
{
"name": "@vonage/verify",
"version": "1.0.16",
"version": "1.0.17",
"description": "Verify package for Vonage",

@@ -38,5 +38,6 @@ "keywords": [

"dependencies": {
"@vonage/auth": "^1.0.9",
"@vonage/server-client": "^1.0.15",
"@vonage/vetch": "^1.0.10"
"@vonage/auth": "^1.0.10",
"@vonage/server-client": "^1.0.16",
"@vonage/vetch": "^1.0.11",
"lodash.omit": "^4.5.0"
},

@@ -43,0 +44,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc