Contas a Receber (ReceivableAccount)

As Contas a Receber devem ser acessadas de maneira aninhada à entidade (Entity) à qual pertencem.

Atributos

- entity_id                          | integer  | Identificador a entidade associada a conta a receber
- status                             | integer  | Situação da conta a receber
                                                  1 - não recebido
                                                  2 - recebido
                                                  3 - recebido e conciliado
- status_name                        | integer  | Descrição da situação da conta a receber
                                                  unreceived - não recebido
                                                  received - recebido
                                                  reconciled - recebido e conciliado
- due_date                           | date     | Data de vencimento
- occurred_at                        | date     | Data de ocorrência
- amount                             | decimal  | Valor a receber
- ticket_amount                      | decimal  | Valor da multa na conta a receber
- interest_amount                    | decimal  | Valor dos juros da conta a receber
- discount_amount                    | decimal  | Valor do desconto da conta a receber
- nominal_amount                     | decimal  | Valor nominal da conta a receber
- total_amount                       | decimal  | Valor calculado a partir do valor nominal e dos valores de multa, juros e desconto
- description                        | string   | Descrição da conta a receber
- document                           | string   | Documento da conta a receber
- document_emission_date             | date     | Data da emissão do documento da conta a receber
- observation                        | text     | Observações sobre a conta a receber
- remind                             | boolean  | Recebe um email do vencimento da conta a receber, default false
- reminded_at                        | date     | Dia que o usuário será lembrado do vencimento da conta a receber
- income_tax_relevant                | boolean  | Relevante para o imposto de renda, default false
- category_id                        | integer  | Identificador da categoria associada a conta a receber
- classification_center_id           | integer  | Identificador da centro de custo/receita associado a conta a receber
- expected_deposit_account_id        | integer  | Identificador da conta bancária que receberá a conciliação
- recurrence_id                      | integer  | Identificador do gerenciador da recorrência
- person_id                          | integer  | Identificador do cliente/fornecedor associado a conta a receber
- custom_classifications             | array    | Array de classificadores personalizados.
                                                  Deve ser passado o nome do classificador personalizado e seu valor.
- recurrent                          | boolean  | Indica se é recorrente, default false
- parcelled                          | boolean  | Indica se é parcelado, default false,
- recurrence_period                  | integer  | Indica a periodicidade da conta a receber
                                                  weekly      - semanal
                                                  biweekly    - quinzenal
                                                  monthly     - mensal
                                                  bimonthly   - bimestral
                                                  quarterly   - trimestral
                                                  semiannual  - semestral
                                                  annual      - anual
- number_of_parcels                  | integer  | Número de parcelas
- current_parcel                     | integer  | Atual parcela
- financial_account_taxes_attributes | array    | Array dos impostos, DEPRECIADO use taxes_attributes
- tax_charges                        | array    | Array dos impostos
                                                  amount       - valor do imposto
                                                  tax_id       - id do imposto, veja a documentação de Impostos para saber os valores
                                                  withholding  - retido na fonte, caso seja true será calculado no total
- eletronic_invoices                 | array    | Array de Notas Fiscais
                                                  url          - URL da Nota Fiscal
                                                  extra        - Objeto extra da Nota Fiscal.
                                                                 Ver seção de Notas Fiscais para mais informações

Listar Contas a Receber

GET /entities/:entity_id/receivable_accounts

Retorna uma lista (paginada) de todas as Contas a Receber da Entity que usuários possui acesso. Para designar o número de registros por página, passar o parâmetro per_page no endpoint. Caso o parâmetro não seja passado, o default de 50 será utilizado. O limite superior é de 500 registros por página. Para navegar entre as diferentes páginas, basta usar o parâmetro page. Exemplo:

GET /entities/:entity_id/receivable_accounts?per_page=15&page=3

O endpoint acima irá retornar a terceira página da listagem de Contas a Receber com 15 registros em cada.

Exemplo de Resposta

HTTP/1.1 200 OK
Date: Mon, 17 Jan 2011 20:00:02 GMT
Content-Type: application/json; charset=utf-8
Links: <http://app.myfinance.com.br/entities/1/receivable_accounts.json?page=1&per_page=50>;rel="first",
       <http://app.myfinance.com.br/entities/1/receivable_accounts.json?page=3&per_page=50>;rel="last",
       <http://app.myfinance.com.br/entities/1/receivable_accounts.json?page=3&per_page=50>;rel="next",
       <http://app.myfinance.com.br/entities/1/receivable_accounts.json?page=1&per_page=50>;rel="prev"
