-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathdisputesApi.ts
128 lines (118 loc) · 6.09 KB
/
disputesApi.ts
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* The version of the OpenAPI document: v30
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import { AcceptDisputeRequest } from "../typings/disputes/models";
import { AcceptDisputeResponse } from "../typings/disputes/models";
import { DefendDisputeRequest } from "../typings/disputes/models";
import { DefendDisputeResponse } from "../typings/disputes/models";
import { DefenseReasonsRequest } from "../typings/disputes/models";
import { DefenseReasonsResponse } from "../typings/disputes/models";
import { DeleteDefenseDocumentRequest } from "../typings/disputes/models";
import { DeleteDefenseDocumentResponse } from "../typings/disputes/models";
import { SupplyDefenseDocumentRequest } from "../typings/disputes/models";
import { SupplyDefenseDocumentResponse } from "../typings/disputes/models";
import { IRequest } from "../typings/requestOptions";
import Resource from "./resource";
import { ObjectSerializer } from "../typings/disputes/models";
export class DisputesAPI extends Service {
private readonly API_BASEPATH: string = "https://ca-test.adyen.com/ca/services/DisputeService/v30";
private baseUrl: string;
public constructor(client: Client) {
super(client);
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}
/**
* @summary Accept a dispute
* @param acceptDisputeRequest {@link AcceptDisputeRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link AcceptDisputeResponse }
*/
public async acceptDispute(acceptDisputeRequest: AcceptDisputeRequest, requestOptions?: IRequest.Options): Promise<AcceptDisputeResponse> {
const endpoint = `${this.baseUrl}/acceptDispute`;
const resource = new Resource(this, endpoint);
const request: AcceptDisputeRequest = ObjectSerializer.serialize(acceptDisputeRequest, "AcceptDisputeRequest");
const response = await getJsonResponse<AcceptDisputeRequest, AcceptDisputeResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "AcceptDisputeResponse");
}
/**
* @summary Defend a dispute
* @param defendDisputeRequest {@link DefendDisputeRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link DefendDisputeResponse }
*/
public async defendDispute(defendDisputeRequest: DefendDisputeRequest, requestOptions?: IRequest.Options): Promise<DefendDisputeResponse> {
const endpoint = `${this.baseUrl}/defendDispute`;
const resource = new Resource(this, endpoint);
const request: DefendDisputeRequest = ObjectSerializer.serialize(defendDisputeRequest, "DefendDisputeRequest");
const response = await getJsonResponse<DefendDisputeRequest, DefendDisputeResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "DefendDisputeResponse");
}
/**
* @summary Delete a defense document
* @param deleteDefenseDocumentRequest {@link DeleteDefenseDocumentRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link DeleteDefenseDocumentResponse }
*/
public async deleteDisputeDefenseDocument(deleteDefenseDocumentRequest: DeleteDefenseDocumentRequest, requestOptions?: IRequest.Options): Promise<DeleteDefenseDocumentResponse> {
const endpoint = `${this.baseUrl}/deleteDisputeDefenseDocument`;
const resource = new Resource(this, endpoint);
const request: DeleteDefenseDocumentRequest = ObjectSerializer.serialize(deleteDefenseDocumentRequest, "DeleteDefenseDocumentRequest");
const response = await getJsonResponse<DeleteDefenseDocumentRequest, DeleteDefenseDocumentResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "DeleteDefenseDocumentResponse");
}
/**
* @summary Get applicable defense reasons
* @param defenseReasonsRequest {@link DefenseReasonsRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link DefenseReasonsResponse }
*/
public async retrieveApplicableDefenseReasons(defenseReasonsRequest: DefenseReasonsRequest, requestOptions?: IRequest.Options): Promise<DefenseReasonsResponse> {
const endpoint = `${this.baseUrl}/retrieveApplicableDefenseReasons`;
const resource = new Resource(this, endpoint);
const request: DefenseReasonsRequest = ObjectSerializer.serialize(defenseReasonsRequest, "DefenseReasonsRequest");
const response = await getJsonResponse<DefenseReasonsRequest, DefenseReasonsResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "DefenseReasonsResponse");
}
/**
* @summary Supply a defense document
* @param supplyDefenseDocumentRequest {@link SupplyDefenseDocumentRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link SupplyDefenseDocumentResponse }
*/
public async supplyDefenseDocument(supplyDefenseDocumentRequest: SupplyDefenseDocumentRequest, requestOptions?: IRequest.Options): Promise<SupplyDefenseDocumentResponse> {
const endpoint = `${this.baseUrl}/supplyDefenseDocument`;
const resource = new Resource(this, endpoint);
const request: SupplyDefenseDocumentRequest = ObjectSerializer.serialize(supplyDefenseDocumentRequest, "SupplyDefenseDocumentRequest");
const response = await getJsonResponse<SupplyDefenseDocumentRequest, SupplyDefenseDocumentResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "SupplyDefenseDocumentResponse");
}
}
export default DisputesAPI;