forked from Adyen/adyen-dotnet-api-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TerminalOrdersCompanyLevelService.cs
387 lines (343 loc) · 28.6 KB
/
TerminalOrdersCompanyLevelService.cs
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
/*
* Management API
*
*
* The version of the OpenAPI document: 3
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Adyen.Model;
using Adyen.Model.Management;
namespace Adyen.Service.Management
{
/// <summary>
/// TerminalOrdersCompanyLevelService Interface
/// </summary>
public interface ITerminalOrdersCompanyLevelService
{
/// <summary>
/// Cancel an order
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="orderId"><see cref="string"/> - The unique identifier of the order.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="TerminalOrder"/>.</returns>
Model.Management.TerminalOrder CancelOrder(string companyId, string orderId, RequestOptions requestOptions = default);
/// <summary>
/// Cancel an order
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="orderId"><see cref="string"/> - The unique identifier of the order.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="TerminalOrder"/>.</returns>
Task<Model.Management.TerminalOrder> CancelOrderAsync(string companyId, string orderId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Create an order
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="terminalOrderRequest"><see cref="TerminalOrderRequest"/> - </param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="TerminalOrder"/>.</returns>
Model.Management.TerminalOrder CreateOrder(string companyId, TerminalOrderRequest terminalOrderRequest = default, RequestOptions requestOptions = default);
/// <summary>
/// Create an order
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="terminalOrderRequest"><see cref="TerminalOrderRequest"/> - </param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="TerminalOrder"/>.</returns>
Task<Model.Management.TerminalOrder> CreateOrderAsync(string companyId, TerminalOrderRequest terminalOrderRequest = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Create a shipping location
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="shippingLocation"><see cref="ShippingLocation"/> - </param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="ShippingLocation"/>.</returns>
Model.Management.ShippingLocation CreateShippingLocation(string companyId, ShippingLocation shippingLocation = default, RequestOptions requestOptions = default);
/// <summary>
/// Create a shipping location
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="shippingLocation"><see cref="ShippingLocation"/> - </param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="ShippingLocation"/>.</returns>
Task<Model.Management.ShippingLocation> CreateShippingLocationAsync(string companyId, ShippingLocation shippingLocation = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Get an order
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="orderId"><see cref="string"/> - The unique identifier of the order.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="TerminalOrder"/>.</returns>
Model.Management.TerminalOrder GetOrder(string companyId, string orderId, RequestOptions requestOptions = default);
/// <summary>
/// Get an order
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="orderId"><see cref="string"/> - The unique identifier of the order.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="TerminalOrder"/>.</returns>
Task<Model.Management.TerminalOrder> GetOrderAsync(string companyId, string orderId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Get a list of billing entities
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="name"><see cref="string"/> - The name of the billing entity.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="BillingEntitiesResponse"/>.</returns>
Model.Management.BillingEntitiesResponse ListBillingEntities(string companyId, string name = default, RequestOptions requestOptions = default);
/// <summary>
/// Get a list of billing entities
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="name"><see cref="string"/> - The name of the billing entity.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="BillingEntitiesResponse"/>.</returns>
Task<Model.Management.BillingEntitiesResponse> ListBillingEntitiesAsync(string companyId, string name = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Get a list of orders
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="customerOrderReference"><see cref="string"/> - Your purchase order number.</param>
/// <param name="status"><see cref="string"/> - The order status. Possible values (not case-sensitive): Placed, Confirmed, Cancelled, Shipped, Delivered.</param>
/// <param name="offset"><see cref="int?"/> - The number of orders to skip.</param>
/// <param name="limit"><see cref="int?"/> - The number of orders to return.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="TerminalOrdersResponse"/>.</returns>
Model.Management.TerminalOrdersResponse ListOrders(string companyId, string customerOrderReference = default, string status = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default);
/// <summary>
/// Get a list of orders
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="customerOrderReference"><see cref="string"/> - Your purchase order number.</param>
/// <param name="status"><see cref="string"/> - The order status. Possible values (not case-sensitive): Placed, Confirmed, Cancelled, Shipped, Delivered.</param>
/// <param name="offset"><see cref="int?"/> - The number of orders to skip.</param>
/// <param name="limit"><see cref="int?"/> - The number of orders to return.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="TerminalOrdersResponse"/>.</returns>
Task<Model.Management.TerminalOrdersResponse> ListOrdersAsync(string companyId, string customerOrderReference = default, string status = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Get a list of shipping locations
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="name"><see cref="string"/> - The name of the shipping location.</param>
/// <param name="offset"><see cref="int?"/> - The number of locations to skip.</param>
/// <param name="limit"><see cref="int?"/> - The number of locations to return.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="ShippingLocationsResponse"/>.</returns>
Model.Management.ShippingLocationsResponse ListShippingLocations(string companyId, string name = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default);
/// <summary>
/// Get a list of shipping locations
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="name"><see cref="string"/> - The name of the shipping location.</param>
/// <param name="offset"><see cref="int?"/> - The number of locations to skip.</param>
/// <param name="limit"><see cref="int?"/> - The number of locations to return.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="ShippingLocationsResponse"/>.</returns>
Task<Model.Management.ShippingLocationsResponse> ListShippingLocationsAsync(string companyId, string name = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Get a list of terminal models
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="TerminalModelsResponse"/>.</returns>
Model.Management.TerminalModelsResponse ListTerminalModels(string companyId, RequestOptions requestOptions = default);
/// <summary>
/// Get a list of terminal models
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="TerminalModelsResponse"/>.</returns>
Task<Model.Management.TerminalModelsResponse> ListTerminalModelsAsync(string companyId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Get a list of terminal products
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="country"><see cref="string"/> - The country to return products for, in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format. For example, **US**</param>
/// <param name="terminalModelId"><see cref="string"/> - The terminal model to return products for. Use the ID returned in the [GET `/terminalModels`](https://docs.adyen.com/api-explorer/#/ManagementService/latest/get/companies/{companyId}/terminalModels) response. For example, **Verifone.M400**</param>
/// <param name="offset"><see cref="int?"/> - The number of products to skip.</param>
/// <param name="limit"><see cref="int?"/> - The number of products to return.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="TerminalProductsResponse"/>.</returns>
Model.Management.TerminalProductsResponse ListTerminalProducts(string companyId, string country, string terminalModelId = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default);
/// <summary>
/// Get a list of terminal products
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="country"><see cref="string"/> - The country to return products for, in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format. For example, **US**</param>
/// <param name="terminalModelId"><see cref="string"/> - The terminal model to return products for. Use the ID returned in the [GET `/terminalModels`](https://docs.adyen.com/api-explorer/#/ManagementService/latest/get/companies/{companyId}/terminalModels) response. For example, **Verifone.M400**</param>
/// <param name="offset"><see cref="int?"/> - The number of products to skip.</param>
/// <param name="limit"><see cref="int?"/> - The number of products to return.</param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="TerminalProductsResponse"/>.</returns>
Task<Model.Management.TerminalProductsResponse> ListTerminalProductsAsync(string companyId, string country, string terminalModelId = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
/// <summary>
/// Update an order
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="orderId"><see cref="string"/> - The unique identifier of the order.</param>
/// <param name="terminalOrderRequest"><see cref="TerminalOrderRequest"/> - </param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <returns><see cref="TerminalOrder"/>.</returns>
Model.Management.TerminalOrder UpdateOrder(string companyId, string orderId, TerminalOrderRequest terminalOrderRequest = default, RequestOptions requestOptions = default);
/// <summary>
/// Update an order
/// </summary>
/// <param name="companyId"><see cref="string"/> - The unique identifier of the company account.</param>
/// <param name="orderId"><see cref="string"/> - The unique identifier of the order.</param>
/// <param name="terminalOrderRequest"><see cref="TerminalOrderRequest"/> - </param>
/// <param name="requestOptions"><see cref="RequestOptions"/> - Additional request options.</param>
/// <param name="cancellationToken"> A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects.</param>
/// <returns>Task of <see cref="TerminalOrder"/>.</returns>
Task<Model.Management.TerminalOrder> UpdateOrderAsync(string companyId, string orderId, TerminalOrderRequest terminalOrderRequest = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default);
}
/// <summary>
/// Represents a collection of functions to interact with the TerminalOrdersCompanyLevelService API endpoints
/// </summary>
public class TerminalOrdersCompanyLevelService : AbstractService, ITerminalOrdersCompanyLevelService
{
private readonly string _baseUrl;
public TerminalOrdersCompanyLevelService(Client client) : base(client)
{
_baseUrl = CreateBaseUrl("https://management-test.adyen.com/v3");
}
public Model.Management.TerminalOrder CancelOrder(string companyId, string orderId, RequestOptions requestOptions = default)
{
return CancelOrderAsync(companyId, orderId, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.TerminalOrder> CancelOrderAsync(string companyId, string orderId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
var endpoint = _baseUrl + $"/companies/{companyId}/terminalOrders/{orderId}/cancel";
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.TerminalOrder>(null, requestOptions, new HttpMethod("POST"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.TerminalOrder CreateOrder(string companyId, TerminalOrderRequest terminalOrderRequest = default, RequestOptions requestOptions = default)
{
return CreateOrderAsync(companyId, terminalOrderRequest, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.TerminalOrder> CreateOrderAsync(string companyId, TerminalOrderRequest terminalOrderRequest = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
var endpoint = _baseUrl + $"/companies/{companyId}/terminalOrders";
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.TerminalOrder>(terminalOrderRequest.ToJson(), requestOptions, new HttpMethod("POST"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.ShippingLocation CreateShippingLocation(string companyId, ShippingLocation shippingLocation = default, RequestOptions requestOptions = default)
{
return CreateShippingLocationAsync(companyId, shippingLocation, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.ShippingLocation> CreateShippingLocationAsync(string companyId, ShippingLocation shippingLocation = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
var endpoint = _baseUrl + $"/companies/{companyId}/shippingLocations";
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.ShippingLocation>(shippingLocation.ToJson(), requestOptions, new HttpMethod("POST"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.TerminalOrder GetOrder(string companyId, string orderId, RequestOptions requestOptions = default)
{
return GetOrderAsync(companyId, orderId, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.TerminalOrder> GetOrderAsync(string companyId, string orderId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
var endpoint = _baseUrl + $"/companies/{companyId}/terminalOrders/{orderId}";
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.TerminalOrder>(null, requestOptions, new HttpMethod("GET"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.BillingEntitiesResponse ListBillingEntities(string companyId, string name = default, RequestOptions requestOptions = default)
{
return ListBillingEntitiesAsync(companyId, name, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.BillingEntitiesResponse> ListBillingEntitiesAsync(string companyId, string name = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
// Build the query string
var queryParams = new Dictionary<string, string>();
if (name != null) queryParams.Add("name", name);
var endpoint = _baseUrl + $"/companies/{companyId}/billingEntities" + ToQueryString(queryParams);
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.BillingEntitiesResponse>(null, requestOptions, new HttpMethod("GET"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.TerminalOrdersResponse ListOrders(string companyId, string customerOrderReference = default, string status = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default)
{
return ListOrdersAsync(companyId, customerOrderReference, status, offset, limit, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.TerminalOrdersResponse> ListOrdersAsync(string companyId, string customerOrderReference = default, string status = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
// Build the query string
var queryParams = new Dictionary<string, string>();
if (customerOrderReference != null) queryParams.Add("customerOrderReference", customerOrderReference);
if (status != null) queryParams.Add("status", status);
if (offset != null) queryParams.Add("offset", offset.ToString());
if (limit != null) queryParams.Add("limit", limit.ToString());
var endpoint = _baseUrl + $"/companies/{companyId}/terminalOrders" + ToQueryString(queryParams);
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.TerminalOrdersResponse>(null, requestOptions, new HttpMethod("GET"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.ShippingLocationsResponse ListShippingLocations(string companyId, string name = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default)
{
return ListShippingLocationsAsync(companyId, name, offset, limit, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.ShippingLocationsResponse> ListShippingLocationsAsync(string companyId, string name = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
// Build the query string
var queryParams = new Dictionary<string, string>();
if (name != null) queryParams.Add("name", name);
if (offset != null) queryParams.Add("offset", offset.ToString());
if (limit != null) queryParams.Add("limit", limit.ToString());
var endpoint = _baseUrl + $"/companies/{companyId}/shippingLocations" + ToQueryString(queryParams);
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.ShippingLocationsResponse>(null, requestOptions, new HttpMethod("GET"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.TerminalModelsResponse ListTerminalModels(string companyId, RequestOptions requestOptions = default)
{
return ListTerminalModelsAsync(companyId, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.TerminalModelsResponse> ListTerminalModelsAsync(string companyId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
var endpoint = _baseUrl + $"/companies/{companyId}/terminalModels";
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.TerminalModelsResponse>(null, requestOptions, new HttpMethod("GET"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.TerminalProductsResponse ListTerminalProducts(string companyId, string country, string terminalModelId = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default)
{
return ListTerminalProductsAsync(companyId, country, terminalModelId, offset, limit, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.TerminalProductsResponse> ListTerminalProductsAsync(string companyId, string country, string terminalModelId = default, int? offset = default, int? limit = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
// Build the query string
var queryParams = new Dictionary<string, string>();
queryParams.Add("country", country);
if (terminalModelId != null) queryParams.Add("terminalModelId", terminalModelId);
if (offset != null) queryParams.Add("offset", offset.ToString());
if (limit != null) queryParams.Add("limit", limit.ToString());
var endpoint = _baseUrl + $"/companies/{companyId}/terminalProducts" + ToQueryString(queryParams);
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.TerminalProductsResponse>(null, requestOptions, new HttpMethod("GET"), cancellationToken).ConfigureAwait(false);
}
public Model.Management.TerminalOrder UpdateOrder(string companyId, string orderId, TerminalOrderRequest terminalOrderRequest = default, RequestOptions requestOptions = default)
{
return UpdateOrderAsync(companyId, orderId, terminalOrderRequest, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult();
}
public async Task<Model.Management.TerminalOrder> UpdateOrderAsync(string companyId, string orderId, TerminalOrderRequest terminalOrderRequest = default, RequestOptions requestOptions = default, CancellationToken cancellationToken = default)
{
var endpoint = _baseUrl + $"/companies/{companyId}/terminalOrders/{orderId}";
var resource = new ServiceResource(this, endpoint);
return await resource.RequestAsync<Model.Management.TerminalOrder>(terminalOrderRequest.ToJson(), requestOptions, new HttpMethod("PATCH"), cancellationToken).ConfigureAwait(false);
}
}
}