[
    {
        "receivable_account": {
            "id": 1,
            "entity_id": 1,
            "status": 1,
            "status_name": "unreceived",
            "due_date": "2011-09-10",
            "occurred_at": null,
            "amount": "100.0",
            "ticket_amount": null,
            "interest_amount": null,
            "discount_amount": null,
            "nominal_amount": null,
            "total_amount": null,
            "description": "Material para escritório",
            "document": "897671718",
            "document_emission_date": "2011-08-07",
            "observation": "Papel para impressão.",
            "remind": true,
            "reminded_at": null,
            "income_tax_relevant": true,
            "category_id": 3,
            "classification_center_id": null,
            "expected_deposit_account_id": 1,
            "recurrence_id": null,
            "person_id": 3,
            "created_at": "2011-08-17T11:51:26-03:00",
            "updated_at": "2011-08-17T11:51:26-03:00",
            "parcels_amount": "300.0",
            "parcelled": true,
            "recurrence_period": "monthly",
            "number_of_parcels": 3,
            "current_parcel": 1,
            "competency_month": "2011-09",
            "sale_account_id": null,
            "sale_ids": [],
            "financial_account_taxes_attributes": [
              {
                "id": 1,
                "tax_id": 1,
                "amount": 12.0,
                "withholding": true
              }
            ],
            "tax_charges": [
              {
                "id": 1,
                "tax_id": 1,
                "amount": 12.0,
                "withholding": true
              }
            ],
            "custom_classifications": [
              {
                "id": 27,
                "custom_classifier_id": 1,
                "custom_classifier_name": "Região",
                "value": "Sudeste", # DEPRECATED
                "name": "Sudeste",
                "amount": 36,
                "percentage": 100
              }
            ],
            "classification_center_classifications":[
              {
                id: "27",
                classification_center_id: 1,
                name: "Sudeste",
                percentage: "100.0",
                amount: "36.0"
              }
            ],
            "reconciliations": {
              "financial_transactions": [],
              "financial_accounts": []
            },
            "links": [
                {
                    "rel": "self",
                    "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
                    "method": "get"
                },
                {
                    "rel": "destroy",
                    "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
                    "method": "delete"
                },
                {
                    "rel": "receive",
                    "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive",
                    "method": "put"
                }
            ]
        }
    }
]
HTTP/1.1 200 OK
Date: Mon, 17 Jan 2011 20:00:02 GMT
Content-Type: application/xml; charset=utf-8
Links: <http://app.myfinance.com.br/entities/1/receivable_accounts.xml?page=1&per_page=50>;rel="first",
       <http://app.myfinance.com.br/entities/1/receivable_accounts.xml?page=3&per_page=50>;rel="last",
       <http://app.myfinance.com.br/entities/1/receivable_accounts.xml?page=3&per_page=50>;rel="next",
       <http://app.myfinance.com.br/entities/1/receivable_accounts.xml?page=1&per_page=50>;rel="prev"
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-accounts type="array">
    <receivable-account>
      <id type="integer">17</id>
      <entity-id type="integer">1</entity-id>
      <status type="integer">1</status>
      <status-name type="symbol">unreceived</status-name>
      <due-date type="date">2011-09-10</due-date>
      <occurred-at nil="true"></occurred-at>
      <amount type="decimal">100.0</amount>
      <ticket-amount nil="true"></ticket-amount>
      <interest-amount nil="true"></interest-amount>
      <discount-amount nil="true"></discount-amount>
      <nominal-amount nil="true"></nominal-amount>
      <total-amount nil="true"></total-amount>
      <description>Material para escrit&#243;rio</description>
      <document>897671718</document>
      <observation>Papel para impress&#227;o.</observation>
      <remind type="boolean">true</remind>
      <reminded-at nil="true"></reminded-at>
      <income_tax_relevant type="boolean">true</income_tax_relevant>
      <category-id type="integer">3</category-id>
      <classification-center-id nil="true"></classification-center-id>
      <expected-deposit-account-id type="integer">1</expected-deposit-account-id>
      <recurrence-id nil="true"></recurrence-id>
      <person-id type="integer">3</person-id>
      <created-at type="datetime">2011-08-17T11:51:26-03:00</created-at>
      <updated-at type="datetime">2011-08-17T11:51:26-03:00</updated-at>
      <parcels-amount type="decimal">300.0</parcels-amount>
      <recurrent type="boolean">false</recurrent>
      <parcelled type="boolean">true</recurrent>
      <recurrence-period>monthly</recurrence-period>
      <number-of-parcels type="integer">3</number-of-parcels>
      <current-parcel type="integer">1</current-parcel>
      <competency-month>2011-09</competency-month>
      <sale-account-id nil="true" />
      <sale-ids type="array">
      </sale-ids>
      <financial-account-taxes-attributes type="array">
        <financial-account-taxes-attribute>
          <id type="integer">1</id>
          <tax-id type="integer">1</tax-id>
          <amount type="decimal">12.0</amount>
          <withholding type="boolean">true</withholding>
        </financial-account-taxes-attribute>
      </financial-account-taxes-attributes>
      <tax-charges type="array">
        <tax-charge>
          <id type="integer">1</id>
          <tax-id type="integer">1</tax-id>
          <amount type="decimal">12.0</amount>
          <withholding type="boolean">true</withholding>
        </tax-charge>
      </tax-charges>
      <custom-classifications type="array">
        <custom-classification>
          <id type="integer">27</id>
          <custom-classifier-id type="integer">1</custom-classifier-id>
          <custom-classifier-name>Região</custom-classifier-name>
          <value>Sudeste</value> # DEPRECATED
          <name>Sudeste</name>
          <percentage type="decimal">100.0</percentage>
          <amount type="decimal">36.0</amount>
        </custom-classification>
      </custom-classifications>
      <classification-center-classifications type="array">
        <classification-center-classification>
          <id type="integer">27</id>
          <classification-center-id type="integer">1</classification-center-id>
          <name>Sudeste</name>
          <percentage type="decimal">100.0</percentage>
          <amount type="decimal">36.0</amount>
        </classification-center-classification>
      </classification-center-classifications>
      <reconciliations>
        <financial-accounts type="array">
        </financial-accounts>
        <financial-transactions type="array">
        </financial-transactions>
      </reconciliations>
      <links type="array">
        <link>
          <rel>self</rel>
          <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
          <method>get</method>
        </link>
        <link>
          <rel>destroy</rel>
          <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
          <method>delete</method>
        </link>
        <link>
          <rel>receive</rel>
          <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive</href>
          <method>put</method>
        </link>
      </links>
    </receivable-account>
  </receivable-accounts>

Exibir modelo de nova Conta a Receber

GET /entities/:entity_id/receivable_accounts/new

Retorna os atributos de uma nova conta a receber, com os valores default. Use como modelo para criar novas contas a receber.

Exemplo de Resposta

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Fri, 19 Aug 2011 15:23:33 GMT
{
    "receivable_account": {
        "entity_id": 1,
        "due_date": "2011-08-19",
        "occurred_at": null,
        "amount": null,
        "ticket_amount": null,
        "interest_amount": null,
        "discount_amount": null,
        "nominal_amount": null,
        "total_amount": null,
        "description": null,
        "document": null,
        "document_emission_date": null,
        "observation": null,
        "remind": false,
        "income_tax_relevant": true,
        "category_id": null,
        "classification_center_id": null,
        "person_id": null,
        "expected_deposit_account_id": null,
        "create_as_recurrent": null,
        "links": [
            {
                "rel": "create",
                "href": "https://app.myfinance.com.br/entities/1/receivable_accounts",
                "method": "post"
            }
        ]
    }
}
HTTP/1.1 200 OK
Content-Type: application/xml; charset=utf-8
Date: Fri, 19 Aug 2011 15:23:33 GMT
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <entity-id type="integer">1</entity-id>
    <due-date type="date">2011-08-19</due-date>
    <occurred-at nil="true"></occurred-at>
    <amount nil="true"></amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <nominal-amount nil="true"></nominal-amount>
    <total-amount nil="true"></total-amount>
    <description nil="true"></description>
    <document nil="true"></document>
    <observation nil="true"></observation>
    <remind type="boolean">false</remind>
    <income_tax_relevant type="boolean">true</income_tax_relevant>
    <category-id nil="true"></category-id>
    <classification-center-id nil="true"></classification-center-id>
    <person-id nil="true"></person-id>
    <expected-deposit-account-id nil="true"></expected-deposit-account-id>
    <create-as-recurrent></create-as-recurrent>
    <links type="array">
      <link>
        <rel>create</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts</href>
        <method>post</method>
      </link>
    </links>
  </receivable-account>

