From c84db3f88a790846e95e0e16231e717a618c0bed Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 11 Apr 2022 18:22:14 +0530 Subject: [PATCH 1/4] 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 15ab9dbc..2420153e 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 cda9dc42..2b2de225 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 229124f0..37eacdd2 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 9cb89d65dde0d6fede20ae9e8e5f672aa4cb4f6b Mon Sep 17 00:00:00 2001 From: narayana Date: Mon, 11 Apr 2022 18:38:01 +0530 Subject: [PATCH 2/4] 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 2420153e..7e93b230 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 3/4] 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 2b2de225..06efd20c 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 3139986becf9fb7c00be73f95072055ae662413e Mon Sep 17 00:00:00 2001 From: narayana Date: Thu, 14 Apr 2022 09:42:58 +0530 Subject: [PATCH 4/4] 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 6e240b6a..514c160f 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; } }