Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions lib/resources/tollfree_verification.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ export class TollfreeVerification extends PlivoResource {
* @param {string} [params.volume] - The monthly volume estimation of messages from the Toll-Free Number.
* @param {string} [params.additional_information] - Any additional information related to the website. Max character limit = 500.
* @param {string} [params.extra_data] - Any extra information which the customer would like to pass for internal references.
* @param {string} [params.callback_url] - A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_url] - A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_method] - Valid Input: GET, POST
* @param {string} [params.terms_and_conditions_link] - A valid URL to the terms and conditions.
* @param {string} [params.privacy_policy_link] - A valid URL to the privacy policy.
* @param {string} [params.optin_message] - The opt-in message shown to the end user.
* @param {string} [params.help_message] - The help message sent in response to the HELP keyword.
* @promise {object} return {@link UpdateTollfreeVerificationResponse} object
* @fail {Error} return Error
*/
Expand Down Expand Up @@ -236,8 +240,12 @@ export class TollfreeVerificationInterface extends PlivoResourceInterface {
* @param {string} [params.additional_information] Any additional information related to the website. Max character limit = 500.
* @param {string} [params.extra_data] Any extra information which the customer would like to pass for internal references.
* @param {string} [params.number] The toll free number in e.164 for which verification is being initiated. Only single US/CA number can be provided
* @param {string} [params.callback_url] A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_url] A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_method] Valid Input: GET, POST
* @param {string} [params.terms_and_conditions_link] A valid URL to the terms and conditions.
* @param {string} [params.privacy_policy_link] A valid URL to the privacy policy.
* @param {string} [params.optin_message] The opt-in message shown to the end user.
* @param {string} [params.help_message] The help message sent in response to the HELP keyword.
* @promise {object} return {@link TollfreeVerification} object
* @fail {Error} return Error
*/
Expand Down Expand Up @@ -268,8 +276,12 @@ export class TollfreeVerificationInterface extends PlivoResourceInterface {
* @param {string} [params.volume] The monthly volume estimation of messages from the Toll-Free Number.
* @param {string} [params.additional_information] Any additional information related to the website. Max character limit = 500.
* @param {string} [params.extra_data] Any extra information which the customer would like to pass for internal references.
* @param {string} [params.callback_url] A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_method] Valid Input: GET, POST
* @param {string} [params.callback_url] A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_method] Valid Input: GET, POST
* @param {string} [params.terms_and_conditions_link] A valid URL to the terms and conditions.
* @param {string} [params.privacy_policy_link] A valid URL to the privacy policy.
* @param {string} [params.optin_message] The opt-in message shown to the end user.
* @param {string} [params.help_message] The help message sent in response to the HELP keyword.
* @promise {object} return {@link TollfreeVerification} object
* @fail {Error} return Error
*/
Expand Down
30 changes: 28 additions & 2 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2773,6 +2773,20 @@ export function Request(config) {
}