Exibir uma Conta a Receber

GET /entities/:entity_id/receivable_accounts/:id

Retorna 200 OK e os dados da conta a receber solicitada.

Exemplo de Resposta

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Fri, 19 Aug 2011 15:29:58 GMT
{
  "receivable_account": {
    "id": 1,
    "entity_id": 1,
    "status": 3,
    "status_name": "received",
    "due_date": "2011-09-10",
    "occurred_at": "2011-09-10",
    "amount": "100.0",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "nominal_amount": null,
    "total_amount": "100.0",
    "description": "Material para escritório",
    "document": "897671718",
    "document_emission_date": "2011-08-07",
    "observation": "Papel para impressão.",
    "remind": true,
    "reminded_at": "2011-09-09",
    "income_tax_relevant": true,
    "category_id": 3,
    "classification_center_id": null,
    "expected_deposit_account_id": 1,
    "recurrence_id": null,
    "person_id": 3,
    "created_at": "2011-08-19T11:51:26-03:00",
    "updated_at": "2011-08-19T11:51:26-03:00",
    "parcels_amount": "300.0",
    "parcelled": true,
    "recurrence_period": "monthly",
    "number_of_parcels": 3,
    "current_parcel": 1,
    "competency_month": "2011-09",
    "sale_account_id": null,
    "sale_ids": [],
    "financial_account_taxes_attributes": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ],
    "tax_charges": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ],
    "custom_classifications": [
      {
        "id": 27,
        "custom_classifier_id": 1,
        "custom_classifier_name": "Região",
        "value": "Sudeste", # DEPRECATED
        "name": "Sudeste",
        "amount": 36,
        "percentage": 100
      }
    ],
    "classification_center_classifications":[
      {
        id: "27",
        classification_center_id: 1,
        name: "Sudeste",
        percentage: "100.0",
        amount: "36.0"
      }
    ],
    "reconciliations": {
      "financial_transactions": [{
        "id": 5,
        "links": [{
          "rel": "self",
          "href": "https://app.myfinance.com.br/entities/1/deposit_accounts/1/financial_transactions/5",
          "method": "get"
        }]
      }],
      "financial_accounts": []
    },
    "links": [
      {
        "rel": "self",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
        "method": "get"
      },
      {
        "rel": "destroy",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
        "method": "delete"
      },
      {
        "rel": "receive",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive",
        "method": "put"
      }
    ]
  }
}
HTTP/1.1 200 OK
Content-Type: application/xml; charset=utf-8
Date: Fri, 19 Aug 2011 15:29:58 GMT
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <id type="integer">1</id>
    <entity-id type="integer">1</entity-id>
    <status type="integer">3</status>
    <status-name type="symbol">received</status-name>
    <due-date type="date">2011-09-10</due-date>
    <occurred-at type="date"><2011-09-10/occurred-at>
    <amount type="decimal">100.0</amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <nominal-amount nil="true"></nominal-amount>
    <total-amount type="decimal">100.0</total-amount>
    <description>Material para escrit&#243;rio</description>
    <document>897671718</document>
    <observation>Papel para impress&#227;o.</observation>
    <remind type="boolean">true</remind>
    <reminded-at nil="true"></reminded-at>
    <income_tax_relevant type="boolean">true</income_tax_relevant>
    <category-id type="integer">3</category-id>
    <classification-center-id nil="true"></classification-center-id>
    <expected-deposit-account-id type="integer">1</expected-deposit-account-id>
    <recurrence-id nil="true"></recurrence-id>
    <person-id type="integer">3</person-id>
    <created-at type="datetime">2011-08-19T11:51:26-03:00</created-at>
    <updated-at type="datetime">2011-08-19T11:51:26-03:00</updated-at>
    <parcels-amount type="decimal">300.0</parcels-amount>
    <recurrent type="boolean">false</recurrent>
    <parcelled type="boolean">true</recurrent>
    <recurrence-period>monthly</recurrence-period>
    <number-of-parcels type="integer">3</number-of-parcels>
    <current-parcel type="integer">1</current-parcel>
    <competency-month>2011-09</competency-month>
    <sale-account-id nil="true" />
    <sale-ids type="array">
    </sale-ids>
    <financial-account-taxes-attributes type="array">
      <financial-account-taxes-attribute>
        <id type="integer">1</id>
        <tax-id type="integer">1</id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </financial-account-taxes-attribute>
    </financial-account-taxes-attributes>
    <tax-charges type="array">
      <tax-charge>
        <id type="integer">1</id>
        <tax-id type="integer">1</id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </tax-charge>
    </tax-charges>
    <custom-classifications type="array">
      <custom-classification>
        <id type="integer">27</id>
        <custom-classifier-id type="integer">1</custom-classifier-id>
        <custom-classifier-name>Região</custom-classifier-name>
        <value>Sudeste</value> # DEPRECATED
        <name>Sudeste</name>
        <percentage type="decimal">100.0</percentage>
        <amount type="decimal">36.0</amount>
      </custom-classification>
    </custom-classifications>
    <classification-center-classifications type="array">
      <classification-center-classification>
        <id type="integer">27</id>
        <classification-center-id type="integer">1</classification-center-id>
        <name>Sudeste</name>
        <percentage type="decimal">100.0</percentage>
        <amount type="decimal">36.0</amount>
      </classification-center-classification>
    </classification-center-classifications>
    <reconciliations>
      <financial-transactions type="array">
        <financial-transactions>
          <id type="integer">5</id>
          <links type="array">
            <rel>self</rel>
            <href>https://app.myfinance.com.br/entities/1/deposit_accounts/1/financial_transactions/5</href
            <method>get</method>
          </links>
        </financial-transaction>
      </financial-transactions>
      <financial-accounts type="array">
      </financial-accounts>
    </reconciliations>
    <links type="array">
      <link>
        <rel>self</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
        <method>get</method>
      </link>
      <link>
        <rel>destroy</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
        <method>delete</method>
      </link>
      <link>
        <rel>receive</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive</href>
        <method>put</method>
      </link>
    </links>
  </receivable-account>

Informações adicionais sobre Notas Fiscais

