-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathDisputeDocuments.js
65 lines (57 loc) · 2.18 KB
/
DisputeDocuments.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @module DisputeDocuments
* @desc [MangoPay Dispute Documents API Reference](https://docs.mangopay.com/endpoints/v2.01/dispute-documents)
*/
var _ = require('underscore');
var Service = require('../service');
var DisputeDocument = require('../models/DisputeDocument');
var DisputeDocuments = Service.extend({
/**
* Gets dispute's document
* @param {number} documentId Document identifier
* @param {Function} callback Callback function
* @param {Object} options Request options
* @return {Object} Request promise
*/
get: function (documentId, callback, options) {
options = this._api._getOptions(callback, options, {
path: {
id: documentId
},
dataClass: DisputeDocument
});
return this._api.method('disputes_document_get', callback, options);
},
/**
* Gets dispute's documents for client
* @param {Function} callback Callback function
* @param {Object} options Request options
* @return {Object} Request promise
*/
getAll: function (callback, options) {
if (options && !options.hasOwnProperty('parameters'))
Object.assign(options, {parameters: {...options}});
options = this._api._getOptions(callback, options, {
dataClass: DisputeDocument
});
return this._api.method('disputes_document_all', callback, options);
},
/**
* Creates temporary URLs where each page of a dispute document can be viewed.
*
* @param {string} documentId Document identifier
* @param {Function} callback Callback function
* @param {Object} options Request options
* @return {Object} Request promise
*/
createDisputeDocumentConsult: function (documentId, callback, options) {
options = this._api._getOptions(callback, options, {
path: {
id: documentId
},
dataClass: DisputeDocument
});
return this._api.method('disputes_document_create_consult', callback, options);
}
});
module.exports = DisputeDocuments;