## Service identifier

SER.INT.ORI.AVA.001 MANAGEMENT OF OWN FUNDS RESOURCES.

## Description

This service allows managing the funds sources of a given user. It
          implements the operations of listing, creation, deletion, confirmation,
          change of default wallet and reordering on the sources of funds of said
          user.

## Endpoints

* Preproduction {' '} ` https://avanquia-prews.pademobile.com/ws/originsdefondos.py/gestor_origins_propios `
* Production {' '} ` https://appws.avanquia.com/ws/originsdefondos.py/gestor_origins_propios `

## Published operations

This service allows to execute the following operations on funds sources:

## Parameters

All parameters are sent in the call's  querystring , so{' '}
           percentage encoding for URIs  (aka{' '}
           URL encoding ) must be applied.

* Parameters, answers and exceptions common to all operations Common parameters Parameter Obligatory Format Description Default value id_usuario Yes Numeric ID of the user who owns the sources of funds with which to work N/A country_code Yes ISO 3166 alpha-2 Country code in which the user was registered N/A session_id Yes, if the parameter is not reported firma Alphanumeric Obtained by identifying the user with ID user_id {' '} on the platform N/A firma Yes, if the parameter is not reported session_id Alphanumeric Allows you to sign the petition, withour having to log in N/A command Yes Alphabetic Operation to be carried out on the origins of the user's funds N/A channel_id No Numeric Channel from which the request is made 1
* Common parameters Parameter Obligatory Format Description Default value id_usuario Yes Numeric ID of the user who owns the sources of funds with which to work N/A country_code Yes ISO 3166 alpha-2 Country code in which the user was registered N/A session_id Yes, if the parameter is not reported firma Alphanumeric Obtained by identifying the user with ID user_id {' '} on the platform N/A firma Yes, if the parameter is not reported session_id Alphanumeric Allows you to sign the petition, withour having to log in N/A command Yes Alphabetic Operation to be carried out on the origins of the user's funds N/A channel_id No Numeric Channel from which the request is made 1

* Common answers {' '} Depending on the result of the call, this service can return two different JSON : In case of success
* In case of success

### Where

`operation_result`  will be a JSON formed by the fields that the
          service returns according to the operation executed. In the following
          sections the content of this space will be specified for each operation.

* Parameters, answers and specific exceptions for each operation List of funds sources {' '} The parameter command acquires the value{' '} list . Specific parameters Parameter Obligatory Format Description Default value language No Alphabetic code Language in which the lists of sources of funds will be returned, if that language is supported User language list No Alphabetic Some services require two lists of sources of funds. This parameter allows you to hide origins for any of these two lists according to business rules origin service No Alphabetic Identifier of the service for which the listing is executed N/A type_of_origin_id No Numeric If reported, returns only user fund sources of the indicated type N/A
* List of funds sources {' '} The parameter command acquires the value{' '} list . Specific parameters Parameter Obligatory Format Description Default value language No Alphabetic code Language in which the lists of sources of funds will be returned, if that language is supported User language list No Alphabetic Some services require two lists of sources of funds. This parameter allows you to hide origins for any of these two lists according to business rules origin service No Alphabetic Identifier of the service for which the listing is executed N/A type_of_origin_id No Numeric If reported, returns only user fund sources of the indicated type N/A
* Specific parameters Parameter Obligatory Format Description Default value language No Alphabetic code Language in which the lists of sources of funds will be returned, if that language is supported User language list No Alphabetic Some services require two lists of sources of funds. This parameter allows you to hide origins for any of these two lists according to business rules origin service No Alphabetic Identifier of the service for which the listing is executed N/A type_of_origin_id No Numeric If reported, returns only user fund sources of the indicated type N/A

* Specific answer {' '} Each source of funds in the origins list is represented by a JSON with the following structure:

### Where:

* balance_fmt : Formatted balance, with thousands / millions division, decimals and currency symbol.
* balance : Available balance of the funds source.
* real_balance : Total balance of the funds source, that is, the available balance plus all the held balance.
* withholdings : Specifies whether the funds source has associated balance holds.
* retained_balances : If the funds source has associated balance holds, each item in this list will store both the amount of the hold and the hold ID.
* image : Image associated with the funds source.
* class : Indicates the type of funds source.
* authorized : It allows to know if they are possible to operate with the source of funds or not.
* permit_errase : Each funds source, depending on its configuration, may or may not be deleted by the user.
* id : Funds source ID.{' '} Note : This field has the following range of values: [1 - 2,147,483,647].
* permit_various : Specifies whether multiple funds source of the same type are allowed to exist at the same time.
* currency_id_currencies : ID of the currency with which it works at the funds source.
* type: Funds source type ID.
* permit_income : The funds source may or may not admit income.
* permit_charges : The funds source may or may not admit charges.
* name : Funds source name.
* base_class : The class of a funds source defines its nature (card, local source of funds…).
* pending_of_revision : Indicates whether or not the origin is to be reviewed by an administrator or operator.