Caso a sua Conta a Receber esteja associada a uma nota fiscal do Emites, o atributo eletronic_invoices trará as informações relevantes. Ele possui o seguinte formato:

{
  "eletronic_invoices": [
    {
      "url": "https://sandbox.emites.com.br/nfse/show/42",
      "extra": {
        "service": "Emites",
        "status": "accepted",
        "id": 42
      }
    }
  ]
}
<eletronic-invoices>
  <extra>
    <id>42</id>
    <service>Emites</service>
    <status>accepted</status>
  </extra>
  <url>https://sandbox.emites.com.br/nfse/show/42</url>
</eletronic-invoices>

A listagem de status possíveis pode ser encontrada na API do Emites.

Criar uma Conta a Receber

POST /entities/:entity_id/receivable_accounts

Enviar os parâmetros para criação do objeto como XML ou JSON (conforme o formato escolhido) no corpo da requisição HTTP.

Em caso de sucesso, retorna 201 Created mais o caminho para o objeto criado no header Location, além dos dados do objeto criado. Em caso de erro, retorna 422 Unprocessable Entity e as mensagens de erro informando porque a conta a receber não pôde ser criada.

Exemplo de Requisição

{
  "receivable_account": {
    "due_date": "2011-09-20",
    "occurred_at": null,
    "amount": "100.0",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "nominal_amount": null,
    "total_amount": null,
    "description": null,
    "document": null,
    "document_emission_date": null,
    "observation": null,
    "remind": false,
    "income_tax_relevant": false,
    "category_id": null,
    "classification_center_id": null,
    "person_id": null,
    "expected_deposit_account_id": null,
    "create_as_recurrent": null,
    "custom_classifications": [
      {
        "custom_classifier_id": 1,
        "name": "Sudeste"
        "amount": 100
      }
    ],
    "classification_center_classifications":[
      {
        classification_center_id: 1,
        name: "Sudeste",
        amount: "100.0"
      }
    ],
    "tax_charges": [
      {
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ]
  }
}
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <due-date type="date">2011-09-20</due-date>
    <occurred-at nil="true"></occurred-at>
    <amount>100.0</amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <nominal-amount nil="true"></nominal-amount>
    <total-amount nil="true"></total-amount>
    <description nil="true"></description>
    <document nil="true"></document>
    <observation nil="true"></observation>
    <remind type="boolean">false</remind>
    <income_tax_relevant type="boolean">false</income_tax_relevant>
    <category-id nil="true"></category-id>
    <classification-center-id nil="true"></classification-center-id>
    <person-id nil="true"></person-id>
    <expected-deposit-account-id nil="true"></expected-deposit-account-id>
    <create-as-recurrent></create-as-recurrent>
    <custom-classifications type="array">
      <custom-classification>
        <custom-classifier-id type="integer">1</custom-classifier-id>
        <name type="string">Sudeste</name>
        <amount type="decimal>100</amount>
      </custom-classification>
    </custom-classifications-attributes>
    <classification-center-classifications type="array">
      <classification-center-classification>
        <id type="integer">27</id>
        <classification-center-id type="integer">1</classification-center-id>
        <name>Sudeste</name>
        <amount type="decimal">36.0</amount>
      </classification-center-classification>
    </classification-center-classifications>
    <tax-charges type="array">
      <tax-charge>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </tax-charge>
    </tax-charges>
  </receivable-account>

Exemplo de Resposta

HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/receivable_accounts/1
Content-Type: application/json; charset=utf-8
Date: Fri, 19 Aug 2011 16:33:02 GMT
{
  "receivable_account": {
    "id": 1,
    "entity_id": 1,
    "status": 1,
    "status_name": "unreceived",
    "due_date": "2011-09-20",
    "occurred_at": null,
    "amount": "100.0",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "total_amount": null,
    "description": null,
    "document": null,
    "observation": null,
    "remind": false,
    "reminded_at": null,
    "income_tax_relevant": false,
    "category_id": null,
    "classification_center_id": null,
    "expected_deposit_account_id": null,
    "recurrence_id": null,
    "person_id": null,
    "created_at": "2011-08-19T13:36:29-03:00",
    "updated_at": "2011-08-19T13:36:29-03:00",
    "recurrent": false,
    "parcelled": false,
    "recurrence_period": null,
    "number_of_parcels": null,
    "current_parcel": null,
    "sale_account_id": null,
    "sale_ids": [],
    "custom_classifications": [
        {
          "id": 27,
          "custom_classifier_id": 1,
          "custom_classifier_name": "Região",
          "value": "Sudeste", # DEPRECATED
          "name": "Sudeste",
          "amount": 100,
          "percentage": 100
        }
    ],
    "classification_center_classifications":[
      {
        id: "27",
        classification_center_id: 1,
        name: "Sudeste",
        percentage: "100.0",
        amount: "36.0"
      }
    ],
    "financial_account_taxes_attributes": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ],
    "tax_charges": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ],
    "reconciliations": {
      "financial_transactions": [],
      "financial_accounts": []
    },
    "links": [
      {
        "rel": "self",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
        "method": "get"
      },
      {
        "rel": "destroy",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
        "method": "delete"
      },
      {
        "rel": "receive",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive",
        "method": "put"
      }
    ]
  }
}
HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/receivable_accounts/1
Content-Type: application/xml; charset=utf-8
Date: Fri, 19 Aug 2011 16:33:03 GMT
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <id type="integer">1</id>
    <entity-id type="integer">1</entity-id>
    <status type="integer">1</status>
    <status-name type="symbol">unreceived</status-name>
    <due-date type="date">2011-09-20</due-date>
    <occurred-at nil="true"></occurred-at>
    <amount type="decimal">100.0</amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <total-amount nil="true"></total-amount>
    <description nil="true"></description>
    <document nil="true"></document>
    <observation nil="true"></observation>
    <remind type="boolean">false</remind>
    <reminded-at nil="true"></reminded-at>
    <income_tax_relevant type="boolean">false</income_tax_relevant>
    <category-id nil="true"></category-id>
    <classification-center-id nil="true"></classification-center-id>
    <expected-deposit-account-id nil="true"></expected-deposit-account-id>
    <recurrence-id nil="true"></recurrence-id>
    <person-id nil="true"></person-id>
    <created-at type="datetime">2011-08-19T13:33:02-03:00</created-at>
    <updated-at type="datetime">2011-08-19T13:33:02-03:00</updated-at>
    <recurrent type="boolean">false</recurrent>
    <parcelled type="boolean">false</parcelled>
    <recurrence-period nil="true" />
    <number-of-parcels nil="true" />
    <current-parcel nil="true" />
    <sale-account-id nil="true" />
    <sale-ids type="array">
    </sale-ids>
    <custom-classifications type="array">
      <custom-classification>
        <id type="integer">24</id>
        <custom-classifier-id type="integer">1</custom-classifier-id>
        <custom-classifier-name>Região</custom-classifier-name>
        <name>Sudeste</name>
        <value>Sudeste</value>
        <amount type="decimal">100.0</amount>
        <percentage type="decimal">100.0</percentage>
      </custom-classification>
    </custom-classifications>
    <classification-center-classifications type="array">
      <classification-center-classification>
        <id type="integer">27</id>
        <classification-center-id type="integer">1</classification-center-id>
        <name>Sudeste</name>
        <percentage type="decimal">100.0</percentage>
        <amount type="decimal">36.0</amount>
      </classification-center-classification>
    </classification-center-classifications>
    <financial-account-taxes-attributes type="array">
      <financial-account-taxes-attribute>
        <id type="integer">1</id>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </financial-account-taxes-attribute>
    </financial-account-taxes-attributes>
    <tax-charges type="array">
      <tax-charge>
        <id type="integer">1</id>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </tax-charge>
    </tax-charges>
    <reconciliations>
      <financial-transactions type="array">
      </financial-transactions>
      <financial-accounts type="array">
      </financial-accounts>
    </reconciliations>
    <links type="array">
      <link>
        <rel>self</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
        <method>get</method>
      </link>
      <link>
        <rel>destroy</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
        <method>delete</method>
      </link>
      <link>
        <rel>receive</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive</href>
        <method>put</method>
      </link>
    </links>
  </receivable-account>

