Skip to content

Commit

Permalink
Add compiled submitted evidence endpoint to disputes
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko committed Mar 25, 2024
1 parent 84f6d95 commit d161873
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/api/disputes/disputes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object>} 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.
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 d161873

Please sign in to comment.