npm package: @frentecorretora/change_request
Description: A sdk for interact with Change SOAP API
Author: Gustavo Rodarte
Latest version: 5.12.0

# Change Request

> A sdk for interact with Change SOAP API

## Instalation

`npm install change-request`
or
`yarn add change-request`

## Usage

```js
const RequestChange = require('change-request');

const url = 'http://sampleurl.com';
const timeout = 30000;

const requestChange = new RequestChange(url, timeout);

await requestChange.insertClient({
  agency: 10000,
  fullName: 'MAdasdas asdasdas',
  code: 87037473014,
  subType: 'F',
  address: 'Rua Baquirivu 392',
  city: 'São Paulo',
  state: 'SP',
  originCountryCode: 1058,
  countryCode: 1058,
  zipCode: '59148370',
});
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

- [Change Request](#change-request)
  - [Instalation](#instalation)
  - [Usage](#usage)
  - [API](#api)
      - [Table of Contents](#table-of-contents)
    - [Client](#client)
      - [Properties](#properties)
    - [Transaction](#transaction)
    - [PaperMoney](#papermoney)
      - [Properties](#properties-1)
    - [RequestChange](#requestchange)
      - [Parameters](#parameters)
      - [insertTransaction](#inserttransaction)
        - [Parameters](#parameters-1)
      - [insertPaperMoneyTransaction](#insertpapermoneytransaction)
        - [Parameters](#parameters-2)
      - [insertClient](#insertclient)
        - [Parameters](#parameters-3)
      - [searchClientByCode](#searchclientbycode)
        - [Parameters](#parameters-4)
      - [searchClientByShortName](#searchclientbyshortname)
        - [Parameters](#parameters-5)
      - [searchTransaction](#searchtransaction)
        - [Parameters](#parameters-6)
      - [searchTransactionByCode](#searchtransactionbycode)
        - [Parameters](#parameters-7)
      - [deleteInvoiceById](#deleteinvoicebyid)
        - [Parameters](#parameters-8)
    - [ClientBlocked](#clientblocked)
    - [ClientAlreadyExists](#clientalreadyexists)

### Client

A Client entity

Type: [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

#### Properties

-   `agency` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The Change agency related to the client
-   `fullName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Client full name
-   `shortName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Client CPF with only numbers
-   `code` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Client CPF as integer
-   `type` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Client type on Change
-   `subType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Client sub-type on Change
-   `address` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Address first line
-   `city` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Address city
-   `state` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Address state initials
-   `countryCode` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Address country code following Change internal rules
-   `originCountryCode` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Client origin country code following Change internal rules
-   `zipCode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Address zip code
-   `createdAt` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)** When client have been created on Change
-   `isActive` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Client status
-   `phone` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Obligation of the operation defined by Change
-   `mobile` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Obligation of the operation defined by Change
-   `birthDate` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)** Obligation of the operation defined by Change
-   `rg` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Client RG only numbers
-   `email` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Client email
-   `operationalLimit` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Client operational limit in dollars
-   `operationalLimitPeriod` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Operational limit period in days

### Transaction

TODO - Create Remittance transaction entity

Type: [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

### PaperMoney

A Paper Money transaction entity

Type: [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

#### Properties

-   `bank` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Bank inforamtion
-   `agency` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The agencyId of tha agency responsible for the money
-   `account` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The account number where the tranference will be made
-   `purposeCode` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Change purpodeCode for paper money
-   `clientCode` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Client cpf as integer
-   `currencyCode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Currency code following ISO 4217
-   `quotationValue` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Quotation value with 4 deciamals precision and without taxes
-   `nationalCurrencyValue` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** National currency value without taxes
-   `foreignCurrencyValue` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Foreign currency value without taxes
-   `levelingRate` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Leveling rate with 4 deciamals precision
-   `countryCode` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Country code
-   `iofValue` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Total IOF value of the national currency value
-   `deliveryCost` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Delivery cost of the operation
-   `modality` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Modality of the operation defined by Change
-   `obligation` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Obligation of the operation defined by Change

### RequestChange

Creates new RequestChange entity

#### Parameters

-   `baseURL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** public URL of change instance
-   `timeout` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Max time to waiting before cancel request (optional, default `30000`)

#### insertTransaction

Create new remittance transaction on Change

##### Parameters

-   `transactionData`  


-   Throws **[ClientBlocked](#clientblocked)** 

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The created transaction

#### insertPaperMoneyTransaction

Create new paper money transaction on Change

##### Parameters

-   `transactionData`  


-   Throws **[ClientBlocked](#clientblocked)** 

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The created transaction

#### insertClient

Create new Client on change

##### Parameters

-   `clientData`  


-   Throws **[ClientAlreadyExists](#clientalreadyexists)** 

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The created clien

#### searchClientByCode

Search client by code (CPF)

##### Parameters

-   `code` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The client CPF

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The client found

#### searchClientByShortName

Search client by shortName (CPF)

##### Parameters

-   `shortName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The client CPF

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The client found

#### searchTransaction

TODO

##### Parameters

-   `transactionData` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An transaction object

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The transaction found

#### searchTransactionByCode

Search transaction by code

##### Parameters

-   `code` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The trnsaction unique code

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The transaction found

#### deleteInvoiceById

Delete Invoice By Id

##### Parameters

-   `changeTransactionCode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Change invoice unique code

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Message with success with invoice id deleted

### ClientBlocked

Client has a blocked status on Change and the operation can't proceed

Type: [ClientBlocked](#clientblocked)

### ClientAlreadyExists

Client already exists on Change, use an update method instead an insert method

Type: [ClientAlreadyExists](#clientalreadyexists)