Criar uma Conta a Receber Recorrente

POST /entities/:entity_id/receivable_accounts

Enviar os parâmetros para criação do objeto como XML ou JSON (conforme o formato escolhido) no corpo da requisição HTTP.

Em caso de sucesso, retorna 201 Created mais o caminho para o objeto criado no header Location, além dos dados do objeto criado. Os dados do objeto incluem a quantidade e a parcela atual, o tipo da recorrência e o link para a próxima (next) e a anterior (previous) Conta a Receber da recorrência. Em caso de erro, retorna 422 Unprocessable Entity e as mensagens de erro informando porque a conta a receber não pôde ser criada.

Opções para o campo "create_as_recurrent":

  • weekly (Semanal)
  • biweekly (Quinzenal)
  • monthly (Mensal)
  • bimonthly (Bimestral)
  • quarterly (Trimestral)
  • semiannual (Semestral)
  • annual (Anual)

Exemplo de Requisição

{
  "receivable_account": {
    "due_date": "2011-09-20",
    "occurred_at": null,
    "amount": "100.0",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "nominal_amount": null,
    "total_amount": null,
    "description": null,
    "document": null,
    "observation": null,
    "remind": false,
    "income_tax_relevant": false,
    "category_id": null,
    "classification_center_id": null,
    "person_id": null,
    "expected_deposit_account_id": null,
    "create_as_recurrent": "weekly",
    "tax_charges": [
      {
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ]
  }
}
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <due-date type="date">2011-09-20</due-date>
    <occurred-at nil="true"></occurred-at>
    <amount>100.0</amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <nominal-amount nil="true"></nominal-amount>
    <total-amount nil="true"></total-amount>
    <description nil="true"></description>
    <document nil="true"></document>
    <observation nil="true"></observation>
    <remind type="boolean">false</remind>
    <income_tax_relevant type="boolean">false</income_tax_relevant>
    <category-id nil="true"></category-id>
    <classification-center-id nil="true"></classification-center-id>
    <person-id nil="true"></person-id>
    <expected-deposit-account-id nil="true"></expected-deposit-account-id>
    <create-as-recurrent>weekly</create-as-recurrent>
    <tax-charges type="array">
      <tax-charge>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </tax-charge>
    </tax-charges>
  </receivable-account>

Exemplo de Resposta

HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/receivable_accounts/1
Content-Type: application/json; charset=utf-8
Date: Fri, 19 Aug 2011 16:33:02 GMT
{
  "receivable_account": {
    "id": 1,
    "entity_id": 1,
    "status": 1,
    "status_name": "unreceived",
    "due_date": "2011-09-20",
    "occurred_at": null,
    "amount": "100.0",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "total_amount": null,
    "description": null,
    "document": null,
    "observation": null,
    "remind": false,
    "reminded_at": null,
    "income_tax_relevant": false,
    "category_id": null,
    "classification_center_id": null,
    "expected_deposit_account_id": null,
    "recurrence_id": 19,
    "parcel": 1,
    "person_id": null,
    "created_at": "2011-08-19T13:36:29-03:00",
    "updated_at": "2011-08-19T13:36:29-03:00",
    "recurrent": true,
    "sale_account_id": null,
    "sale_ids": [],
    "financial_account_taxes_attributes": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ],
    "tax_charges": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ],
    "reconciliations": {
      "financial_transactions": [],
      "financial_accounts": []
    },
    "links": [
      {
        "rel": "self",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
        "method": "get"
      },
      {
        "rel": "destroy",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
        "method": "delete"
      },
      {
        "rel": "receive",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive",
        "method": "put"
      }
    ]
  }
}
HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/receivable_accounts/1
Content-Type: application/xml; charset=utf-8
Date: Fri, 19 Aug 2011 16:33:03 GMT
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <id type="integer">1</id>
    <entity-id type="integer">1</entity-id>
    <status type="integer">1</status>
    <status-name type="symbol">unreceived</status-name>
    <due-date type="date">2011-09-20</due-date>
    <occurred-at nil="true"></occurred-at>
    <amount type="decimal">100.0</amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <total-amount nil="true"></total-amount>
    <description nil="true"></description>
    <document nil="true"></document>
    <observation nil="true"></observation>
    <remind type="boolean">false</remind>
    <reminded-at nil="true"></reminded-at>
    <income_tax_relevant type="boolean">false</income_tax_relevant>
    <category-id nil="true"></category-id>
    <classification-center-id nil="true"></classification-center-id>
    <expected-deposit-account-id nil="true"></expected-deposit-account-id>
    <recurrence-id>19</recurrence-id>
    <parcel>1</parcel>
    <person-id nil="true"></person-id>
    <created-at type="datetime">2011-08-19T13:33:02-03:00</created-at>
    <updated-at type="datetime">2011-08-19T13:33:02-03:00</updated-at>
    <recurrent type="boolean">true</recurrent>
    <sale-account-id nil="true" />
    <sale-ids type="array">
    </sale-ids>
    <financial-account-taxes-attributes type="array">
      <financial-account-taxes-attribute>
        <id type="integer">1</id>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </financial-account-taxes-attribute>
    </financial-account-taxes-attributes>
    <tax-charges type="array">
      <tax-charge>
        <id type="integer">1</id>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </tax-charge>
    </tax-charges>
    <reconciliations>
      <financial-transactions type="array">
      </financial-transactions>
      <financial-accounts type="array">
      </financial-accounts>
    </reconciliations>
    <links type="array">
      <link>
        <rel>self</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
        <method>get</method>
      </link>
      <link>
        <rel>destroy</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
        <method>delete</method>
      </link>
      <link>
        <rel>receive</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive</href>
        <method>put</method>
      </link>
    </links>
  </receivable-account>

