diff --git a/src/api/disputes/disputes.js b/src/api/disputes/disputes.js index 187b428..a8b9eae 100644 --- a/src/api/disputes/disputes.js +++ b/src/api/disputes/disputes.js @@ -165,6 +165,29 @@ export default class Disputes { } } + /** + * Returns all of the scheme files of a dispute using the dispute identifier. + * Currently available only for VISA disputes. + * + * @memberof Disputes + * @param {string} disputeId Dispute id. + * @return {Promise} A promise to the dispute scheme files response. + */ + async getCompiledSubmittedEvidence(disputeId) { + try { + const response = await get( + this.config.httpClient, + `${this.config.host}/disputes/${disputeId}/evidence/submitted`, + this.config, + this.config.sk + ); + return await response.json; + } catch (err) { + const error = await determineError(err); + throw error; + } + } + /** * Returns all of the scheme files of a dispute using the dispute identifier. * Currently available only for VISA disputes. diff --git a/test/disputes/disputes.js b/test/disputes/disputes.js index 14d1f85..43df0ff 100644 --- a/test/disputes/disputes.js +++ b/test/disputes/disputes.js @@ -708,6 +708,24 @@ describe('Disputes', () => { } }); + it('should get compiled submitted evidence', async () => { + nock('https://api.sandbox.checkout.com') + .get('/disputes/dsp_3dc29c89ce075g46136d/evidence/submitted') + .reply(200, { + file_id: 'file_iweu3nxyt6zund3gwhg7wo4fhq', + _links: { + self: { + href: 'https://api.checkout.com/disputes/dsp_3dc29c89ce075g46136d/evidence/submitted', + }, + }, + }); + + const cko = new Checkout(SK); + + const compiledSubmittedEvidence = await cko.disputes.getCompiledSubmittedEvidence('dsp_3dc29c89ce075g46136d'); + expect(compiledSubmittedEvidence.file_id).to.equal('file_iweu3nxyt6zund3gwhg7wo4fhq'); + }); + it('should get dispute scheme files', async () => { nock('https://api.sandbox.checkout.com') .get('/disputes/dsp_3dc29c89ce075g46136d/schemefiles')