diff --git a/src/api/disputes/disputes.js b/src/api/disputes/disputes.js index 187b428..d91ea6a 100644 --- a/src/api/disputes/disputes.js +++ b/src/api/disputes/disputes.js @@ -165,6 +165,30 @@ export default class Disputes { } } + /** + * Retrieves the unique identifier of the PDF file containing all the evidence submitted to represent the dispute case. + * To retrieve the file's download link, call the GET /files/{file_id} endpoint with the returned file ID. + * Evidence submitted before February 2024 cannot be retrieved using this endpoint. + * + * @memberof Disputes + * @param {string} disputeId Dispute id. + * @return {Promise} A promise to the compiled submitted evidence 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')