|
| 1 | +/* |
| 2 | + * CyberSource Flex API |
| 3 | + * |
| 4 | + * Simple PAN tokenization service |
| 5 | + * |
| 6 | + * OpenAPI spec version: 0.0.1 |
| 7 | + * |
| 8 | + * Generated by: https://github.com/swagger-api/swagger-codegen.git |
| 9 | + */ |
| 10 | + |
| 11 | +using System; |
| 12 | +using System.Collections.Generic; |
| 13 | +using System.Collections.ObjectModel; |
| 14 | +using System.Linq; |
| 15 | +using RestSharp; |
| 16 | +using CyberSource.Client; |
| 17 | +using CyberSource.Model; |
| 18 | + |
| 19 | +namespace CyberSource.Api |
| 20 | +{ |
| 21 | + /// <summary> |
| 22 | + /// Represents a collection of functions to interact with the API endpoints |
| 23 | + /// </summary> |
| 24 | + public interface IDefaultApi : IApiAccessor |
| 25 | + { |
| 26 | + #region Synchronous Operations |
| 27 | + /// <summary> |
| 28 | + /// Process a Payout |
| 29 | + /// </summary> |
| 30 | + /// <remarks> |
| 31 | + /// Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT). |
| 32 | + /// </remarks> |
| 33 | + /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> |
| 34 | + /// <param name="octCreatePaymentRequest"></param> |
| 35 | + /// <returns></returns> |
| 36 | + void OctCreatePayment (OctCreatePaymentRequest octCreatePaymentRequest); |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// Process a Payout |
| 40 | + /// </summary> |
| 41 | + /// <remarks> |
| 42 | + /// Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT). |
| 43 | + /// </remarks> |
| 44 | + /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> |
| 45 | + /// <param name="octCreatePaymentRequest"></param> |
| 46 | + /// <returns>ApiResponse of Object(void)</returns> |
| 47 | + ApiResponse<Object> OctCreatePaymentWithHttpInfo (OctCreatePaymentRequest octCreatePaymentRequest); |
| 48 | + #endregion Synchronous Operations |
| 49 | + #region Asynchronous Operations |
| 50 | + /// <summary> |
| 51 | + /// Process a Payout |
| 52 | + /// </summary> |
| 53 | + /// <remarks> |
| 54 | + /// Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT). |
| 55 | + /// </remarks> |
| 56 | + /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> |
| 57 | + /// <param name="octCreatePaymentRequest"></param> |
| 58 | + /// <returns>Task of void</returns> |
| 59 | + System.Threading.Tasks.Task OctCreatePaymentAsync (OctCreatePaymentRequest octCreatePaymentRequest); |
| 60 | + |
| 61 | + /// <summary> |
| 62 | + /// Process a Payout |
| 63 | + /// </summary> |
| 64 | + /// <remarks> |
| 65 | + /// Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT). |
| 66 | + /// </remarks> |
| 67 | + /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> |
| 68 | + /// <param name="octCreatePaymentRequest"></param> |
| 69 | + /// <returns>Task of ApiResponse</returns> |
| 70 | + System.Threading.Tasks.Task<ApiResponse<Object>> OctCreatePaymentAsyncWithHttpInfo (OctCreatePaymentRequest octCreatePaymentRequest); |
| 71 | + #endregion Asynchronous Operations |
| 72 | + } |
| 73 | + |
| 74 | + /// <summary> |
| 75 | + /// Represents a collection of functions to interact with the API endpoints |
| 76 | + /// </summary> |
| 77 | + public partial class DefaultApi : IDefaultApi |
| 78 | + { |
| 79 | + private CyberSource.Client.ExceptionFactory _exceptionFactory = (name, response) => null; |
| 80 | + |
| 81 | + /// <summary> |
| 82 | + /// Initializes a new instance of the <see cref="DefaultApi"/> class. |
| 83 | + /// </summary> |
| 84 | + /// <returns></returns> |
| 85 | + public DefaultApi(String basePath) |
| 86 | + { |
| 87 | + this.Configuration = new Configuration(new ApiClient(basePath)); |
| 88 | + |
| 89 | + ExceptionFactory = CyberSource.Client.Configuration.DefaultExceptionFactory; |
| 90 | + |
| 91 | + // ensure API client has configuration ready |
| 92 | + if (Configuration.ApiClient.Configuration == null) |
| 93 | + { |
| 94 | + this.Configuration.ApiClient.Configuration = this.Configuration; |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | + /// <summary> |
| 99 | + /// Initializes a new instance of the <see cref="DefaultApi"/> class |
| 100 | + /// using Configuration object |
| 101 | + /// </summary> |
| 102 | + /// <param name="configuration">An instance of Configuration</param> |
| 103 | + /// <returns></returns> |
| 104 | + public DefaultApi(Configuration configuration = null) |
| 105 | + { |
| 106 | + if (configuration == null) // use the default one in Configuration |
| 107 | + this.Configuration = Configuration.Default; |
| 108 | + else |
| 109 | + this.Configuration = configuration; |
| 110 | + |
| 111 | + ExceptionFactory = CyberSource.Client.Configuration.DefaultExceptionFactory; |
| 112 | + |
| 113 | + // ensure API client has configuration ready |
| 114 | + if (Configuration.ApiClient.Configuration == null) |
| 115 | + { |
| 116 | + this.Configuration.ApiClient.Configuration = this.Configuration; |
| 117 | + } |
| 118 | + } |
| 119 | + |
| 120 | + /// <summary> |
| 121 | + /// Gets the base path of the API client. |
| 122 | + /// </summary> |
| 123 | + /// <value>The base path</value> |
| 124 | + public String GetBasePath() |
| 125 | + { |
| 126 | + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); |
| 127 | + } |
| 128 | + |
| 129 | + /// <summary> |
| 130 | + /// Sets the base path of the API client. |
| 131 | + /// </summary> |
| 132 | + /// <value>The base path</value> |
| 133 | + [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] |
| 134 | + public void SetBasePath(String basePath) |
| 135 | + { |
| 136 | + // do nothing |
| 137 | + } |
| 138 | + |
| 139 | + /// <summary> |
| 140 | + /// Gets or sets the configuration object |
| 141 | + /// </summary> |
| 142 | + /// <value>An instance of the Configuration</value> |
| 143 | + public Configuration Configuration {get; set;} |
| 144 | + |
| 145 | + /// <summary> |
| 146 | + /// Provides a factory method hook for the creation of exceptions. |
| 147 | + /// </summary> |
| 148 | + public CyberSource.Client.ExceptionFactory ExceptionFactory |
| 149 | + { |
| 150 | + get |
| 151 | + { |
| 152 | + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) |
| 153 | + { |
| 154 | + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); |
| 155 | + } |
| 156 | + return _exceptionFactory; |
| 157 | + } |
| 158 | + set { _exceptionFactory = value; } |
| 159 | + } |
| 160 | + |
| 161 | + /// <summary> |
| 162 | + /// Gets the default header. |
| 163 | + /// </summary> |
| 164 | + /// <returns>Dictionary of HTTP header</returns> |
| 165 | + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] |
| 166 | + public Dictionary<String, String> DefaultHeader() |
| 167 | + { |
| 168 | + return this.Configuration.DefaultHeader; |
| 169 | + } |
| 170 | + |
| 171 | + /// <summary> |
| 172 | + /// Add default header. |
| 173 | + /// </summary> |
| 174 | + /// <param name="key">Header field name.</param> |
| 175 | + /// <param name="value">Header field value.</param> |
| 176 | + /// <returns></returns> |
| 177 | + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] |
| 178 | + public void AddDefaultHeader(string key, string value) |
| 179 | + { |
| 180 | + this.Configuration.AddDefaultHeader(key, value); |
| 181 | + } |
| 182 | + |
| 183 | + /// <summary> |
| 184 | + /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT). |
| 185 | + /// </summary> |
| 186 | + /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> |
| 187 | + /// <param name="octCreatePaymentRequest"></param> |
| 188 | + /// <returns></returns> |
| 189 | + public void OctCreatePayment (OctCreatePaymentRequest octCreatePaymentRequest) |
| 190 | + { |
| 191 | + OctCreatePaymentWithHttpInfo(octCreatePaymentRequest); |
| 192 | + } |
| 193 | + |
| 194 | + /// <summary> |
| 195 | + /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT). |
| 196 | + /// </summary> |
| 197 | + /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> |
| 198 | + /// <param name="octCreatePaymentRequest"></param> |
| 199 | + /// <returns>ApiResponse of Object(void)</returns> |
| 200 | + public ApiResponse<Object> OctCreatePaymentWithHttpInfo (OctCreatePaymentRequest octCreatePaymentRequest) |
| 201 | + { |
| 202 | + // verify the required parameter 'octCreatePaymentRequest' is set |
| 203 | + if (octCreatePaymentRequest == null) |
| 204 | + throw new ApiException(400, "Missing required parameter 'octCreatePaymentRequest' when calling DefaultApi->OctCreatePayment"); |
| 205 | + |
| 206 | + var localVarPath = $"/pts/v2/payouts"; |
| 207 | + var localVarPathParams = new Dictionary<String, String>(); |
| 208 | + var localVarQueryParams = new Dictionary<String, String>(); |
| 209 | + var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader); |
| 210 | + var localVarFormParams = new Dictionary<String, String>(); |
| 211 | + var localVarFileParams = new Dictionary<String, FileParameter>(); |
| 212 | + Object localVarPostBody = null; |
| 213 | + |
| 214 | + // to determine the Content-Type header |
| 215 | + String[] localVarHttpContentTypes = new String[] { |
| 216 | + }; |
| 217 | + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); |
| 218 | + |
| 219 | + // to determine the Accept header |
| 220 | + String[] localVarHttpHeaderAccepts = new String[] { |
| 221 | + ////"application/json" |
| 222 | + }; |
| 223 | + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); |
| 224 | + if (localVarHttpHeaderAccept != null) |
| 225 | + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); |
| 226 | + |
| 227 | + if (octCreatePaymentRequest != null && octCreatePaymentRequest.GetType() != typeof(byte[])) |
| 228 | + { |
| 229 | + localVarPostBody = Configuration.ApiClient.Serialize(octCreatePaymentRequest); // http body (model) parameter |
| 230 | + } |
| 231 | + else |
| 232 | + { |
| 233 | + localVarPostBody = octCreatePaymentRequest; // byte array |
| 234 | + } |
| 235 | + |
| 236 | + |
| 237 | + // make the HTTP request |
| 238 | + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, |
| 239 | + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, |
| 240 | + localVarPathParams, localVarHttpContentType); |
| 241 | + |
| 242 | + int localVarStatusCode = (int) localVarResponse.StatusCode; |
| 243 | + |
| 244 | + if (ExceptionFactory != null) |
| 245 | + { |
| 246 | + Exception exception = ExceptionFactory("OctCreatePayment", localVarResponse); |
| 247 | + if (exception != null) throw exception; |
| 248 | + } |
| 249 | + |
| 250 | + return new ApiResponse<Object>(localVarStatusCode, |
| 251 | + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), |
| 252 | + null); |
| 253 | + } |
| 254 | + |
| 255 | + /// <summary> |
| 256 | + /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT). |
| 257 | + /// </summary> |
| 258 | + /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> |
| 259 | + /// <param name="octCreatePaymentRequest"></param> |
| 260 | + /// <returns>Task of void</returns> |
| 261 | + public async System.Threading.Tasks.Task OctCreatePaymentAsync (OctCreatePaymentRequest octCreatePaymentRequest) |
| 262 | + { |
| 263 | + await OctCreatePaymentAsyncWithHttpInfo(octCreatePaymentRequest); |
| 264 | + |
| 265 | + } |
| 266 | + |
| 267 | + /// <summary> |
| 268 | + /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT). |
| 269 | + /// </summary> |
| 270 | + /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> |
| 271 | + /// <param name="octCreatePaymentRequest"></param> |
| 272 | + /// <returns>Task of ApiResponse</returns> |
| 273 | + public async System.Threading.Tasks.Task<ApiResponse<Object>> OctCreatePaymentAsyncWithHttpInfo (OctCreatePaymentRequest octCreatePaymentRequest) |
| 274 | + { |
| 275 | + // verify the required parameter 'octCreatePaymentRequest' is set |
| 276 | + if (octCreatePaymentRequest == null) |
| 277 | + throw new ApiException(400, "Missing required parameter 'octCreatePaymentRequest' when calling DefaultApi->OctCreatePayment"); |
| 278 | + |
| 279 | + var localVarPath = $"/pts/v2/payouts"; |
| 280 | + var localVarPathParams = new Dictionary<String, String>(); |
| 281 | + var localVarQueryParams = new Dictionary<String, String>(); |
| 282 | + var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader); |
| 283 | + var localVarFormParams = new Dictionary<String, String>(); |
| 284 | + var localVarFileParams = new Dictionary<String, FileParameter>(); |
| 285 | + Object localVarPostBody = null; |
| 286 | + |
| 287 | + // to determine the Content-Type header |
| 288 | + String[] localVarHttpContentTypes = new String[] { |
| 289 | + }; |
| 290 | + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); |
| 291 | + |
| 292 | + // to determine the Accept header |
| 293 | + String[] localVarHttpHeaderAccepts = new String[] { |
| 294 | + ////"application/json" |
| 295 | + }; |
| 296 | + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); |
| 297 | + if (localVarHttpHeaderAccept != null) |
| 298 | + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); |
| 299 | + |
| 300 | + if (octCreatePaymentRequest != null && octCreatePaymentRequest.GetType() != typeof(byte[])) |
| 301 | + { |
| 302 | + localVarPostBody = Configuration.ApiClient.Serialize(octCreatePaymentRequest); // http body (model) parameter |
| 303 | + } |
| 304 | + else |
| 305 | + { |
| 306 | + localVarPostBody = octCreatePaymentRequest; // byte array |
| 307 | + } |
| 308 | + |
| 309 | + |
| 310 | + // make the HTTP request |
| 311 | + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, |
| 312 | + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, |
| 313 | + localVarPathParams, localVarHttpContentType); |
| 314 | + |
| 315 | + int localVarStatusCode = (int) localVarResponse.StatusCode; |
| 316 | + |
| 317 | + if (ExceptionFactory != null) |
| 318 | + { |
| 319 | + Exception exception = ExceptionFactory("OctCreatePayment", localVarResponse); |
| 320 | + if (exception != null) throw exception; |
| 321 | + } |
| 322 | + |
| 323 | + return new ApiResponse<Object>(localVarStatusCode, |
| 324 | + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), |
| 325 | + null); |
| 326 | + } |
| 327 | + |
| 328 | + } |
| 329 | +} |
0 commit comments