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 ;
3532import Model .InlineResponse2012 ;
33+ import Model .InlineResponse4002 ;
34+ import Model .InlineResponse502 ;
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,25 +136,27 @@ 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)
134141 * @return InlineResponse2012
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 InlineResponse2012 capturePayment (CapturePaymentRequest capturePaymentRequest ,MerchantConfig merchantConfig , String id ) throws ApiException {
145+ ApiResponse <InlineResponse2012 > 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< InlineResponse2012> ;
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 );
158+ public ApiResponse <InlineResponse2012 > capturePaymentWithHttpInfo (CapturePaymentRequest capturePaymentRequest ,MerchantConfig merchantConfig , String id ) throws ApiException {
159+ com .squareup .okhttp .Call call = capturePaymentValidateBeforeCall (capturePaymentRequest ,merchantConfig , id , null , null );
152160 Type localVarReturnType = new TypeToken <InlineResponse2012 >(){}.getType ();
153161 return apiClient .execute (call , localVarReturnType );
154162 }
@@ -157,12 +165,13 @@ public ApiResponse<InlineResponse2012> capturePaymentWithHttpInfo(CapturePayment
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 {
174+ public com .squareup .okhttp .Call capturePaymentAsync (CapturePaymentRequest capturePaymentRequest ,MerchantConfig merchantConfig , String id , final ApiCallback <InlineResponse2012 > callback ) throws ApiException {
166175
167176 ProgressResponseBody .ProgressListener progressListener = null ;
168177 ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
@@ -183,135 +192,9 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
183192 };
184193 }
185194
186- com .squareup .okhttp .Call call = capturePaymentValidateBeforeCall (capturePaymentRequest , id , progressListener , progressRequestListener );
195+ com .squareup .okhttp .Call call = capturePaymentValidateBeforeCall (capturePaymentRequest ,merchantConfig , id , progressListener , progressRequestListener );
187196 Type localVarReturnType = new TypeToken <InlineResponse2012 >(){}.getType ();
188197 apiClient .executeAsync (call , localVarReturnType , callback );
189198 return call ;
190199 }
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 {
292-
293- ProgressResponseBody .ProgressListener progressListener = null ;
294- ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
295-
296- if (callback != null ) {
297- progressListener = new ProgressResponseBody .ProgressListener () {
298- @ Override
299- public void update (long bytesRead , long contentLength , boolean done ) {
300- callback .onDownloadProgress (bytesRead , contentLength , done );
301- }
302- };
303-
304- progressRequestListener = new ProgressRequestBody .ProgressRequestListener () {
305- @ Override
306- public void onRequestProgress (long bytesWritten , long contentLength , boolean done ) {
307- callback .onUploadProgress (bytesWritten , contentLength , done );
308- }
309- };
310- }
311-
312- com .squareup .okhttp .Call call = getCaptureValidateBeforeCall (id , progressListener , progressRequestListener );
313- Type localVarReturnType = new TypeToken <InlineResponse2004 >(){}.getType ();
314- apiClient .executeAsync (call , localVarReturnType , callback );
315- return call ;
316- }
317200}
0 commit comments