From a99e810e569a373c70fa732086307d30d638835c Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 31 Mar 2022 10:42:22 +0530 Subject: [PATCH 01/16] profile api change --- lib/resources/profile.js | 160 +++++++++++++++++++++++++++++++++++++++ lib/rest/client-test.js | 4 + lib/rest/client.js | 2 + lib/rest/request-test.js | 119 +++++++++++++++++++++++++++++ test/profile.js | 42 ++++++++++ 5 files changed, 327 insertions(+) create mode 100644 lib/resources/profile.js create mode 100644 test/profile.js diff --git a/lib/resources/profile.js b/lib/resources/profile.js new file mode 100644 index 0000000..f4644d4 --- /dev/null +++ b/lib/resources/profile.js @@ -0,0 +1,160 @@ +import * as _ from "lodash"; + +import { + PlivoResource, + PlivoResourceInterface +} from '../base'; +import { + extend, + validate +} from '../utils/common.js'; + +const action = 'Profile/'; +const idField = 'profileUUID'; +let actionKey = Symbol('api action'); +let klassKey = Symbol('constructor'); +let idKey = Symbol('id filed'); +let clientKey = Symbol('make api call'); + + + +/** + * Represents a Profile + * @constructor + * @param {function} client - make api call + * @param {object} [data] - data of call + */ + export class Profile extends PlivoResource { + constructor(client, data = {}) { + super(action, Profile, idField, client); + this[actionKey] = action; + this[clientKey] = client; + if (idField in data) { + this.id = data[idField]; + }; + + extend(this, data); + } +} + +export class ProfileResponse { + constructor(params) { + params = params || {}; + this.apiId = params.apiId; + this.profileUuid = params.profileUuid; + } +} + +/** + * Represents a Profile Interface + * @constructor + * @param {function} client - make api call + * @param {object} [data] - data of call + */ + export class ProfileInterface extends PlivoResource { + constructor(client, data = {}) { + super(action, Profile, idField, client); + extend(this, data); + this[clientKey] = client; + this[actionKey] = action; + this[klassKey] = Profile; + this[idKey] = idField; + } + + /** + * get Profile by given profileuuid + * @method + * @param {string} profileUUID - id of profileUUID + * @promise {object} return {@link profile} object + * @fail {Error} return Error + */ + get(profileUUID) { + let params = {}; + return super.customexecuteAction(action+profileUUID+'/', 'GET', params); + } + + /** + * Get All Profile Detail + * @method + * @param {object} params - params limit and offset + * @promise {object[]} returns list of profile Object + * @fail {Error} returns Error + */ + list(params) { + return super.customexecuteAction(action,'GET', params); + } + + /** + * delete Profile by given profileuuid + * @method + * @param {string} profileUUID - id of profileUUID + * @fail {Error} return Error + */ + deelet(profileUUID) { + let params = {}; + return super.customexecuteAction(action+profileUUID+'/', 'DELETE', params); + } + + /** + * Create a new Profile + * + * @param {string} profile_alias + * @param {string} profile_type + * @param {string} customer_type + * @param {string} entity_type + * @param {string} company_name + * @param {string} ein + * @param {string} vertical + * @param {string} ein_issuing_country + * @param {string} stock_symbol + * @param {string} stock_exchange + * @param {string} alt_business_id_type + * @param {string} website + * @param {object} address + * @param {object} authorized_contact + * @return profileResponse response output + */ + create(profile_alias,profile_type,customer_type,entity_type, company_name,ein,vertical,ein_issuing_country,stock_symbol,stock_exchange, alt_business_id_type, website, address, authorized_contact){ + let params = {} + params.profile_alias=profile_alias; + params.profile_type=profile_type; + params.customer_type=customer_type; + params.entity_type=entity_type; + params.company_name=company_name; + params.ein=ein; + params.vertical=vertical; + params.ein_issuing_country=ein_issuing_country; + params.stock_symbol=stock_symbol; + params.stock_exchange=stock_exchange; + params.alt_business_id_type=alt_business_id_type; + params.website=website; + params.address=address; + params.authorized_contact=authorized_contact; + let client = this[clientKey]; + return new Promise((resolve, reject) => { + client('POST', action, params) + .then(response => { + resolve(new ProfileResponse(response.body, idField)); + }) + .catch(error => { + reject(error); + }); + }); + + } + /** + * update a new Profile + * + * @param {string} profile_uuid + * @param {object } address + * @param {object } authorized_contact + * @param {string} entity_type + * @param {string} vertical + * @param {string} company_name + * @param {string} website + * @return profileResponse response output + */ + update(profile_uuid, params){ + return super.customexecuteAction(action+profile_uuid+'/', 'POST', params); + } +} \ No newline at end of file diff --git a/lib/rest/client-test.js b/lib/rest/client-test.js index 7dbed8e..d8ce65a 100644 --- a/lib/rest/client-test.js +++ b/lib/rest/client-test.js @@ -39,6 +39,9 @@ import { import{ CampaignInterface } from '../resources/campaign.js'; +import{ + ProfileInterface +}from '../resources/profile.js'; import { NumberInterface } from '../resources/numbers.js'; @@ -101,6 +104,7 @@ export class Client { this.messages = new MessageInterface(client); this.brand = new BrandInterface(client); this.campaign = new CampaignInterface(client); + this.profile = new ProfileInterface(client); this.lookup = new LookupInterface(client); this.powerpacks = new PowerpackInterface(client); this.numbers = new NumberInterface(client); diff --git a/lib/rest/client.js b/lib/rest/client.js index 81a34a7..8948cea 100644 --- a/lib/rest/client.js +++ b/lib/rest/client.js @@ -12,6 +12,7 @@ import { LookupInterface } from "../resources/lookup"; import { PowerpackInterface } from "../resources/powerpacks"; import { BrandInterface } from "../resources/brand.js"; import { CampaignInterface } from "../resources/campaign.js"; +import { ProfileInterface } from "../resources/profile.js"; import { NumberInterface } from "../resources/numbers"; import { PricingInterface } from "../resources/pricings"; import { RecordingInterface } from "../resources/recordings"; @@ -94,6 +95,7 @@ export class Client { this.powerpacks = new PowerpackInterface(client); this.brand = new BrandInterface(client); this.campaign = new CampaignInterface(client); + this.profile = new ProfileInterface(client); this.numbers = new NumberInterface(client); this.pricings = new PricingInterface(client); this.recordings = new RecordingInterface(client); diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index cda9dc4..c1348de 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -1231,6 +1231,125 @@ export function Request(config) { } }); } + else if(action == 'Profile/' && method == 'LIST'){ + resolve({ + response: {}, + body: { + api_id: "97a1c5ee-b019-11ec-88b1-0242ac110002", + count: 10, + limit: 2, + offset: 0, + profiles: [ + { + alt_business_id_type: "NONE", + authorized_contact: { + email: "johndoe.com", + name: "John Doe", + seniority: "admin", + title: "Doe" + }, + company_name: "ABC Inc.", + customer_type: "RESELLER", + ein_issuing_country: "US", + entity_type: "PUBLIC_PROFIT", + profile_alias: "vishnu1", + profile_type: "SECONDARY", + profile_uuid: "1c41faed-a38e-42a3-a966-fe7df34b51b9", + stock_symbol: "ABC", + vertical: "ENERGY" + }, + { + alt_business_id_type: "NONE", + authorized_contact: { + email: "johndoe.com", + name: "John Doe", + seniority: "admin", + title: "Doe" + }, + company_name: "ABC Inc.", + customer_type: "RESELLER", + ein_issuing_country: "US", + entity_type: "SOLE_PROPRIETOR", + profile_alias: "vishnu1", + profile_type: "SECONDARY", + profile_uuid: "1d77a5fe-bca4-4a6d-a7c4-58b70e8cd7a2", + stock_symbol: "ABC", + vertical: "ENERGY" + } + ] + } + }); + } + else if(action == 'Profile/06ecae31-4bf8-40b9-ac62-e902418e9935/' && method == 'GET'){ + resolve({ + response: {}, + body: { + api_id: "63287a98-b018-11ec-bc21-0242ac110002", + profile: { + alt_business_id_type: "NONE", + authorized_contact: { + name: " " + }, + company_name: "ABC Inc.", + customer_type: "RESELLER", + ein: "111111111", + ein_issuing_country: "US", + entity_type: "PUBLIC_PROFIT", + profile_alias: "vishnu1", + profile_type: "SECONDARY", + profile_uuid: "06ecae31-4bf8-40b9-ac62-e902418e9935", + stock_symbol: "ABC", + vertical: "ENERGY" + } + } + }); + } + else if(action == 'Profile/06ecae31-4bf8-40b9-ac62-e902418e9935/' && method == 'DELETE'){ + resolve({ + response: {}, + body: { + api_id: "eb1e71ae-b01e-11ec-88b1-0242ac110002" + } + }); + } + else if(action == 'Profile/06ecae31-4bf8-40b9-ac62-e902418e9935/' && method == 'POST'){ + resolve({ + response: {}, + body: { + api_id: "15783daa-b01e-11ec-88b1-0242ac110002", + profile: { + address: "123 New York NY 10001 IN", + alt_business_id_type: "NONE", + authorized_contact: { + email: "Doe", + name: "Joh11n Doe", + seniority: "admin", + title: "Doe" + }, + company_name: "ABC Inc.", + customer_type: "RESELLER", + ein_issuing_country: "US", + entity_type: "PRIVATE_PROFIT", + primary_profile: "303edff6-8525-43e5-87e6-48c571ddca25", + profile_alias: "vishnu1", + profile_type: "SECONDARY", + profile_uuid: "1c41faed-a38e-42a3-a966-fe7df34b51b9", + stock_symbol: "ABC", + vertical: "PROFESSIONAL", + website: "google.com" + } + } + }); + } + else if(action == 'Profile/' && method == 'POST'){ + resolve({ + response: {}, + body: { + api_id: "99ab47ae-b01c-11ec-bc21-0242ac110002", + profile_uuid: "43d0616e-d50a-445a-a84e-310a089f0618" + } + }); + } else if (action == '10dlc/Campaign/CMPT4EP/' && method == 'GET'){ resolve({ response: {}, diff --git a/test/profile.js b/test/profile.js new file mode 100644 index 0000000..7fe00de --- /dev/null +++ b/test/profile.js @@ -0,0 +1,42 @@ +import { + Client + } from '../lib/rest/client-test'; + import { + PlivoGenericResponse + } from '../lib/base.js'; + import assert from 'assert'; + import sinon from 'sinon'; + + let client = new Client('sampleid', 'sammpletoken', 'sampleproxy'); + + describe('profile', function () { + it('should get profile', function () { + return client.profile.get("06ecae31-4bf8-40b9-ac62-e902418e9935") + .then(function (response) { + assert.equal(response.profile.profileUuid, "06ecae31-4bf8-40b9-ac62-e902418e9935") + }) + }); + + it('list profile', function () { + return client.profile.list() + .then(function (response) { + assert.equal(response.profiles.length, 2) + }) + }); + + it('delete profile', function () { + return client.profile.delete("06ecae31-4bf8-40b9-ac62-e902418e9935") + .then(function (response) { + assert.equal(response.api_id, "eb1e71ae-b01e-11ec-88b1-0242ac110002") + }) + }); + + it('create profile', function () { + var authorized_contact = {"first_name":"Hello", "last_name":"Test", "email":"vishnu@plivo.com", "title":"bro", "seniority":"admin"} + var address = {"street":"123", "city":"Band", "state":"NY", "postal_code":"10001", "country":"US"} + return client.profile.create("vishnu104", "SECONDARY", "RESELLER","PRIVATE_PROFIT","ABC Inc", "111111111", "PROFESSIONAL", "US", "ABC","NASDAQ","NONE", "google.com", address,authorized_contact) + .then(function (profile) { + assert.equal(profile.profile_uuid, '43d0616e-d50a-445a-a84e-310a089f0618') + }) + }); + }); \ No newline at end of file From 97810bb8a1a266891137ecf5c24e551999fd4511 Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 31 Mar 2022 11:58:57 +0530 Subject: [PATCH 02/16] UT fix --- lib/resources/profile.js | 4 ++-- test/profile.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/resources/profile.js b/lib/resources/profile.js index f4644d4..46f318f 100644 --- a/lib/resources/profile.js +++ b/lib/resources/profile.js @@ -80,7 +80,7 @@ export class ProfileResponse { * @promise {object[]} returns list of profile Object * @fail {Error} returns Error */ - list(params) { + list(params) { return super.customexecuteAction(action,'GET', params); } @@ -90,7 +90,7 @@ export class ProfileResponse { * @param {string} profileUUID - id of profileUUID * @fail {Error} return Error */ - deelet(profileUUID) { + delete(profileUUID) { let params = {}; return super.customexecuteAction(action+profileUUID+'/', 'DELETE', params); } diff --git a/test/profile.js b/test/profile.js index 7fe00de..706c8f0 100644 --- a/test/profile.js +++ b/test/profile.js @@ -18,7 +18,7 @@ import { }); it('list profile', function () { - return client.profile.list() + return client.profile.list({}) .then(function (response) { assert.equal(response.profiles.length, 2) }) @@ -36,7 +36,7 @@ import { var address = {"street":"123", "city":"Band", "state":"NY", "postal_code":"10001", "country":"US"} return client.profile.create("vishnu104", "SECONDARY", "RESELLER","PRIVATE_PROFIT","ABC Inc", "111111111", "PROFESSIONAL", "US", "ABC","NASDAQ","NONE", "google.com", address,authorized_contact) .then(function (profile) { - assert.equal(profile.profile_uuid, '43d0616e-d50a-445a-a84e-310a089f0618') + assert.equal(profile.profileUuid, '43d0616e-d50a-445a-a84e-310a089f0618') }) }); }); \ No newline at end of file From e8f8a23832d3560254e99ac3f84529630daf4218 Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 31 Mar 2022 12:09:36 +0530 Subject: [PATCH 03/16] UT fix --- lib/rest/request-test.js | 2 +- test/profile.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index c1348de..ab4c9fe 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -1231,7 +1231,7 @@ export function Request(config) { } }); } - else if(action == 'Profile/' && method == 'LIST'){ + else if(action == 'Profile/' && method == 'GET'){ resolve({ response: {}, body: { diff --git a/test/profile.js b/test/profile.js index 706c8f0..fead5b0 100644 --- a/test/profile.js +++ b/test/profile.js @@ -27,7 +27,7 @@ import { it('delete profile', function () { return client.profile.delete("06ecae31-4bf8-40b9-ac62-e902418e9935") .then(function (response) { - assert.equal(response.api_id, "eb1e71ae-b01e-11ec-88b1-0242ac110002") + assert.equal(response.apiId, "eb1e71ae-b01e-11ec-88b1-0242ac110002") }) }); From d092a97e75b913561562e3bfd40e09aed4568d6d Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 31 Mar 2022 12:13:10 +0530 Subject: [PATCH 04/16] version upgrade --- CHANGELOG.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dec6dc0..7930961 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Change Log +## [v4.30.0](https://github.com/plivo/plivo-node/tree/v4.30.0) (2022-03-31) +**Features - Profile Api** +- Profile api added for 10dlc support ## [v4.29.1](https://github.com/plivo/plivo-node/tree/v4.29.1) (2022-03-25) **Bug Fix - DialElement** diff --git a/package.json b/package.json index 5614564..b12d46c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.29.1", + "version": "4.30.0", "description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML", "homepage": "https://github.com/plivo/plivo-node", "files": [ From 23fbb1fe423a8b9e564d50bce66ea6ccf11b1262 Mon Sep 17 00:00:00 2001 From: Dhruv Chauhan Date: Fri, 1 Apr 2022 16:29:19 +0530 Subject: [PATCH 05/16] add methods for 10dlc number linking --- lib/resources/campaign.js | 84 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/lib/resources/campaign.js b/lib/resources/campaign.js index 6e240b6..5879e85 100644 --- a/lib/resources/campaign.js +++ b/lib/resources/campaign.js @@ -45,6 +45,19 @@ export class CampaignCreateResponse { } } +export class LinkUnlinkNumberResponse { + constructor(params) { + params = params || {}; + this.apiId = params.apiId; + if (params.message) + this.message = params.message; + if (params.error) + this.error = params.error; + if (params.remark) + this.remark = params.remark; + } +} + /** * Represents a Campaign Interface * @constructor @@ -84,7 +97,6 @@ export class CampaignCreateResponse { return super.customexecuteAction(action,'GET', params); } - /** * create Campaign * @method @@ -133,7 +145,75 @@ export class CampaignCreateResponse { reject(error); }); }); - } + /** + * getNumber CampaignNumbers by given campaignId, number + * @method + * @param {string} campaignID - id of Campaign + * @param {string} number - number + * @promise {object} return {@link Campaign} object + * @fail {Error} return Error + */ + getNumber(campaignID, number) { + return super.customexecuteAction(action+campaignID+'/Number/'+number+'/', 'GET'); + } + + /** + * listNumber CampaignNumbers by given campaignId + * @method + * @param {string} campaignID - id of Campaign + * @param {number} limit + * @param {number} offset + * @promise {object} returns {@link Campaign} object + * @fail {Error} return Error + */ + listNumber(campaignID, limit=10, offset=0) { + return super.customexecuteAction(action+campaignID+'/Number/?limit='+limit+'&offset='+offset, 'GET'); + } + + /** + * linkNumber link number to Campaign + * @method + * @param {string} campaignID + * @param {string} number + * @promise {object} return {@link Campaign} object + * @fail {Error} return Error + */ + linkNumber(campaignID, number) { + let params = {} + params.number=number; + let client = this[clientKey]; + return new Promise((resolve, reject) => { + client('POST', action+campaignID+'/Number/', params) + .then(response => { + resolve(new LinkUnlinkNumberResponse(response.body)); + }) + .catch(error => { + reject(error); + }); + }); + } + + /** + * unlinkNumber unlink number from Campaign + * @method + * @param {string} campaignID + * @param {string} number + * @promise {object} return {@link Campaign} object + * @fail {Error} return Error + */ + unlinkNumber(campaignID, number) { + let params = {} + let client = this[clientKey]; + return new Promise((resolve, reject) => { + client('DELETE', action+campaignID+'/Number/'+number+'/', params) + .then(response => { + resolve(new LinkUnlinkNumberResponse(response.body)); + }) + .catch(error => { + reject(error); + }); + }); + } } \ No newline at end of file From c84db3f88a790846e95e0e16231e717a618c0bed Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 11 Apr 2022 18:22:14 +0530 Subject: [PATCH 06/16] brand creation api --- lib/resources/brand.js | 48 ++++---------- lib/rest/request-test.js | 132 ++++++++++++++++++++++----------------- test/brand.js | 7 +-- 3 files changed, 89 insertions(+), 98 deletions(-) diff --git a/lib/resources/brand.js b/lib/resources/brand.js index 15ab9db..2420153 100644 --- a/lib/resources/brand.js +++ b/lib/resources/brand.js @@ -36,7 +36,8 @@ export class BrandCreationResponse { constructor(params) { params = params || {}; this.apiId = params.apiId; - this.brand = params.brand; + this.brand_id = params.brandId; + this.message = params.message; } } @@ -79,45 +80,18 @@ export class BrandCreationResponse { * Brand Registration * @method * @param {object} params - * @param {string} city - * @param {string} company_name - * @param {string} country - * @param {string} ein - * @param {string} ein_issuing_country - * @param {string} email - * @param {string} entity_type - * @param {string} postal_code - * @param {string} registration_status - * @param {string} state - * @param {string} stock_exchange - * @param {string} stock_symbol - * @param {string} street - * @param {string} vertical - * @param {string} [params.website] - - * @param {string} [params.secondary_vetting] - * @param {string} [params.first_name] - * @param {string} [params.last_name] - * @param {string} [params.alt_business_id_type] - * @param {string} [params.alt_business_id] + * @param {string} brand_alias + * @param {string} profile_uuid + * @param {string} brand_type + * @param {string} secondary_vetting * @promise {object} return {@link PlivoGenericResponse} object * @fail {Error} return Error */ - create(city,company_name,country,ein,ein_issuing_country,email,entity_type,phone,postal_code,registration_status,state,stock_exchange,stock_symbol,street,vertical, params = {}) { - params.city=city; - params.company_name=company_name; - params.country=country; - params.ein=ein; - params.ein_issuing_country=ein_issuing_country; - params.email=email; - params.entity_type=entity_type; - params.phone=phone; - params.postal_code=postal_code; - params.registration_status=registration_status; - params.state=state; - params.stock_exchange=stock_exchange; - params.stock_symbol=stock_symbol; - params.street=street; - params.vertical=vertical; + create(brand_alias,profile_uuid,brand_type,secondary_vetting) { + params.brand_alias=brand_alias; + params.profile_uuid=profile_uuid; + params.brand_type=brand_type; + params.secondary_vetting=secondary_vetting; let client = this[clientKey]; let idField = this[idKey]; return new Promise((resolve, reject) => { diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index cda9dc4..2b2de22 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -1216,18 +1216,30 @@ export function Request(config) { resolve({ response: {}, body: { - api_id: "71aa47e0-3750-11ec-8e4c-0242ac110002", - brand: { - brand_id: "BRPXS6E", - company_name: "ABC Inc.", - ein: "111111111", - ein_issuing_country: "US", - email: "johndoe@abc.com", - entity_type: "PRIVATE_PROFIT", - registration_status: "COMPLETED", - vertical: "RETAIL", - website: "http://www.abcmobile.com" - } + api_id: "4bac497c-b963-11ec-b7ca-0242ac110002", + brand: { + address: { + city: "New York", + country: "IN", + postal_code: "10001", + state: "NY", + street: "123" + }, + authorized_contact: { + email: "vishnu@plivo.com", + first_nam: "vishnu", + last_name: "Doe", + phone: "919742763781", + seniority: "admin", + title: "Doe" + }, + brand_id: "B1QSGGS", + ein_issuing_country: "IN", + entity_type: "SOLE_PROPRIETOR", + profile_uuid: "3cf3e991-2f94-4910-9712-61442987a2d0", + registration_status: "COMPLETED", + vertical: "ENTERTAINMENT" + } } }); } @@ -1249,7 +1261,8 @@ export function Request(config) { Verizon_Wireless: {} }, reseller_id: "RPDPPUM", - usecase: "ACCOUNT_NOTIFICATION" + usecase: "ACCOUNT_NOTIFICATION", + sub_usecase: "2FA,ACCOUNT_NOTIFICATION" } } }); @@ -1260,28 +1273,48 @@ export function Request(config) { body: { api_id: "b9df43c0-374c-11ec-97b3-0242ac110002", brands: [ - { - brand_id: "ABCDEFG", - company_name: "ABC Inc.", - ein: "111111111", - ein_issuing_country: "US", - email: "johndoe@abc.com", - entity_type: "PRIVATE_PROFIT", - registration_status: "COMPLETED", - vertical: "RETAIL", - website: "http://www.abcmobile.com" + { + address: { + city: "", + country: "", + postal_code: "", + state: "", + street: "" }, - { - brand_id: "QWERTYU", - company_name: "ABC Inc.", - ein: "111111111", - ein_issuing_country: "US", - email: "johndoe@abc.com", - entity_type: "PRIVATE_PROFIT", - registration_status: "COMPLETED", - vertical: "RETAIL", - website: "http://www.abcmobile.com" - } + authorized_contact: {}, + brand_alias: "Ren_With_Vetting", + brand_id: "BXZRASW", + company_name: "Ren_With_Vetting", + ein: "2342334534231", + ein_issuing_country: "IN", + entity_type: "NON_PROFIT", + registration_status: "COMPLETED", + vertical: "COMMUNICATION", + vetting_score: 80, + vetting_status: "ACTIVE", + website: "www.renold.com" + }, + { + address: { + city: "", + country: "", + postal_code: "", + state: "", + street: "" + }, + authorized_contact: {}, + brand_alias: "CSP Testing 003", + brand_id: "BMIORKY", + company_name: "CSP Testing 003", + ein: "234234234", + ein_issuing_country: "IN", + entity_type: "PUBLIC_PROFIT", + registration_status: "COMPLETED", + vertical: "COMMUNICATION", + vetting_score: 80, + vetting_status: "ACTIVE", + website: "www.standard1.com" + } ] } }); @@ -1305,7 +1338,8 @@ export function Request(config) { Verizon_Wireless: {} }, reseller_id: "RPDPPUM", - usecase: "ACCOUNT_NOTIFICATION" + usecase: "ACCOUNT_NOTIFICATION", + sub_usecase: "2FA,ACCOUNT_NOTIFICATION" }, { brand_id: "B8OD95Z", @@ -1321,7 +1355,8 @@ export function Request(config) { Verizon_Wireless: {} }, reseller_id: "", - usecase: "MIXED" + usecase: "MIXED", + sub_usecase: "2FA,ACCOUNT_NOTIFICATION" } ] } @@ -1331,27 +1366,10 @@ export function Request(config) { resolve({ response: {}, body: { - api_id: "a52a5398-3751-11ec-8e4c-0242ac110002", - brand: { - alt_business_id_type: "GIIN", - brand_id: "BVI0UQA", - city: "New York", - country: "US", - ein_issuing_country: "US", - email: "johndoe@abc.com", - entity_type: "SOLE_PROPRIETOR", - first_name: "John", - last_name: "Doe", - phone: "+11234567890", - postal_code: "10001", - registration_status: "PENDING", - state: "NY", - stock_exchange: "NASDAQ", - stock_symbol: "ABC", - street: "123", - vertical: "RETAIL", - website: "http://www.abcmobile.com" - } + + api_id: "ab2e4754-b951-11ec-b7ca-0242ac110002", + brand_id: "B1QSGGS", + message: "Request to create brand was received and is being processed." } }); } diff --git a/test/brand.js b/test/brand.js index 229124f..37eacdd 100644 --- a/test/brand.js +++ b/test/brand.js @@ -13,7 +13,7 @@ import { it('should get brand', function () { return client.brand.get('BRPXS6E') .then(function (brand) { - assert.equal(brand.brand.brandId, 'BRPXS6E') + assert.equal(brand.brand.brandId, 'B1QSGGS') }) }); @@ -25,10 +25,9 @@ import { }); it('create brand', function () { - return client.brand.create("New York","ABC Inc.", "US", "111111111","US","johndoe@abc.com","PRIVATE_PROFIT","+11234567890","10001","PENDING", - "NY", "NASDAQ","ABC","123", "RETAIL") + return client.brand.create("vishnu128", "3cf3e991-2f94-4910-9712-61442987a2d0","starter", false) .then(function (brand) { - assert.equal(brand.brand.brandId, 'BVI0UQA') + assert.equal(brand.brandId, 'B1QSGGS') }) }); From b47ddce6ad8f6922d5b39eea0203a3185358b9ad Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 11 Apr 2022 18:26:32 +0530 Subject: [PATCH 07/16] profile changes --- lib/resources/profile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/resources/profile.js b/lib/resources/profile.js index 46f318f..5d59ce4 100644 --- a/lib/resources/profile.js +++ b/lib/resources/profile.js @@ -99,7 +99,7 @@ export class ProfileResponse { * Create a new Profile * * @param {string} profile_alias - * @param {string} profile_type + * @param {string} plivo_subaccount * @param {string} customer_type * @param {string} entity_type * @param {string} company_name @@ -114,10 +114,10 @@ export class ProfileResponse { * @param {object} authorized_contact * @return profileResponse response output */ - create(profile_alias,profile_type,customer_type,entity_type, company_name,ein,vertical,ein_issuing_country,stock_symbol,stock_exchange, alt_business_id_type, website, address, authorized_contact){ + create(profile_alias,plivo_subaccount,customer_type,entity_type, company_name,ein,vertical,ein_issuing_country,stock_symbol,stock_exchange, alt_business_id_type, website, address, authorized_contact){ let params = {} params.profile_alias=profile_alias; - params.profile_type=profile_type; + params.plivo_subaccount=plivo_subaccount; params.customer_type=customer_type; params.entity_type=entity_type; params.company_name=company_name; From 9cb89d65dde0d6fede20ae9e8e5f672aa4cb4f6b Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 11 Apr 2022 18:38:01 +0530 Subject: [PATCH 08/16] build fix --- lib/resources/brand.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/resources/brand.js b/lib/resources/brand.js index 2420153..7e93b23 100644 --- a/lib/resources/brand.js +++ b/lib/resources/brand.js @@ -88,6 +88,7 @@ export class BrandCreationResponse { * @fail {Error} return Error */ create(brand_alias,profile_uuid,brand_type,secondary_vetting) { + let params = {}; params.brand_alias=brand_alias; params.profile_uuid=profile_uuid; params.brand_type=brand_type; From 3945833e30e0a4e47f83ef3fb10e92890c13cb8c Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 11 Apr 2022 18:43:39 +0530 Subject: [PATCH 09/16] ut fix --- lib/rest/request-test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index 2b2de22..06efd20 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -1366,7 +1366,6 @@ export function Request(config) { resolve({ response: {}, body: { - api_id: "ab2e4754-b951-11ec-b7ca-0242ac110002", brand_id: "B1QSGGS", message: "Request to create brand was received and is being processed." From 57cf09c0a5193dea694642eb34e9db20fcdc8dfa Mon Sep 17 00:00:00 2001 From: Dhruv Chauhan Date: Wed, 13 Apr 2022 15:17:42 +0530 Subject: [PATCH 10/16] update linkNumber req payload --- lib/resources/campaign.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/resources/campaign.js b/lib/resources/campaign.js index 5879e85..7256cc8 100644 --- a/lib/resources/campaign.js +++ b/lib/resources/campaign.js @@ -176,13 +176,13 @@ export class LinkUnlinkNumberResponse { * linkNumber link number to Campaign * @method * @param {string} campaignID - * @param {string} number + * @param {list} numbers * @promise {object} return {@link Campaign} object * @fail {Error} return Error */ - linkNumber(campaignID, number) { + linkNumber(campaignID, numbers) { let params = {} - params.number=number; + params.numbers=numbers; let client = this[clientKey]; return new Promise((resolve, reject) => { client('POST', action+campaignID+'/Number/', params) From 66b435227c5a5df16846ff67012049cf1af749b7 Mon Sep 17 00:00:00 2001 From: narayana Date: Wed, 13 Apr 2022 16:25:41 +0530 Subject: [PATCH 11/16] profile message added --- lib/resources/profile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/resources/profile.js b/lib/resources/profile.js index 5d59ce4..cf48d8c 100644 --- a/lib/resources/profile.js +++ b/lib/resources/profile.js @@ -42,6 +42,7 @@ export class ProfileResponse { params = params || {}; this.apiId = params.apiId; this.profileUuid = params.profileUuid; + this.message = params.message; } } From 3139986becf9fb7c00be73f95072055ae662413e Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 14 Apr 2022 09:42:58 +0530 Subject: [PATCH 12/16] campaign response change --- lib/resources/campaign.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/resources/campaign.js b/lib/resources/campaign.js index 6e240b6..514c160 100644 --- a/lib/resources/campaign.js +++ b/lib/resources/campaign.js @@ -41,7 +41,9 @@ export class CampaignCreateResponse { constructor(params) { params = params || {}; this.apiId = params.apiId; - this.campaign = params.campaign; + this.campaignId = params.campaignId; + this.message = params.message; + this.error = params.error; } } From 8c5d6b49a990f088815d31ea21fd095bf18990d7 Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 14 Apr 2022 12:08:50 +0530 Subject: [PATCH 13/16] fixing list number --- lib/resources/campaign.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/resources/campaign.js b/lib/resources/campaign.js index 7256cc8..15768b4 100644 --- a/lib/resources/campaign.js +++ b/lib/resources/campaign.js @@ -168,8 +168,8 @@ export class LinkUnlinkNumberResponse { * @promise {object} returns {@link Campaign} object * @fail {Error} return Error */ - listNumber(campaignID, limit=10, offset=0) { - return super.customexecuteAction(action+campaignID+'/Number/?limit='+limit+'&offset='+offset, 'GET'); + listNumber(campaignID, params) { + return super.customexecuteAction(action+campaignID+'/Number/', 'GET', params); } /** From f03716e9bb95648a1d4a6111dddd144548c84de9 Mon Sep 17 00:00:00 2001 From: Mohammed Huzaif Date: Thu, 14 Apr 2022 19:24:11 +0530 Subject: [PATCH 14/16] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7930961..e13ee89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change Log -## [v4.30.0](https://github.com/plivo/plivo-node/tree/v4.30.0) (2022-03-31) + +## [v4.30.0](https://github.com/plivo/plivo-node/tree/v4.30.0) (2022-04-14) **Features - Profile Api** - Profile api added for 10dlc support From 125c7cdd0ca7634df7363e5089fdda32c01438e0 Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 14 Apr 2022 20:27:00 +0530 Subject: [PATCH 15/16] ut fix --- lib/rest/request-test.js | 19 +++---------------- test/brand.js | 2 +- test/campaign.js | 2 +- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index fa60ca0..2e2fe1d 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -1495,22 +1495,9 @@ export function Request(config) { resolve({ response: {}, body: { - api_id: "12ae5a32-3751-11ec-8e4c-0242ac110002", - campaign: { - brand_id: "BHYYNCK", - campaign_id: "CMPT4EP", - mno_metadata: { - AT_T: { - tpm: 4500 - }, - T_Mobile: { - brand_tier: "TOP" - }, - Verizon_Wireless: {} - }, - reseller_id: "RPDPPUM", - usecase: "ACCOUNT_NOTIFICATION" - } + apiId: '5b058374-bba8-11ec-ab4d-0242ac110002', + campaignId: 'CFSOBZQ', + message: 'Request to create campaign was received and is being processed.' } }); } diff --git a/test/brand.js b/test/brand.js index 37eacdd..4721161 100644 --- a/test/brand.js +++ b/test/brand.js @@ -27,7 +27,7 @@ import { it('create brand', function () { return client.brand.create("vishnu128", "3cf3e991-2f94-4910-9712-61442987a2d0","starter", false) .then(function (brand) { - assert.equal(brand.brandId, 'B1QSGGS') + assert.equal(brand.brand.brand_id, 'B1QSGGS') }) }); diff --git a/test/campaign.js b/test/campaign.js index b442f26..9cb53a8 100644 --- a/test/campaign.js +++ b/test/campaign.js @@ -30,7 +30,7 @@ import { "2FA" ],"sample description text",false,false,false,false,true,true,true,"sample1","sample2") .then(function (campaign) { - assert.equal(campaign.campaign.brandId, 'BHYYNCK') + assert.equal(campaign.campaignId, 'CFSOBZQ') }) }); }); \ No newline at end of file From 65281415a08aa6999bc730339bbd59679cc61281 Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 14 Apr 2022 20:37:16 +0530 Subject: [PATCH 16/16] ut fix --- test/brand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/brand.js b/test/brand.js index 4721161..e960f16 100644 --- a/test/brand.js +++ b/test/brand.js @@ -27,7 +27,7 @@ import { it('create brand', function () { return client.brand.create("vishnu128", "3cf3e991-2f94-4910-9712-61442987a2d0","starter", false) .then(function (brand) { - assert.equal(brand.brand.brand_id, 'B1QSGGS') + assert.equal(brand.brand_id, 'B1QSGGS') }) });