Criar uma Conta a Receber Parcelada

POST /entities/:entity_id/receivable_accounts

Enviar os parâmetros para criação do objeto como XML ou JSON (conforme o formato escolhido) no corpo da requisição HTTP.

Em caso de sucesso, retorna 201 Created mais o caminho para o objeto criado no header Location, além dos dados do objeto criado. Os dados do objeto incluem a quantidade e a parcela atual, o tipo da recorrência e o link para a próxima (next) e a anterior (previous) Conta a Receber do parcelamento. Em caso de erro, retorna 422 Unprocessable Entity e as mensagens de erro informando porque a conta a receber não pôde ser criada.

Opções para o campo "create_as_recurrent":

  • weekly (Semanal)
  • biweekly (Quinzenal)
  • monthly (Mensal)
  • bimonthly (Bimestral)
  • quarterly(Trimestral)
  • semiannual (Semestral)
  • annual (Anual)

Exemplo de Requisição

{
  "receivable_account": {
    "due_date": "2011-09-20",
    "occurred_at": null,
    "amount": "100.0",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "nominal_amount": null,
    "total_amount": null,
    "description": null,
    "document": null,
    "observation": null,
    "remind": false,
    "income_tax_relevant": false,
    "category_id": null,
    "classification_center_id": null,
    "person_id": null,
    "expected_deposit_account_id": null,
    "create_as_recurrent": "weekly",
    "number_of_parcels": 7,
    "tax_charges": [
      {
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ]
  }
}
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <due-date type="date">2011-09-20</due-date>
    <occurred-at nil="true"></occurred-at>
    <amount>100.0</amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <nominal-amount nil="true"></nominal-amount>
    <total-amount nil="true"></total-amount>
    <description nil="true"></description>
    <document nil="true"></document>
    <observation nil="true"></observation>
    <remind type="boolean">false</remind>
    <income_tax_relevant type="boolean">false</income_tax_relevant>
    <category-id nil="true"></category-id>
    <classification-center-id nil="true"></classification-center-id>
    <person-id nil="true"></person-id>
    <expected-deposit-account-id nil="true"></expected-deposit-account-id>
    <create-as-recurrent>weekly</create-as-recurrent>
    <number-of-parcels>7</number-of_parcels>
    <tax-charges type="array">
      <tax-charge>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </tax-charge>
    </tax-charges>
  </receivable-account>

Exemplo de Resposta

HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/receivable_accounts/1
Content-Type: application/json; charset=utf-8
Date: Fri, 19 Aug 2011 16:33:02 GMT
{
  "receivable_account": {
    "id": 1,
    "entity_id": 1,
    "status": 1,
    "status_name": "unreceived",
    "due_date": "2011-09-20",
    "occurred_at": null,
    "amount": "100.0",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "total_amount": null,
    "description": null,
    "document": null,
    "observation": null,
    "remind": false,
    "reminded_at": null,
    "income_tax_relevant": false,
    "category_id": null,
    "classification_center_id": null,
    "expected_deposit_account_id": null,
    "recurrence_id": 19,
    "parcel": 1,
    "person_id": null,
    "created_at": "2011-08-19T13:36:29-03:00",
    "updated_at": "2011-08-19T13:36:29-03:00",
    "recurrent": true,
    "sale_account_id": null,
    "sale_ids": [],
    "financial_account_taxes_attributes": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ],
    "tax_charges": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      }
    ],
    "reconciliations": {
      "financial_transactions": [],
      "financial_accounts": []
    },
    "links": [
      {
        "rel": "self",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
        "method": "get"
      },
      {
        "rel": "destroy",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1",
        "method": "delete"
      },
      {
        "rel": "receive",
        "href": "https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive",
        "method": "put"
      }
    ]
  }
}
HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/receivable_accounts/1
Content-Type: application/xml; charset=utf-8
Date: Fri, 19 Aug 2011 16:33:03 GMT
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <id type="integer">1</id>
    <entity-id type="integer">1</entity-id>
    <status type="integer">1</status>
    <status-name type="symbol">unreceived</status-name>
    <due-date type="date">2011-09-20</due-date>
    <occurred-at nil="true"></occurred-at>
    <amount type="decimal">100.0</amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <total-amount nil="true"></total-amount>
    <description nil="true"></description>
    <document nil="true"></document>
    <observation nil="true"></observation>
    <remind type="boolean">false</remind>
    <reminded-at nil="true"></reminded-at>
    <income_tax_relevant type="boolean">false</income_tax_relevant>
    <category-id nil="true"></category-id>
    <classification-center-id nil="true"></classification-center-id>
    <expected-deposit-account-id nil="true"></expected-deposit-account-id>
    <recurrence-id>19</recurrence-id>
    <parcel>1</parcel>
    <person-id nil="true"></person-id>
    <created-at type="datetime">2011-08-19T13:33:02-03:00</created-at>
    <updated-at type="datetime">2011-08-19T13:33:02-03:00</updated-at>
    <recurrent type="boolean">true</recurrent>
    <sale-account-id nil="true" />
    <sale-ids type="array">
    </sale-ids>
    <financial-account-taxes-attributes type="array">
      <financial-account-taxes-attribute>
        <id type="integer">1</id>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
      </financial-account-taxes-attribute>
    </financial-account-taxes-attributes>
    <tax-charges type="array">
      <tax-charge>
        <id type="integer">1</id>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
      </tax-charge>
    </tax-charges>
    <reconciliations>
      <financial-transactions type="array">
      </financial-transactions>
      <financial-accounts type="array">
      </financial-accounts>
    </reconciliations>
    <links type="array">
      <link>
        <rel>self</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
        <method>get</method>
      </link>
      <link>
        <rel>destroy</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1</href>
        <method>delete</method>
      </link>
      <link>
        <rel>receive</rel>
        <href>https://app.myfinance.com.br/entities/1/receivable_accounts/1/receive</href>
        <method>put</method>
      </link>
    </links>
  </receivable-account>

