VT-3755 StirShaken phase 2 - SDK implementation Added Mock response

This commit is contained in:
abinaya-plivo 2021-12-08 13:36:54 +05:30
parent 98378aaa6a
commit defdf92b5f
2 changed files with 76 additions and 5 deletions

View file

@ -47,7 +47,11 @@ export function Request(config) {
"to": "14154290945",
"caller_name": "+15856338537",
"call_uuid": "6653422-91b6-4716-9fad-9463daaeeec2",
"session_start": "2014-03-23 14:49:39.722551"
"session_start": "2014-03-23 14:49:39.722551",
"request_uuid": "d0a87a1a-b0e9-4ab2-ac07-c22ee87cd04a",
"stir_verification": "Verified",
"stir_attestation": "A"
}
});
}
@ -77,7 +81,56 @@ export function Request(config) {
resolve({
response: {},
body: {
objects: []
"api_id": "8299d094-dc72-11e5-b56c-22000ae90795",
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 4
},
objects: [
{
"answer_time": "2015-07-26 15:45:02+05:30",
"api_id": "06ae0f8f-dc72-11e5-b56c-22000ae90795",
"bill_duration": 924,
"billed_duration": 960,
"call_direction": "outbound",
"call_duration": 924,
"call_uuid": "eba53b9e-8fbd-45c1-9444-696d2172fbc8",
"end_time": "2015-07-26 15:45:14+05:30",
"from_number": "+14158572518",
"initiation_time": "2015-07-26 15:44:49+05:30",
"parent_call_uuid": null,
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Call/eba53b9e-8fbd-45c1-9444-696d2172fbc8/",
"to_number": "14153268174",
"total_amount": "0.13600",
"total_rate": "0.00850",
"stir_verification": "Not Verified",
"voice_network_group": "USA All Networks",
"stir_attestation": ""
},
{
"answer_time": "2015-07-26 16:45:02+05:30",
"api_id": "06ae0f8f-dc72-11e5-b56c-22000ae90795",
"bill_duration": 924,
"billed_duration": 960,
"call_direction": "outbound",
"call_duration": 924,
"call_uuid": "eba53b9e-8fbd-45c1-9444-696d2172fbc8",
"end_time": "2015-07-26 16:45:14+05:30",
"from_number": "+14158572518",
"initiation_time": "2015-07-26 16:44:49+05:30",
"parent_call_uuid": null,
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Call/eba53b9e-8fbd-45c1-9444-696d2172fbc8/",
"to_number": "14153268174",
"total_amount": "0.13600",
"total_rate": "0.00850",
"stir_verification": "Verified",
"voice_network_group": "USA All Networks",
"stir_attestation": "A"
}
]
}
});
}
@ -91,12 +144,30 @@ export function Request(config) {
}
});
}
//Get CDR (Retrieve a call)
else if (action == 'Call/aaa-deeiei3-dfddd/' && method == 'GET') {
resolve({
response: {},
body: {
id: 1,
call_uuid: 'aaa-deeiei3-dfddd'
"id": '1',
"call_uuid": 'aaa-deeiei3-dfddd',
"answer_time": null,
"api_id": "95727cf4-3eeb-11e7-8edf-02ed609bd62b",
"bill_duration": 0,
"billed_duration": 0,
"call_direction": "outbound",
"call_duration": 0,
"end_time": "2017-05-22 17:49:40+05:30",
"from_number": "+919879879876",
"initiation_time": "2017-05-22 17:49:30+05:30",
"parent_call_uuid": null,
"resource_uri": "/v1/Account/MAJHUDTEYWLSIUYTDBCZ/Call/4d04c52e-cea3-4458-bbdb-0bfc314ee7cd/",
"to_number": "919999999999",
"total_amount": "0.00000",
"total_rate": "0.03570",
"stir_verification": "Not Applicable",
"voice_network_group": "India All Networks",
"stir_attestation": ""
}
});
}

View file

@ -51,7 +51,7 @@ describe('calls', function () {
it('should get list of calls!', function (done) {
client.calls.list()
.then(function(calls){
assert.equal(calls.length, 0)
assert.equal(calls.length, 2)
done()
})
.catch(function(e) {