Each element of the list  list_of_withholdings  will have the
          following structure:

The fields{' '}
           
            fmt_balance, _fmt_compact_balance, balance, actual_balance, and
            held_balances
           {' '}
          are returned as long as the balance of the source of funds is known. For
          example, for credit cards no information regarding the balance is
          returned.

Each element of the  creators  list is a JSON that defines a type
          of source of funds:

* Specific exceptions Does not send specific exceptions
* Funds source creation {' '} The parameter command acquires the value{' '} crear .
* Specific parameters Parameters Obligatory Format Description Default value source_id_or_profile Yes, if not reported template_id Numeric Ensures that the user has permissions on the type of funds source to create N/A template_id Yes, if not reported source_id_or_profile Numeric Same role as source_id_or_profile. Maintained for backward compatibility N/A anioexpiracion Yes for card-type origins Numeric, YYYY Card expiration year N/A mesexpiracion Yes for card-type origins Numeric, MM Card expiration month N/A cardnumber Yes for card-type origins Numeric Card number N/A validationcode Yes for card-type origin Numeric Card validation code N/A name Yes Alphabetic Name of the new funds source N/A

* Specific answer

Returns the ID of the source of funds created on the call.

* Specific exceptions Message Cause The origin_id source_id_or_profile is not allowed in the account <account> The user does not have permissions to create a source of the selected type The origin_id source_id_or_profile is not allowed in the account <account> The source of funds is created only during the registration process The purse is already created One or more key data (for example, card number) provided to create the wallet is already present in another source of funds of the same type It is not possible to create this source of funds without being certified A non-certified user wants to create a risk fund source (for example, credit card)

* Funds sources errase

The parameter  command  acquires the value  errase

* Specific parameter Parameter Obligatory Format Description Default value Examples source_id_or_profile Yes, if not reported template_id Numeric Funds source ID to errase N/A 189, 17673, 9872 template_id Yes, if not reported source_id_or_profile Numeric Same role as source_id_or_profile. Maintained for backward compatibility N/A 189, 17673, 9872

* Answer Empty.
* Specific exceptions Message Cause The origin_id source_id_or_profile it is not allowed in the account <account> The funds source indicated in source_id_or_profile does not exist or does not belong to the user who performs the operation The origin_id source_id_or_profile it is not allowed in the account <account> The type of funds source to be deleted does not allow it to be deleted The card could not be deleted: Please contact customer service at the number <number> An attempt has been made to delete a card-type source of funds, but the payment gateway returns an error

* Activate fund sources {' '} The parameter command acquires the value{' '} confirmed .
* Specific parameters Parameter Obligatory Format Description Default value source_id_or_profile Yes, if not reported template_id Numeric Funds source ID to activate N/A template_id Yes, if not reported source_id_or_profile Numeric Same role as source_id_or_profile. Maintained for backward compatibility N/A amount1 Yes for card-type origins Numeric Decimals (cents) of the first validation charge. Only for card-type origins N/A amount2 Yes for card-type origins Numeric Decimals (cents) of the second validation charge. Only for card-type origins N/A

* Specific answer

* Specific exceptions Message Cause The origin_id source_id_or_profile is not allowed in the account <account> The funds source indicated in source_id_or_profile does not exist or does not belong to the user who performs the operation Incorrect data in the card confirmation, please try again The data provided to confirm a card-type origin is incorrect Attempts to confirm the card passed The limit of attempts to confirm a card origin has been exceeded

* Change funds source defaults

The parameter  command  acquires de value{' '}
           change_by_defect .

* Specific paramters Parameter Obligatory Format Description Default value source_id_or_profile Yes, if not reported template_id Numeric Funds source ID to activate N/A template_id Yes, if not reported source_id_or_profile Numeric Same role as source_id_or_profile. Maintained for backward compatibility N/A

* Specific answer Empty.
* Specific exception Message Cause The origin_id source_id_or_profile is not allowed in the account <account> The indicated source of funds source_id_or_profile does not exist or does not belong to the user who performs the operation The origin_id source_id_or_profile is not allowed in the account <account> Due to backward compatibility with types of sources of old funds.