Alterar uma Conta a Receber

Requisição

PUT /entities/:entity_id/receivable_accounts/:id

Enviar os parâmetros para alteração do objeto como XML ou JSON (conforme o formato escolhido) no corpo da requisição HTTP.

Em caso de sucesso, retorna 200 OK e uma representação do objeto, como é mostrado no exemplo de resposta em "Exibir uma Conta a Receber". Em caso de erro, retorna 422 Unprocessable Entity e as mensagens de erro informando porque o objeto não pôde ser criado.

Exemplo de Requisição

{
  "receivable_account": {
    "due_date": "2011-09-20",
    "occurred_at": null,
    "amount": "100.0",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "nominal_amount": null,
    "total_amount": null,
    "description": null,
    "document": "827982719",
    "observation": "Papelaria",
    "remind": false,
    "income_tax_relevant": false,
    "category_id": null,
    "classification_center_id": null,
    "person_id": null,
    "expected_deposit_account_id": null,
    "create_as_recurrent": null,
    "tax_charges": [
      {
        "id": 1,
        "tax_id": 1,
        "amount": 12.0,
        "withholding": true
      },
      {
        "id": 2,
        "_destroy": "true"
      }
    ],
    "custom_classifications": [
      {
        "custom_classifier_id": 1,
        "name": "Sudeste"
        "amount": 100
      }
    ],
    "classification_center_classifications":[
      {
        classification_center_id: 1,
        name: "Sudeste",
        amount: "100.0"
      }
    ],
  }
}
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <due-date type="date">2011-09-20</due-date>
    <occurred-at nil="true"></occurred-at>
    <amount>100.0</amount>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <nominal-amount nil="true"></nominal-amount>
    <total-amount nil="true"></total-amount>
    <description nil="true"></description>
    <document>34839430</document>
    <observation>Papelaria</observation>
    <remind type="boolean">false</remind>
    <income_tax_relevant type="boolean">false</income_tax_relevant>
    <category-id nil="true"></category-id>
    <classification-center-id nil="true"></classification-center-id>
    <person-id nil="true"></person-id>
    <expected-deposit-account-id nil="true"></expected-deposit-account-id>
    <create-as-recurrent></create-as-recurrent>
    <tax-charges type="array">
      <tax-charge>
        <id type="integer">1</id>
        <tax-id type="integer">1</tax-id>
        <amount type="decimal">12.0</amount>
        <withholding type="boolean">true</withholding>
      </tax-charge>
      <tax-charge>
        <id type="integer">2</id>
        <_destroy type="boolean">12.0</_destroy>
      </tax-charge>
    </tax-charges>
    <custom-classifications type="array">
      <custom-classification>
        <custom-classifier-id type="integer">1</custom-classifier-id>
        <name type="string">Sudeste</name>
        <amount type="decimal>100</amount>
      </custom-classification>
    </custom-classifications-attributes>
    <classification-center-classifications type="array">
      <classification-center-classification>
        <id type="integer">27</id>
        <classification-center-id type="integer">1</classification-center-id>
        <name>Sudeste</name>
        <amount type="decimal">36.0</amount>
      </classification-center-classification>
    </classification-center-classifications>
  </receivable-account>

Criar/Alterar classificadores de uma Conta a Receber pelo nome

POST /entities/:entity_id/receivable_accounts
ou
PUT /entities/:entity_id/receivable_accounts/:id

Na criação/alteração de uma conta a receber ao invés de informar o atributo id do classificador (Category, ClassificationCenter, Person) é possível informar o atributo nome do mesmo. Caso já exista um classificador com o mesmo nome o existente será utilizado, caso o contrário, criará um novo classificador apartir do nome passado como parâmetro.

Exemplo de Requisição

{
  "receivable_account": {
    "amount": "100.0",
    "due_date": "2011-09-20",
    "description": null,
    "category_name": "Nova categoria",
    "classification_center_name": "Novo Centro de receita",
    "person_name": "Nova pessoa",
  }
}
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <amount>100.0</amount>
    <due-date type="date">2011-09-20</due-date>
    <description nil="true"></description>
    <category-name>Nova Categoria</category-name>
    <classification-center-name>Novo centro de receita</classification-center-name>
    <person-name>Nova pessoa</person-name>
  </receivable-account>

Receber uma Conta a Receber

Requisição

PUT /entities/:entity_id/receivable_accounts/:id/receive

Enviar os parâmetros para recebimento da conta como XML ou JSON (conforme o formato escolhido) no corpo da requisição HTTP.

Não é possível fazer um recebimento que tenha uma cobrança vinculada, o serviço que faz a cobrança avisará o Myfinance que precisa desfazer o recebimento, então será feito pelo Myfinance.

Em caso de sucesso, retorna 200 OK e uma representação do objeto, como é mostrado no exemplo de resposta em "Exibir uma Conta a Receber". Em caso de erro, retorna 422 Unprocessable Entity e as mensagens de erro informando porque a conta não pôde ser recebida.

Exemplo de Requisição

{
  "receivable_account": {
    "occurred_at": "2011-08-19",
    "ticket_amount": null,
    "interest_amount": null,
    "discount_amount": null,
    "nominal_amount": null,
    "amount": "100.0",
    "total_amount": "100.0",
    "attachment_id_list": [19, 42]
  }
}
<?xml version="1.0" encoding="UTF-8"?>
  <receivable-account>
    <occurred-at type="date">2011-09-20</occurred-at>
    <ticket-amount nil="true"></ticket-amount>
    <interest-amount nil="true"></interest-amount>
    <discount-amount nil="true"></discount-amount>
    <nominal-amount nil="true"></nominal-amount>
    <total-amount>100.0</total-amount>
    <amount>100.0</amount>
    <attachment_id_list type="array">
      <fixnum type="integer">19</fixnum>
      <fixnum type="integer">42</fixnum>
    </attachment_id_list>
  </receivable-account>

