1313
1414package Api ;
1515
16- import java .io .IOException ;
17- import java .lang .reflect .Type ;
18- import java .util .ArrayList ;
19- import java .util .HashMap ;
20- import java .util .List ;
21- import java .util .Map ;
22-
23- import com .google .gson .reflect .TypeToken ;
24-
2516import Invokers .ApiCallback ;
2617import Invokers .ApiClient ;
2718import Invokers .ApiException ;
3021import Invokers .Pair ;
3122import Invokers .ProgressRequestBody ;
3223import Invokers .ProgressResponseBody ;
24+
25+ import com .cybersource .authsdk .core .MerchantConfig ;
26+ import com .google .gson .reflect .TypeToken ;
27+
28+ import java .io .IOException ;
29+
30+
3331import Model .CapturePaymentRequest ;
34- import Model .InlineResponse2004 ;
35- import Model .InlineResponse2012 ;
32+ import Model .PtsV2PaymentsCapturesPost201Response ;
33+ import Model .PtsV2PaymentsCapturesPost400Response ;
34+ import Model .PtsV2PaymentsPost502Response ;
35+
36+ import java .lang .reflect .Type ;
37+ import java .util .ArrayList ;
38+ import java .util .HashMap ;
39+ import java .util .List ;
40+ import java .util .Map ;
3641
3742public class CaptureApi {
3843 private ApiClient apiClient ;
@@ -56,13 +61,14 @@ public void setApiClient(ApiClient apiClient) {
5661 /**
5762 * Build call for capturePayment
5863 * @param capturePaymentRequest (required)
64+ * @param merchantConfig (merchant details)
5965 * @param id The payment ID returned from a previous payment request. This ID links the capture to the payment. (required)
6066 * @param progressListener Progress listener
6167 * @param progressRequestListener Progress request listener
6268 * @return Call to execute
6369 * @throws ApiException If fail to serialize the request body object
6470 */
65- public com .squareup .okhttp .Call capturePaymentCall (CapturePaymentRequest capturePaymentRequest , String id , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
71+ public com .squareup .okhttp .Call capturePaymentCall (CapturePaymentRequest capturePaymentRequest ,MerchantConfig merchantConfig , String id , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
6672 Object localVarPostBody = capturePaymentRequest ;
6773
6874 // create path and map variables
@@ -76,13 +82,13 @@ public com.squareup.okhttp.Call capturePaymentCall(CapturePaymentRequest capture
7682 Map <String , Object > localVarFormParams = new HashMap <String , Object >();
7783
7884 final String [] localVarAccepts = {
79- "application/hal+json;charset=utf-8 "
85+ "application/hal+json"
8086 };
8187 final String localVarAccept = apiClient .selectHeaderAccept (localVarAccepts );
8288 if (localVarAccept != null ) localVarHeaderParams .put ("Accept" , localVarAccept );
8389
8490 final String [] localVarContentTypes = {
85-
91+ "application/json"
8692 };
8793 final String localVarContentType = apiClient .selectHeaderContentType (localVarContentTypes );
8894 localVarHeaderParams .put ("Content-Type" , localVarContentType );
@@ -100,11 +106,11 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch
100106 }
101107
102108 String [] localVarAuthNames = new String [] { };
103- return apiClient .buildCall (localVarPath , "POST" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAuthNames , progressRequestListener );
109+ return apiClient .buildCall (localVarPath , "POST" , merchantConfig , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAuthNames , progressRequestListener );
104110 }
105111
106112 @ SuppressWarnings ("rawtypes" )
107- private com .squareup .okhttp .Call capturePaymentValidateBeforeCall (CapturePaymentRequest capturePaymentRequest , String id , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
113+ private com .squareup .okhttp .Call capturePaymentValidateBeforeCall (CapturePaymentRequest capturePaymentRequest ,MerchantConfig merchantConfig , String id , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
108114
109115 // verify the required parameter 'capturePaymentRequest' is set
110116 if (capturePaymentRequest == null ) {
@@ -117,7 +123,7 @@ private com.squareup.okhttp.Call capturePaymentValidateBeforeCall(CapturePayment
117123 }
118124
119125
120- com .squareup .okhttp .Call call = capturePaymentCall (capturePaymentRequest , id , progressListener , progressRequestListener );
126+ com .squareup .okhttp .Call call = capturePaymentCall (capturePaymentRequest ,merchantConfig , id , progressListener , progressRequestListener );
121127 return call ;
122128
123129
@@ -130,165 +136,42 @@ private com.squareup.okhttp.Call capturePaymentValidateBeforeCall(CapturePayment
130136 * Capture a Payment
131137 * Include the payment ID in the POST request to capture the payment amount.
132138 * @param capturePaymentRequest (required)
139+ * @param merchantConfig (merchant details)
133140 * @param id The payment ID returned from a previous payment request. This ID links the capture to the payment. (required)
134- * @return InlineResponse2012
141+ * @return PtsV2PaymentsCapturesPost201Response
135142 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
136143 */
137- public InlineResponse2012 capturePayment (CapturePaymentRequest capturePaymentRequest , String id ) throws ApiException {
138- ApiResponse <InlineResponse2012 > resp = capturePaymentWithHttpInfo (capturePaymentRequest , id );
144+ public PtsV2PaymentsCapturesPost201Response capturePayment (CapturePaymentRequest capturePaymentRequest , MerchantConfig merchantConfig , String id ) throws ApiException {
145+ ApiResponse <PtsV2PaymentsCapturesPost201Response > resp = capturePaymentWithHttpInfo (capturePaymentRequest , merchantConfig , id );
139146 return resp .getData ();
140147 }
141148
142149 /**
143150 * Capture a Payment
144151 * Include the payment ID in the POST request to capture the payment amount.
145152 * @param capturePaymentRequest (required)
153+ * @param merchantConfig (merchant details)
146154 * @param id The payment ID returned from a previous payment request. This ID links the capture to the payment. (required)
147- * @return ApiResponse - InlineResponse2012 ;
155+ * @return ApiResponse<PtsV2PaymentsCapturesPost201Response> ;
148156 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
149157 */
150- public ApiResponse <InlineResponse2012 > capturePaymentWithHttpInfo (CapturePaymentRequest capturePaymentRequest , String id ) throws ApiException {
151- com .squareup .okhttp .Call call = capturePaymentValidateBeforeCall (capturePaymentRequest , id , null , null );
152- Type localVarReturnType = new TypeToken <InlineResponse2012 >(){}.getType ();
158+ public ApiResponse <PtsV2PaymentsCapturesPost201Response > capturePaymentWithHttpInfo (CapturePaymentRequest capturePaymentRequest , MerchantConfig merchantConfig , String id ) throws ApiException {
159+ com .squareup .okhttp .Call call = capturePaymentValidateBeforeCall (capturePaymentRequest ,merchantConfig , id , null , null );
160+ Type localVarReturnType = new TypeToken <PtsV2PaymentsCapturesPost201Response >(){}.getType ();
153161 return apiClient .execute (call , localVarReturnType );
154162 }
155163
156164 /**
157165 * Capture a Payment (asynchronously)
158166 * Include the payment ID in the POST request to capture the payment amount.
159167 * @param capturePaymentRequest (required)
168+ * @param merchantConfig (merchant details)
160169 * @param id The payment ID returned from a previous payment request. This ID links the capture to the payment. (required)
161170 * @param callback The callback to be executed when the API call finishes
162171 * @return The request call
163172 * @throws ApiException If fail to process the API call, e.g. serializing the request body object
164173 */
165- public com .squareup .okhttp .Call capturePaymentAsync (CapturePaymentRequest capturePaymentRequest , String id , final ApiCallback <InlineResponse2012 > callback ) throws ApiException {
166-
167- ProgressResponseBody .ProgressListener progressListener = null ;
168- ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
169-
170- if (callback != null ) {
171- progressListener = new ProgressResponseBody .ProgressListener () {
172- @ Override
173- public void update (long bytesRead , long contentLength , boolean done ) {
174- callback .onDownloadProgress (bytesRead , contentLength , done );
175- }
176- };
177-
178- progressRequestListener = new ProgressRequestBody .ProgressRequestListener () {
179- @ Override
180- public void onRequestProgress (long bytesWritten , long contentLength , boolean done ) {
181- callback .onUploadProgress (bytesWritten , contentLength , done );
182- }
183- };
184- }
185-
186- com .squareup .okhttp .Call call = capturePaymentValidateBeforeCall (capturePaymentRequest , id , progressListener , progressRequestListener );
187- Type localVarReturnType = new TypeToken <InlineResponse2012 >(){}.getType ();
188- apiClient .executeAsync (call , localVarReturnType , callback );
189- return call ;
190- }
191- /**
192- * Build call for getCapture
193- * @param id The capture ID returned from a previous capture request. (required)
194- * @param progressListener Progress listener
195- * @param progressRequestListener Progress request listener
196- * @return Call to execute
197- * @throws ApiException If fail to serialize the request body object
198- */
199- public com .squareup .okhttp .Call getCaptureCall (String id , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
200- Object localVarPostBody = null ;
201-
202- // create path and map variables
203- String localVarPath = "/pts/v2/captures/{id}"
204- .replaceAll ("\\ {" + "id" + "\\ }" , apiClient .escapeString (id .toString ()));
205-
206- List <Pair > localVarQueryParams = new ArrayList <Pair >();
207-
208- Map <String , String > localVarHeaderParams = new HashMap <String , String >();
209-
210- Map <String , Object > localVarFormParams = new HashMap <String , Object >();
211-
212- final String [] localVarAccepts = {
213- "application/hal+json;charset=utf-8"
214- };
215- final String localVarAccept = apiClient .selectHeaderAccept (localVarAccepts );
216- if (localVarAccept != null ) localVarHeaderParams .put ("Accept" , localVarAccept );
217-
218- final String [] localVarContentTypes = {
219-
220- };
221- final String localVarContentType = apiClient .selectHeaderContentType (localVarContentTypes );
222- localVarHeaderParams .put ("Content-Type" , localVarContentType );
223-
224- if (progressListener != null ) {
225- apiClient .getHttpClient ().networkInterceptors ().add (new com .squareup .okhttp .Interceptor () {
226- @ Override
227- public com .squareup .okhttp .Response intercept (com .squareup .okhttp .Interceptor .Chain chain ) throws IOException {
228- com .squareup .okhttp .Response originalResponse = chain .proceed (chain .request ());
229- return originalResponse .newBuilder ()
230- .body (new ProgressResponseBody (originalResponse .body (), progressListener ))
231- .build ();
232- }
233- });
234- }
235-
236- String [] localVarAuthNames = new String [] { };
237- return apiClient .buildCall (localVarPath , "GET" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAuthNames , progressRequestListener );
238- }
239-
240- @ SuppressWarnings ("rawtypes" )
241- private com .squareup .okhttp .Call getCaptureValidateBeforeCall (String id , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
242-
243- // verify the required parameter 'id' is set
244- if (id == null ) {
245- throw new ApiException ("Missing the required parameter 'id' when calling getCapture(Async)" );
246- }
247-
248-
249- com .squareup .okhttp .Call call = getCaptureCall (id , progressListener , progressRequestListener );
250- return call ;
251-
252-
253-
254-
255-
256- }
257-
258- /**
259- * Retrieve a Capture
260- * Include the capture ID in the GET request to retrieve the capture details.
261- * @param id The capture ID returned from a previous capture request. (required)
262- * @return InlineResponse2004 generated.
263- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
264- */
265- public InlineResponse2004 getCapture (String id ) throws ApiException {
266- ApiResponse <InlineResponse2004 > resp = getCaptureWithHttpInfo (id );
267- return resp .getData ();
268- }
269-
270- /**
271- * Retrieve a Capture
272- * Include the capture ID in the GET request to retrieve the capture details.
273- * @param id The capture ID returned from a previous capture request. (required)
274- * @return ApiResponse - InlineResponse2004
275- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
276- */
277- public ApiResponse <InlineResponse2004 > getCaptureWithHttpInfo (String id ) throws ApiException {
278- com .squareup .okhttp .Call call = getCaptureValidateBeforeCall (id , null , null );
279- Type localVarReturnType = new TypeToken <InlineResponse2004 >(){}.getType ();
280- return apiClient .execute (call , localVarReturnType );
281- }
282-
283- /**
284- * Retrieve a Capture (asynchronously)
285- * Include the capture ID in the GET request to retrieve the capture details.
286- * @param id The capture ID returned from a previous capture request. (required)
287- * @param callback The callback to be executed when the API call finishes
288- * @return The request call
289- * @throws ApiException If fail to process the API call, e.g. serializing the request body object
290- */
291- public com .squareup .okhttp .Call getCaptureAsync (String id , final ApiCallback <InlineResponse2004 > callback ) throws ApiException {
174+ public com .squareup .okhttp .Call capturePaymentAsync (CapturePaymentRequest capturePaymentRequest ,MerchantConfig merchantConfig , String id , final ApiCallback <PtsV2PaymentsCapturesPost201Response > callback ) throws ApiException {
292175
293176 ProgressResponseBody .ProgressListener progressListener = null ;
294177 ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
@@ -309,8 +192,8 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
309192 };
310193 }
311194
312- com .squareup .okhttp .Call call = getCaptureValidateBeforeCall ( id , progressListener , progressRequestListener );
313- Type localVarReturnType = new TypeToken <InlineResponse2004 >(){}.getType ();
195+ com .squareup .okhttp .Call call = capturePaymentValidateBeforeCall ( capturePaymentRequest , merchantConfig , id , progressListener , progressRequestListener );
196+ Type localVarReturnType = new TypeToken <PtsV2PaymentsCapturesPost201Response >(){}.getType ();
314197 apiClient .executeAsync (call , localVarReturnType , callback );
315198 return call ;
316199 }
0 commit comments