Skip to content

Commit

Permalink
Add compiled submitted evidence endpoint to disputes (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko authored Mar 26, 2024
1 parent 84f6d95 commit 5493675
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/api/disputes/disputes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object>} 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.
Expand Down
18 changes: 18 additions & 0 deletions test/disputes/disputes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 5493675

Please sign in to comment.