Desfazer o recebimento de uma Conta a Receber já recebida

Requisição

PUT /entities/:entity_id/receivable_accounts/:id/undo_receivement

Não é possível desfazer um recebimento que tenha uma cobrança vinculada, o serviço que faz a cobrança avisará o Myfinance que precisa desfazer o recebimento, então será feito pelo Myfinance.

Retorna 200 OK e uma representação do objeto, como é mostrado no exemplo de resposta em "Exibir uma Conta a Receber". Em caso de erro, retorna 422 Unprocessable Entity e as mensagens de erro informando porque a conta não pôde desfazer o recebimento.

Apagar uma Conta a Receber

Exemplo de Requisição

DELETE /entities/:entity_id/receivable_accounts/:id

Retorna 200 OK.

Se existir uma Cobrança associada é preciso passar o force_destroy = true.

Apagar uma Conta a Receber Recorrente e terminar a recorrência

Exemplo de Requisição

DELETE /entities/:entity_id/receivable_accounts/:id/recurrence

Retorna 200 OK.

Apagar várias Contas a Receber

DELETE /entities/:entity_id/receivable_accounts?selected_ids=:id1,:id2,:id3

Apaga todas as contas a receber especificadas. Retorna 200 OK.

Se existir uma Cobrança associada é preciso passar o force_destroy = true.

Criar um Boleto

POST /entities/:entity_id/receivable_accounts/:id/bank_slips

Para criar um boleto será necessário ter uma integração com o Cobrato previamente configurada na aplicação.

Em caso de sucesso, retorna 201 Created mais o caminho para o objeto criado no header Location, além dos dados do objeto criado. Em caso de erro, retorna 422 Unprocessable Entity e as mensagens de erro informando porque o objeto não pôde ser criado.

Exemplo de Requisição

{
  "bank_slip_configuration_id": 2,
  "agency_acquirer_account": "1234-12 / 0001",
  "bank_slip_creator": {
    "acquirer_name": "João da Silva",
    "acquirer_federation_subscription_number": "111.111.111-11",
    "amount": "1000.0",
    "due_date": "15/01/2013",
    "document_date": "15/01/2013",
    "process_date": "15/01/2013",
    "document": "DOC1234",
    "agreement_registry": "109",
    "currency": "R$",
    "accept": "S",
    "quantity": "1",
    "issuer_name": "José Almeida",
    "issuer_emails": "jose@email.com, financeiro@email.com",
    "issuer_address": "Rua sem saída, nº X",
    "issuer_complement": "",
    "issuer_city": "Rio de Janeiro",
    "issuer_state": "RJ",
    "issuer_zip_code": "11111-111",
    "instruction1": "Receber somente antes da data de vencimento",
    "instruction2": "Receber somente valor integral",
    "instruction3": "",
    "instruction4": "",
    "demostrative1": "",
    "demostrative2": "",
    "demostrative3": ""
  }
}
<?xml version="1.0" encoding="UTF-8"?>
  <bank_slip_configuration_id>2</bank_slip_configuration_id>,
  <agency_acquirer_account>1234-12 / 0001</agency_acquirer_account>
  <banks_slip_creator>
    <acquirer_name>João da Silva</acquirer_name>
    <acquirer_federation_subscription_number>111.111.111-11</acquirer_federation_subscription_number>
    <amount>1000.0</amount>
    <due_date>15/01/2013</due_date>
    <document_date>15/01/2013</document_date>
    <process_date>15/01/2013</process_date>
    <document>DOC1234</document>
    <agreement_registry>109</agreement_registry>
    <currency>R$</currency>
    <accept>S</accept>
    <quantity>1</quantity>
    <issuer_name>José Almeida</issuer_name>
    <issuer_emails>jose@email.com, financeiro@email.com</issuer_emails>
    <issuer_address>Rua sem saída, nº X</issuer_address>
    <issuer_complement></issuer_complement>
    <issuer_city>Rio de Janeiro</issuer_city>
    <issuer_state>RJ</issuer_state>
    <issuer_zip_code>11111-111</issuer_zip_code>
    <instruction1>Receber somente antes da data de vencimento</instruction1>
    <instruction2>Receber somente valor integral</instruction2>
    <instruction3></instruction3>
    <instruction4></instruction4>
    <demostrative1></demostrative1>
    <demostrative2></demostrative2>
    <demostrative3></demostrative3>
  </bank_slip_creator>
</xml>

Onde:

  • bank_slip_configuration_id é o id da Conta de cobrança;
  • agency_acquirer_account é a Conta corrente e a agência, separados por uma /

Exemplo de Resposta

HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/attachments/2
Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": 2,
    "entity_id": 1,
    "title": "Boleto gerado via Minhas Finanças - Itaú Ag 1111-11 Cc 111-11 Carteira 109",
    "attachment_file_name": "20130115-7089-1xv95t7.html",
    "attachment_content_type": "text/html",
    "attachment_file_size": 99750,
    "created_at": "2013-01-15T11:26:44-02:00",
    "updated_at": "2013-01-15T11:26:44-02:00",
    "download_url": "http://localhost:3000/entities/1/attachments/2/download",
    "links": [
      {
        "rel": "self",
        "href": "http://localhost:3000/entities/1/attachments/2",
        "method": "get"
      },
      {
        "rel": "download",
        "href": "http://localhost:3000/entities/1/attachments/2/download",
        "method": "get"
      }
    ]
  }
}
HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/attachments/2
Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
  <attachment>
    <id>2</id>
    <entity_id>1</entity_id>
    <title>Boleto gerado via Minhas Finanças - Itaú Ag 1111-11 Cc 111-11 Carteira 109</title>
    <attachment_file_name>20130115-7089-1xv95t7.html</attachment_file_name>
    <attachment_content_type>text/html</attachment_content_type>
    <attachment_file_size>99750</attachment_file_size>
    <created_at>2013-01-15T11:26:44-02:00</created_at>
    <updated_at>2013-01-15T11:26:44-02:00</updated_at>
    <download_url>http://localhost:3000/entities/1/attachments/2/download</download_url>
    <links type="array">
      <link>
        <rel>self</rel>
        <href>http://localhost:3000/entities/1/attachments/2</href>
        <method>get</method>
      </link>
      <link>
        <rel>download</rel>
        <href>http://localhost:3000/entities/1/attachments/2/download</href>
        <method>get</method>
      </link>
    </links>
  </attachment>
</xml>