# Cyclos411Api.TicketsApi

All URIs are relative to *https://138.197.145.149:8080/cyclos/eCloudAtm/api*

Method | HTTP request | Description
------------- | ------------- | -------------
[**acceptTicket**](TicketsApi.md#acceptTicket) | **POST** /tickets/{ticket}/accept | This operation is deprecated, use &#x60;POST /tickets/{ticket}/approve&#x60; instead.
[**approveTicket**](TicketsApi.md#approveTicket) | **POST** /tickets/{ticket}/approve | Approves a ticket by the payer.
[**cancelTicket**](TicketsApi.md#cancelTicket) | **POST** /tickets/{ticket}/cancel | Cancels a ticket by the receiver.
[**dataForNewTicket**](TicketsApi.md#dataForNewTicket) | **GET** /tickets/data-for-new | Returns data for create a new ticket for the logged user.
[**getDataForEasyInvoice**](TicketsApi.md#getDataForEasyInvoice) | **GET** /tickets/data-for-easy-invoice/{user} | Returns data for an easy invoice to the given user 
[**getEasyInvoiceQrCode**](TicketsApi.md#getEasyInvoiceQrCode) | **GET** /tickets/easy-invoice-qr-code/{user} | Returns a QR-code image with the URL for an easy invoice confirmation 
[**getTicketQrCode**](TicketsApi.md#getTicketQrCode) | **GET** /tickets/{ticket}/qr-code | Returns the QR-code image for the given ticket only if its status is &#x60;open&#x60; 
[**newTicket**](TicketsApi.md#newTicket) | **POST** /tickets | Creates a new ticket with status &#x60;open&#x60; for the logged user. 
[**previewTicket**](TicketsApi.md#previewTicket) | **POST** /tickets/{ticket}/preview | Previews the payment generated by the ticket. 
[**processTicket**](TicketsApi.md#processTicket) | **POST** /tickets/{ticket}/process | Processes a ticket by the receiver.
[**viewTicket**](TicketsApi.md#viewTicket) | **GET** /tickets/{ticket} | Returns details about a ticket by ticket number


<a name="acceptTicket"></a>
# **acceptTicket**
> Transaction acceptTicket(ticket, opts)

This operation is deprecated, use &#x60;POST /tickets/{ticket}/approve&#x60; instead.

After a successful acceptance a new direct payment from the logged user (i.e the payer) to the user who generated the ticket will be generated ONLY if the ticket doesn&#39;t have a &#x60;successUrl&#x60; nor &#x60;successWebhook&#x60;. Otherwise the ticket goes to the &#x60;approved&#x60; status and no  payment is generated. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');
var defaultClient = Cyclos411Api.ApiClient.instance;

// Configure API key authorization: accessClient
var accessClient = defaultClient.authentications['accessClient'];
accessClient.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//accessClient.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

// Configure API key authorization: session
var session = defaultClient.authentications['session'];
session.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.apiKeyPrefix = 'Token';

var apiInstance = new Cyclos411Api.TicketsApi();

var ticket = "ticket_example"; // String | The ticket number

var opts = { 
  'fields': ["fields_example"], // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
  'confirmationPassword': "confirmationPassword_example" // String | The password used to confirm this action, if needed. The actual password type, if any, depends on the Cyclos configuration for the current channel. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.acceptTicket(ticket, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ticket** | **String**| The ticket number | 
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 
 **confirmationPassword** | **String**| The password used to confirm this action, if needed. The actual password type, if any, depends on the Cyclos configuration for the current channel.  | [optional] 

### Return type

[**Transaction**](Transaction.md)

### Authorization

[accessClient](../README.md#accessClient), [basic](../README.md#basic), [session](../README.md#session)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="approveTicket"></a>
# **approveTicket**
> TicketApprovalResult approveTicket(ticket, opts)

Approves a ticket by the payer.

After a successful approval, a new direct payment from the logged user (i.e the payer) to the user who created the ticket will be generated ONLY if the ticket doesn&#39;t have a defined &#x60;successUrl&#x60; nor &#x60;successWebhook&#x60;, in that case the ticket goes to &#x60;processed&#x60; status. Otherwise the ticket just goes to the &#x60;approved&#x60; status and the corresponding payment will be generated only after the ticket is processed by the receiver. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');
var defaultClient = Cyclos411Api.ApiClient.instance;

// Configure API key authorization: accessClient
var accessClient = defaultClient.authentications['accessClient'];
accessClient.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//accessClient.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

// Configure API key authorization: session
var session = defaultClient.authentications['session'];
session.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.apiKeyPrefix = 'Token';

var apiInstance = new Cyclos411Api.TicketsApi();

var ticket = "ticket_example"; // String | The ticket number

var opts = { 
  'fields': ["fields_example"], // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
  'confirmationPassword': "confirmationPassword_example" // String | The password used to confirm this action, if needed. The actual password type, if any, depends on the Cyclos configuration for the current channel. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.approveTicket(ticket, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ticket** | **String**| The ticket number | 
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 
 **confirmationPassword** | **String**| The password used to confirm this action, if needed. The actual password type, if any, depends on the Cyclos configuration for the current channel.  | [optional] 

### Return type

[**TicketApprovalResult**](TicketApprovalResult.md)

### Authorization

[accessClient](../README.md#accessClient), [basic](../README.md#basic), [session](../README.md#session)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="cancelTicket"></a>
# **cancelTicket**
> cancelTicket(ticket)

Cancels a ticket by the receiver.

Cancels a ticket by the receiver before being approved by the payer. The  logged user must be the ticket&#39;s owner. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');
var defaultClient = Cyclos411Api.ApiClient.instance;

// Configure API key authorization: accessClient
var accessClient = defaultClient.authentications['accessClient'];
accessClient.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//accessClient.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

// Configure API key authorization: session
var session = defaultClient.authentications['session'];
session.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.apiKeyPrefix = 'Token';

var apiInstance = new Cyclos411Api.TicketsApi();

var ticket = "ticket_example"; // String | The ticket number


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.cancelTicket(ticket, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ticket** | **String**| The ticket number | 

### Return type

null (empty response body)

### Authorization

[accessClient](../README.md#accessClient), [basic](../README.md#basic), [session](../README.md#session)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="dataForNewTicket"></a>
# **dataForNewTicket**
> DataForTransaction dataForNewTicket(opts)

Returns data for create a new ticket for the logged user.

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.TicketsApi();

var opts = { 
  'fields': ["fields_example"], // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
  'type': "type_example", // String | The payment type id or qualified internal name (in the form `fromAccountType.paymentType`). If no payment type is provided, the possible types will be returned, so the payer can choose. 
  'payer': "payer_example" // String | Will only be used if no specific payment type is given. An identification for the user which will pay the ticket. Is optional, and in most cases, should be left empty. If specified, the returned payment types will take into account those that can be paid by the given user.   
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.dataForNewTicket(opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 
 **type** | **String**| The payment type id or qualified internal name (in the form &#x60;fromAccountType.paymentType&#x60;). If no payment type is provided, the possible types will be returned, so the payer can choose.  | [optional] 
 **payer** | **String**| Will only be used if no specific payment type is given. An identification for the user which will pay the ticket. Is optional, and in most cases, should be left empty. If specified, the returned payment types will take into account those that can be paid by the given user.    | [optional] 

### Return type

[**DataForTransaction**](DataForTransaction.md)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getDataForEasyInvoice"></a>
# **getDataForEasyInvoice**
> DataForEasyInvoice getDataForEasyInvoice(user, opts)

Returns data for an easy invoice to the given user 

An easy invoice is a pre-filled payment to an user. Other users can use this for a payment template to that user, with pre-filled data. If an amount is specified, then either there must be only payment types of a single currency to the given user, or either a payment type or currency must be informed. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.TicketsApi();

var user = "user_example"; // String | Can be one of: * a user identification value, such as id, username, e-mail, phone, etc.   Id is always allowed, others depend on Cyclos configuration. Note that   a valid numeric value is always considered as id. For example, when   using another identification method that can be numeric only, prefix   the value with a single quote (like in Excel spreadsheets), for   example, `'1234567890`;     * `self` for the currently authenticated user. 

var opts = { 
  'fields': ["fields_example"], // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
  'amount': new Cyclos411Api.BigDecimal(), // BigDecimal | The easy invoice amount. If provided and the user has multiple currencies, either `type` or `currency` is required. 
  'type': "type_example", // String | The payment type id or qualified internal name (in the form `fromAccountType.paymentType`). Either this or `currency` should be informed if an `amount` was given and the user has multiple currencies. 
  'currency': "currency_example", // String | The currency id or internal name. Either this or `type` should be informed if an `amount` was given and the user has multiple currencies. 
  'customFields': ["customFields_example"] // [String] | Custom field values. Is a comma-separated array, where each part consists in two parts: the internal name (or custom field id) of the field, and a value, both separated by : (colon). For example, `customFields=field1:value1,field2:value2`. Sometimes multiple values are accepted. In this case, the multiple values are separated by pipes. For example, profileFields=field1:valueA|valueB. Enumerated fields accept multiple values, while numeric and date fields also accept ranges, which are two values, pipe-separated. For example, `customFields=rank:bronze|silver,birthDate:2000-01-01|2001-12-31` would match results whose custom field with internal name `rank` is either bronze or silver, and whose `birthDate` is between January 1, 2000 and December 31, 2001. To specify a single bound in ranges (like birth dates before December 31, 2001), use a pipe in one of the values, like `customFields=birthDate:|2001-12-31`.       
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getDataForEasyInvoice(user, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **user** | **String**| Can be one of: * a user identification value, such as id, username, e-mail, phone, etc.   Id is always allowed, others depend on Cyclos configuration. Note that   a valid numeric value is always considered as id. For example, when   using another identification method that can be numeric only, prefix   the value with a single quote (like in Excel spreadsheets), for   example, &#x60;&#39;1234567890&#x60;;     * &#x60;self&#x60; for the currently authenticated user.  | 
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 
 **amount** | **BigDecimal**| The easy invoice amount. If provided and the user has multiple currencies, either &#x60;type&#x60; or &#x60;currency&#x60; is required.  | [optional] 
 **type** | **String**| The payment type id or qualified internal name (in the form &#x60;fromAccountType.paymentType&#x60;). Either this or &#x60;currency&#x60; should be informed if an &#x60;amount&#x60; was given and the user has multiple currencies.  | [optional] 
 **currency** | **String**| The currency id or internal name. Either this or &#x60;type&#x60; should be informed if an &#x60;amount&#x60; was given and the user has multiple currencies.  | [optional] 
 **customFields** | [**[String]**](String.md)| Custom field values. Is a comma-separated array, where each part consists in two parts: the internal name (or custom field id) of the field, and a value, both separated by : (colon). For example, &#x60;customFields&#x3D;field1:value1,field2:value2&#x60;. Sometimes multiple values are accepted. In this case, the multiple values are separated by pipes. For example, profileFields&#x3D;field1:valueA|valueB. Enumerated fields accept multiple values, while numeric and date fields also accept ranges, which are two values, pipe-separated. For example, &#x60;customFields&#x3D;rank:bronze|silver,birthDate:2000-01-01|2001-12-31&#x60; would match results whose custom field with internal name &#x60;rank&#x60; is either bronze or silver, and whose &#x60;birthDate&#x60; is between January 1, 2000 and December 31, 2001. To specify a single bound in ranges (like birth dates before December 31, 2001), use a pipe in one of the values, like &#x60;customFields&#x3D;birthDate:|2001-12-31&#x60;.        | [optional] 

### Return type

[**DataForEasyInvoice**](DataForEasyInvoice.md)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getEasyInvoiceQrCode"></a>
# **getEasyInvoiceQrCode**
> getEasyInvoiceQrCode(user, opts)

Returns a QR-code image with the URL for an easy invoice confirmation 

The generated QR-code image contains an URL in the form: &#x60;&lt;root&gt;/pay?to&#x3D;&lt;user&gt;&amp;amount&#x3D;&lt;amount&gt;...&#x60; 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.TicketsApi();

var user = "user_example"; // String | The user which will receive the easy invoice. Unlike other cases of user reference, in this case `self` cannot be used, because the URL URL may be shared with others, hence, `self` makes no sense. 

var opts = { 
  'amount': new Cyclos411Api.BigDecimal(), // BigDecimal | The easy invoice amount. If provided and the user has multiple currencies, either `type` or `currency` is required. 
  'type': "type_example", // String | The payment type id or qualified internal name (in the form `fromAccountType.paymentType`). Either this or `currency` should be informed if an `amount` was given and the user has multiple currencies. 
  'currency': "currency_example", // String | The currency id or internal name. Either this or `type` should be informed if an `amount` was given and the user has multiple currencies. 
  'description': "description_example", // String | The easy invoice description
  'size': "size_example" // String | The possible sizes of images. The actual pixel size depends on the configuration in Cyclos Possible values are: * large: Full image size * medium: Medium thumbnail * small: Small thumbnail 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getEasyInvoiceQrCode(user, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **user** | **String**| The user which will receive the easy invoice. Unlike other cases of user reference, in this case &#x60;self&#x60; cannot be used, because the URL URL may be shared with others, hence, &#x60;self&#x60; makes no sense.  | 
 **amount** | **BigDecimal**| The easy invoice amount. If provided and the user has multiple currencies, either &#x60;type&#x60; or &#x60;currency&#x60; is required.  | [optional] 
 **type** | **String**| The payment type id or qualified internal name (in the form &#x60;fromAccountType.paymentType&#x60;). Either this or &#x60;currency&#x60; should be informed if an &#x60;amount&#x60; was given and the user has multiple currencies.  | [optional] 
 **currency** | **String**| The currency id or internal name. Either this or &#x60;type&#x60; should be informed if an &#x60;amount&#x60; was given and the user has multiple currencies.  | [optional] 
 **description** | **String**| The easy invoice description | [optional] 
 **size** | **String**| The possible sizes of images. The actual pixel size depends on the configuration in Cyclos Possible values are: * large: Full image size * medium: Medium thumbnail * small: Small thumbnail  | [optional] 

### Return type

null (empty response body)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json, image/jpeg, image/gif, image/png

<a name="getTicketQrCode"></a>
# **getTicketQrCode**
> File getTicketQrCode(ticket, opts)

Returns the QR-code image for the given ticket only if its status is &#x60;open&#x60; 

This request will return the image contents as expected but our api  documentation page (or any other usage of an &amp;lt;img&amp;gt; tag), created  using swagger-ui, generates a second request to include the image in the page. This new (GET) request won&#39;t send the authentication parameters and  as this path requires authentication the image will be shown as broken. Optionally, to solve the problem described above and to allow authenticate the user when using sessions, a &#x60;sessionToken&#x60; or &#x60;accessClientToken&#x60;  query parameter could be specified. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.TicketsApi();

var ticket = "ticket_example"; // String | The ticket number.

var opts = { 
  'size': "size_example" // String | The possible sizes of images. The actual pixel size depends on the configuration in Cyclos Possible values are: * large: Full image size * medium: Medium thumbnail * small: Small thumbnail 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getTicketQrCode(ticket, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ticket** | **String**| The ticket number. | 
 **size** | **String**| The possible sizes of images. The actual pixel size depends on the configuration in Cyclos Possible values are: * large: Full image size * medium: Medium thumbnail * small: Small thumbnail  | [optional] 

### Return type

**File**

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json, image/jpeg, image/gif, image/png

<a name="newTicket"></a>
# **newTicket**
> Transaction newTicket(ticket, opts)

Creates a new ticket with status &#x60;open&#x60; for the logged user. 

The logged user will be the ticket&#39;s owner and then the receiver of the  payment generated after processing the ticket only if was previously approved by the payer. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');
var defaultClient = Cyclos411Api.ApiClient.instance;

// Configure API key authorization: accessClient
var accessClient = defaultClient.authentications['accessClient'];
accessClient.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//accessClient.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

// Configure API key authorization: session
var session = defaultClient.authentications['session'];
session.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.apiKeyPrefix = 'Token';

var apiInstance = new Cyclos411Api.TicketsApi();

var ticket = new Cyclos411Api.TicketNew(); // TicketNew | The data to create the new ticket

var opts = { 
  'fields': ["fields_example"] // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.newTicket(ticket, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ticket** | [**TicketNew**](TicketNew.md)| The data to create the new ticket | 
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 

### Return type

[**Transaction**](Transaction.md)

### Authorization

[accessClient](../README.md#accessClient), [basic](../README.md#basic), [session](../README.md#session)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="previewTicket"></a>
# **previewTicket**
> TicketPreview previewTicket(ticket, opts)

Previews the payment generated by the ticket. 

Previews the payment that will be generated if the ticket is approved by a user (i.e the payer). The ticket status must be  &#x60;open&#x60; and &#x60;successUrl&#x60; null or  &#x60;approved&#x60;. The actual balance checking is not  performed in the preview. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');
var defaultClient = Cyclos411Api.ApiClient.instance;

// Configure API key authorization: accessClient
var accessClient = defaultClient.authentications['accessClient'];
accessClient.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//accessClient.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

// Configure API key authorization: session
var session = defaultClient.authentications['session'];
session.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.apiKeyPrefix = 'Token';

var apiInstance = new Cyclos411Api.TicketsApi();

var ticket = "ticket_example"; // String | The ticket number

var opts = { 
  'fields': ["fields_example"] // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.previewTicket(ticket, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ticket** | **String**| The ticket number | 
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 

### Return type

[**TicketPreview**](TicketPreview.md)

### Authorization

[accessClient](../README.md#accessClient), [basic](../README.md#basic), [session](../README.md#session)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="processTicket"></a>
# **processTicket**
> TicketProcessResult processTicket(ticket, opts)

Processes a ticket by the receiver.

Processes an already approved ticket generating a new direct payment from the user who approve the ticket to the logged user (i.e the ticket&#39;s creator). A ticket can be processed only if its status is &#x60;approved&#x60; and the &#x60;orderId&#x60; (if any) matches the one given at ticket creation. After successfully processing it goes to the final status:  &#x60;processed&#x60;. 

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');
var defaultClient = Cyclos411Api.ApiClient.instance;

// Configure API key authorization: accessClient
var accessClient = defaultClient.authentications['accessClient'];
accessClient.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//accessClient.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

// Configure API key authorization: session
var session = defaultClient.authentications['session'];
session.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.apiKeyPrefix = 'Token';

var apiInstance = new Cyclos411Api.TicketsApi();

var ticket = "ticket_example"; // String | The ticket number

var opts = { 
  'fields': ["fields_example"], // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
  'orderId': "orderId_example" // String | The order id given at ticket creation. Must be specified only if an `orderId` was given when the ticket was created.   
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.processTicket(ticket, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ticket** | **String**| The ticket number | 
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 
 **orderId** | **String**| The order id given at ticket creation. Must be specified only if an &#x60;orderId&#x60; was given when the ticket was created.    | [optional] 

### Return type

[**TicketProcessResult**](TicketProcessResult.md)

### Authorization

[accessClient](../README.md#accessClient), [basic](../README.md#basic), [session](../README.md#session)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="viewTicket"></a>
# **viewTicket**
> TransactionView viewTicket(ticket, opts)

Returns details about a ticket by ticket number

Returns details about a ticket by ticket number.

### Example
```javascript
var Cyclos411Api = require('cyclos_411_api');

var apiInstance = new Cyclos411Api.TicketsApi();

var ticket = "ticket_example"; // String | The ticket number

var opts = { 
  'fields': ["fields_example"] // [String] | Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: `a,b.b1,c.-c1,c.-c2` will return the fields `a`, `b` (containing only the `b1` field) and `c` (containing all its fields except for `c1` or `c2`).  
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.viewTicket(ticket, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ticket** | **String**| The ticket number | 
 **fields** | [**[String]**](String.md)| Select which fields to include on returned data. If nothing is set, all object fields are returned. Unprefixed field names will be handled like a whitelist (only listed fields will be included), while names starting with a minus (-) or exclamation mark (!) will be handled as blacklist (listed fields will not be included). This works for nesting as well. For example: &#x60;a,b.b1,c.-c1,c.-c2&#x60; will return the fields &#x60;a&#x60;, &#x60;b&#x60; (containing only the &#x60;b1&#x60; field) and &#x60;c&#x60; (containing all its fields except for &#x60;c1&#x60; or &#x60;c2&#x60;).   | [optional] 

### Return type

[**TransactionView**](TransactionView.md)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

