Skip to content

Commit

Permalink
Merge pull request #246 from plivo/brand-api
Browse files Browse the repository at this point in the history
brand creation api
  • Loading branch information
huzaif-plivo authored Apr 14, 2022
2 parents abc1f8c + 3139986 commit 5f86b4e
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 99 deletions.
49 changes: 12 additions & 37 deletions lib/resources/brand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -79,45 +80,19 @@ 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) {
let params = {};
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) => {
Expand Down
4 changes: 3 additions & 1 deletion lib/resources/campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
131 changes: 74 additions & 57 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: "[email protected]",
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: "[email protected]",
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"
}
}
});
}
Expand All @@ -1249,7 +1261,8 @@ export function Request(config) {
Verizon_Wireless: {}
},
reseller_id: "RPDPPUM",
usecase: "ACCOUNT_NOTIFICATION"
usecase: "ACCOUNT_NOTIFICATION",
sub_usecase: "2FA,ACCOUNT_NOTIFICATION"
}
}
});
Expand All @@ -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: "[email protected]",
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: "[email protected]",
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"
}
]
}
});
Expand All @@ -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",
Expand All @@ -1321,7 +1355,8 @@ export function Request(config) {
Verizon_Wireless: {}
},
reseller_id: "",
usecase: "MIXED"
usecase: "MIXED",
sub_usecase: "2FA,ACCOUNT_NOTIFICATION"
}
]
}
Expand All @@ -1331,27 +1366,9 @@ 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: "[email protected]",
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."
}
});
}
Expand Down
7 changes: 3 additions & 4 deletions test/brand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
});

Expand All @@ -25,10 +25,9 @@ import {
});

it('create brand', function () {
return client.brand.create("New York","ABC Inc.", "US", "111111111","US","[email protected]","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')
})
});

Expand Down

0 comments on commit 5f86b4e

Please sign in to comment.