From defdf92b5ffcb9b0babcff3a3f325c02cfd66a27 Mon Sep 17 00:00:00 2001 From: abinaya-plivo Date: Wed, 8 Dec 2021 13:36:54 +0530 Subject: [PATCH] VT-3755 StirShaken phase 2 - SDK implementation Added Mock response --- lib/rest/request-test.js | 79 ++++++++++++++++++++++++++++++++++++++-- test/calls.js | 2 +- 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index cda9dc4..4149c32 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -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": "" } }); } diff --git a/test/calls.js b/test/calls.js index 05fdd52..ec65484 100644 --- a/test/calls.js +++ b/test/calls.js @@ -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) {