// =========== TollfreeVerification Methods ============================
else if (method == 'POST' && action == 'TollfreeVerification/'
&& params.terms_and_conditions_link === 'https://plivo.com/terms'
&& params.privacy_policy_link === 'https://plivo.com/privacy'
&& params.optin_message === 'You have opted in to receive messages from Plivo'
&& params.help_message === 'Reply HELP for help, STOP to unsubscribe') {
resolve({
response: {},
body: {
message: 'created with zipwhip fields',
uuid: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
api_id: 'db342550-7f1d-11e1-8ea7-1231380bc196'
}
});
}
else if (method == 'POST' && action == 'TollfreeVerification/') {
resolve({
response: {},
Expand All @@ -2781,7 +2795,7 @@ export function Request(config) {
uuid: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
api_id: 'db342550-7f1d-11e1-8ea7-1231380bc196'
}
});
});
} else if (method == 'GET' && action == 'TollfreeVerification/') {
resolve({
response: {},
Expand Down Expand Up @@ -2860,14 +2874,26 @@ export function Request(config) {
volume: '100'
}
});
} else if (method == 'POST' && action == 'TollfreeVerification/1/'
&& params.terms_and_conditions_link === 'https://plivo.com/terms'
&& params.privacy_policy_link === 'https://plivo.com/privacy'
&& params.optin_message === 'You have opted in to receive messages from Plivo'
&& params.help_message === 'Reply HELP for help, STOP to unsubscribe') {
resolve({
response: {},
body: {
message: 'Tollfree verification request for 18XXXXXXXXX updated succesfully with zipwhip fields',
api_id: 'db342550-7f1d-11e1-8ea7-1231380bc196'
}
});
} else if (method == 'POST' && action == 'TollfreeVerification/1/') {
resolve({
response: {},
body: {
message: 'Tollfree verification request for 18XXXXXXXXX updated succesfully',
api_id: 'db342550-7f1d-11e1-8ea7-1231380bc196'
}
});
});
} else if (method == 'DELETE' && action == 'TollfreeVerification/1/') {
resolve({
response: {},
Expand Down
24 changes: 23 additions & 1 deletion test/tollfree_verification.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,35 @@ describe('TollfreeVerification', function () {
.then(function(response){
assert.equal(response.message, 'created')
})
});
});
it('create TollfreeVerification with zipwhip fields', function () {
return client.tollfreeVerification.create({
terms_and_conditions_link: 'https://plivo.com/terms',
privacy_policy_link: 'https://plivo.com/privacy',
optin_message: 'You have opted in to receive messages from Plivo',
help_message: 'Reply HELP for help, STOP to unsubscribe'
})
.then(function(response){
assert.equal(response.message, 'created with zipwhip fields')
})
});
it('update response', function () {
return client.tollfreeVerification.update(1, {extra_data: 'extra_data'})
.then(function(response) {
assert.equal(response.message, 'Tollfree verification request for 18XXXXXXXXX updated succesfully')
})
});
it('update TollfreeVerification with zipwhip fields', function () {
return client.tollfreeVerification.update(1, {
terms_and_conditions_link: 'https://plivo.com/terms',
privacy_policy_link: 'https://plivo.com/privacy',
optin_message: 'You have opted in to receive messages from Plivo',
help_message: 'Reply HELP for help, STOP to unsubscribe'
})
.then(function(response) {
assert.equal(response.message, 'Tollfree verification request for 18XXXXXXXXX updated succesfully with zipwhip fields')
})
});

it('delete response', function () {
return client.tollfreeVerification.delete(1)
Expand Down
28 changes: 24 additions & 4 deletions types/resources/tollfree_verification.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,22 @@ export class TollfreeVerificationInterface extends PlivoResourceInterface {
* @param {string} [params.additional_information] - Any additional information related to the website. Max character limit = 500.
* @param {string} [params.extra_data] - Any extra information which the customer would like to pass for internal references.
* @param {string} [params.number] - The toll free number in e.164 for which verification is being initiated. Only single US/CA number can be provided
* @param {string} [params.callback_url] - A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_url] - A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_method] - Valid Input: GET, POST
* @param {string} [params.terms_and_conditions_link] - A valid URL to the terms and conditions.
* @param {string} [params.privacy_policy_link] - A valid URL to the privacy policy.
* @param {string} [params.optin_message] - The opt-in message shown to the end user.
* @param {string} [params.help_message] - The help message sent in response to the HELP keyword.
* @promise {object} return {@link PlivoGenericResponse} object
* @fail {Error} return Error
*/
create(params?: {}): Promise<CreateTollfreeVerificationResponse>;
create(params?: {
terms_and_conditions_link?: string;
privacy_policy_link?: string;
optin_message?: string;
help_message?: string;
[key: string]: any;
}): Promise<CreateTollfreeVerificationResponse>;

/**
* update TollfreeVerification request
Expand All @@ -132,12 +142,22 @@ export class TollfreeVerificationInterface extends PlivoResourceInterface {
* @param {string} [params.volume] - The monthly volume estimation of messages from the Toll-Free Number.
* @param {string} [params.additional_information] - Any additional information related to the website. Max character limit = 500.
* @param {string} [params.extra_data] - Any extra information which the customer would like to pass for internal references.
* @param {string} [params.callback_url] - A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_url] - A valid URL where verification relatated callbacks will be sent.
* @param {string} [params.callback_method] - Valid Input: GET, POST
* @param {string} [params.terms_and_conditions_link] - A valid URL to the terms and conditions.
* @param {string} [params.privacy_policy_link] - A valid URL to the privacy policy.
* @param {string} [params.optin_message] - The opt-in message shown to the end user.
* @param {string} [params.help_message] - The help message sent in response to the HELP keyword.
* @promise {object} return {@link TollfreeVerification} object
* @fail {Error} return Error
*/
update(uuid: string, params?: {}): Promise<UpdateTollfreeVerificationResponse>;
update(uuid: string, params?: {
terms_and_conditions_link?: string;
privacy_policy_link?: string;
optin_message?: string;
help_message?: string;
[key: string]: any;
}): Promise<UpdateTollfreeVerificationResponse>;

/**
* delete TollfreeVerification request
Expand Down
Loading