* Reorder Fund Sources {' '} The parameter command acquires value reorder .
* Specific parameters Parameter Obligatory Format Description Default value new_order Yes Alphanumeric. New order separated by commas New order of user origins N/A

* Specific answer Empty.
* Specific exceptions Message Cause The origin_id source_id_or_profile is not allowed in the account <account> Some of the sources of funds in the list does not exist or does not belong to the user who performs the operation

* Movements of funds sources {' '} The parameter command acquires the value{' '} movements .
* Specific parameters Parameter Obligatory Format Description Default value source_id_or_profile Yes Numeric Funds source from which the information is required N/A date_desde No IS0 8601 Start date of the movement list N/A date_hasta No IS0 8601 End date of the movement list N/A pagina No Numeric Page to start from 1 limite No Numeric Number of results per page 10

* Specific answer

### Where:

The field  movements  will return a list of JSON. Each of these
          JSON will have the following content:

### Where:

* transaction_code : Transaction code
* concept : Transaction object.
* date : Date on which the movement is made.
* amount : Amount of movement. Includes commissions.
* balance_disponible : Available balance at the source of funds that originates the movement.
* real_balance : Actual balance of the source of funds that originates the movement..
* rfc : RFC of the account that originates the movement.
* business_name : The business social reason. It corresponds to the name associated with it ( name parameter informed in the call to the registration service).
* transaction_status : Status of the transaction associated with the movement. See table Annex 1 in section{' '} Annex , line{' '} estados de transacciones .
* currency_id : Identifier of the currency in which the movement is made.
* account_id_origin : Unique identifier of the source account.
* account_id_destination : Unique identifier of the target account.
* origin_id_origin : Unique identifier of the source of funds with which the movement originates.
* origin_id_destination : Unique identifier of the source of funds that receives the amount of the operation.
* error_id : Identifier of the error that caused the operation to abort. OPTIONAL .
* exception : Detail of the error that caused the operation to abort. OPTIONAL .
* channel_id : Channel through which the movement was made..
* Specific exceptions Message Cause The origin_id source_id_or_profile does not exist The source of funds indicated in source_id_or_profile {' '} does not exist {' '} Table 2.b.17 : List of specific exceptions for the operation movements .
* Business logic: {' '} This section details some particularities related to this service that it is advisable to take into account.{' '} Deleted fund sources are not added to the list_origins_ when listing a user's source of funds. If at the time of listing the sources of funds of a user he has a wallet associated with solutions (promotions) and the latter is not active, they are not added to the list. The fund sources listing operation can be configured so that certain types of wallets are not added to the lista_origins _ according to the service for which the operation was invoked (_paramtero_servicio). You cannot create fondos locales_ _(like Pademobile Balance) or those that only allow one source of funds of its type in an account. Non-risk sources of funds are automatically authorized during the creation process. Otherwise, the user must follow the rules of the type of source of funds created to authorize it. For example, for credit cards it will be necessary to enter the decimals of two different test charges. The total amount of these two charges is returned to the owner of the source of funds once said wallet is authorized. All administrators have an action in the system that allows authorizing or rejecting a source of funds directly, without the need to enter any type of extra information. If the confirmation attempt limit is exceeded for a source of funds, it is marked as deleted. The maximum number of confirmation attempts depends on the type of source of funds.
* Deleted fund sources are not added to the list_origins_ when listing a user's source of funds.
* If at the time of listing the sources of funds of a user he has a wallet associated with solutions (promotions) and the latter is not active, they are not added to the list.
* The fund sources listing operation can be configured so that certain types of wallets are not added to the lista_origins _ according to the service for which the operation was invoked (_paramtero_servicio).
* You cannot create fondos locales_ _(like Pademobile Balance) or those that only allow one source of funds of its type in an account.
* Non-risk sources of funds are automatically authorized during the creation process. Otherwise, the user must follow the rules of the type of source of funds created to authorize it. For example, for credit cards it will be necessary to enter the decimals of two different test charges. The total amount of these two charges is returned to the owner of the source of funds once said wallet is authorized.
* All administrators have an action in the system that allows authorizing or rejecting a source of funds directly, without the need to enter any type of extra information.
* If the confirmation attempt limit is exceeded for a source of funds, it is marked as deleted. The maximum number of confirmation attempts depends on the type of source of funds.

This section details, for each environment, all the information necessary
          to exploit the previously documented services.

Additionally, there is a test user already created, which can be used to
          exploit the services described in this documentation.
