assistance-engine/docs/developer.avapframework.com/Precios_de_los_distintos_se...

4.3 KiB

This service is used to obtain the total price of the user's use of a service.{' '}

GET: URL_BASE + /ws/util.py/precios_servicio

Receives:

All parameters are sent in the querystring of the call, so a percentage encoding for URI must be applied (aka URL encoding).

Returns:

Depending on the result of the operation, this service can return two different JSON:

Answer JSON OK, if it indicates only_commission is True:

{
         "status"
        :{' '}
        true
        ,
         "commission_fmt"
        : <string>
        ,
         "commission"
        : <decimal>
        ,
         "elapsed"
        : <float>
         }

Where:

  • status: Shows if the call has been successful (true) or not (false).
  • commission_fmt: Commission amount with the currency format.
  • commission: Commission amount without format.
  • elapsed: Operation execution time.

Answer JSON OK, if only_commission is not indicated True:

{
         "status"
        :{' '}
        true
        ,
         "codtran"
        : <string>
        ,
         "result"
        :{' '}
        {
         "origins"
        :{' '}
        [
         {
         <Origin_of_Funds>
         }
         ]
        ,
         "creators"
        :{' '}
        [
        ]
        ,
         }
         "elapsed"
        : <float>
         }

Where:

  • status: Shows if the call has been successful (true) or not (false).
  • codtran: Transaction code that identifies the executed operation.
  • result: Executed service answer.
  • origins: List with the origin of the user's funds. View structure on the endpoint origin_of_funds .
  • creators: List of types of sources of funds that the user can create.
  • elapsed: Operation execution time.

Answer JSON KO:

{
         "status"
        :{' '}
        false
        ,
         "level"
        : <string>
        ,
         "message"
        : <string>
        ,
         "error"
        : <string>
         }

Where:

  • status: Shows if the call has been successful (true) or not (false).
  • level: Error importance level.
  • message: Error message.
  • error: Sole error code.

Example requests:

Python - Requests:

import requests
         url ={' '}
        
          "URL_BASE/ws/util.py/precios_servicio?country_code=MX&user_id=4532&session_id=446-t5bsnhEOhn_1eUnifUk7xQ==&point_of_entry=moneysending&amount=1&only_commission=true"
        
         payload ={' '}
        {
        }
         files ={' '}
        {
        }
         headers={' '}
        {
        }
         response = requests
        .request
        (
        "GET"
        , url
        , headers
        =headers
        , data{' '}
        = payload
        , files{' '}
        = files
        )
         print
        (response
        .text
        .encode
        (
        'utf8'
        )
        )

NodeJs - Request:

var request = require('request');
         var options = {
         'method': 'GET',
         'url':
        'URL_BASE/ws/util.py/precios_servicio?country_code=MX&user_id=4532&session_id=446-t5bsnhEOhn_1eUnifUk7xQ==&point_of_entry=moneysending&amount=1&only_commission=true',
         'headers': {},
         formData: {}
         };
         request(options, function (error, response) {
         if (error) throw new Error(error);
         console.log(response.body);
         });

JavaScript - Fetch:

var formdata = new FormData();
         var requestOptions = {
         method: 'GET',
         body: formdata,
         redirect: 'follow'
         };
        {' '}
        fetch("URL_BASE/ws/util.py/precios_servicio?country_code=MX&user_id=4532&session_id=446-t5bsnhEOhn_1eUnifUk7xQ==&point_of_entry=moneysending&amount=1&only_commission=true",
        requestOptions)
         .then(response => response.text())
         .then(result => console.log(result))
         .catch(error => console.log('error', error));

CURL:

curl --location --request GET{' '}
        
          'URL_BASE/ws/util.py/precios_servicio?country_code=MX&user_id=4532&session_id=446-t5bsnhEOhn_1eUnifUk7xQ==&point_of_entry=moneysending&amount=1&only_commission=true'

Business logic:

This service returns a list with each of the movements of the large issuer user between two given dates.