Transação de Cartão de Crédito (CreditCardTransaction)

Listar Transações de um Cartões de Crédito

GET /entities/:entity_id/credit_cards/:credit_card_id/invoices/:year-month

Retorna uma lista (paginada) de todas as Transações de Cartão de Crédito do CreditCard 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/credit_cards/:credit_card_id/invoices/:year-month?per_page=15&page=3

O endpoint acima irá retornar a terceira página da listagem de Transações de Cartão de Crédito com 15 registros em cada.

Exemplo de Resposta

HTTP/1.1 200 OK
Date: Fri, 03 May 2013 20:00:02 GMT
Content-Type: application/json; charset=utf-8
Links: <http://app.myfinance.com.br/entities/1/credit_cards/1/invoice/2013-04.json?page=1>;rel="first",
       <http://app.myfinance.com.br/entities/1/credit_cards/1/invoice/2013-04.json?page=3>;rel="last",
       <http://app.myfinance.com.br/entities/1/credit_cards/1/invoice/2013-04.json?page=3>;rel="next",
       <http://app.myfinance.com.br/entities/1/credit_cards/1/invoice/2013-04.json?page=1>;rel="prev"
[
  {
    "credit_card_transaction": {
      "id": 1,
      "amount": 199.99,
      "occurred_at": "2013-04-20",
      "document": null,
      "observation": null,
      "description": null,
      "classification_center_id": null,
      "category_id": null,
      "person_id": null,
      "credit_card_id": 1,
      "credit_card_invoice_id": 1,
      "parcels": 5,
      "parcel": 3,
      "links": [
        {
          "rel": "self",
          "href": "https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1",
          "method": "get"
        }
      ]
    }
  },
  {
    "credit_card_transaction": {
      "id": 2,
      "amount": 85.60,
      "occurred_at": "2013-04-18",
      "document": null,
      "observation": null,
      "description": null,
      "classification_center_id": null,
      "category_id": null,
      "person_id": null,
      "credit_card_id": 1,
      "credit_card_invoice_id": 1,
      "parcels": null,
      "parcel": null,
      "links": [
        {
          "rel": "self",
          "href": "https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/2",
          "method": "get"
        }
      ]
    }
  }
]
HTTP/1.1 200 OK
Date: Fri, 03 May 2013 20:00:02 GMT
Content-Type: application/xml; charset=utf-8
Links: <http://app.myfinance.com.br/entities/1/credit_cards/1/invoice/2013-04.XML?page=1>;rel="first",
       <http://app.myfinance.com.br/entities/1/credit_cards/1/invoice/2013-04.XML?page=3>;rel="last",
       <http://app.myfinance.com.br/entities/1/credit_cards/1/invoice/2013-04.XML?page=3>;rel="next",
       <http://app.myfinance.com.br/entities/1/credit_cards/1/invoice/2013-04.XML?page=1>;rel="prev"
<?xml version="1.0" encoding="UTF-8"?>
  <credit-card-transactions>
    <credit-card-transaction>
      <id type="integer">1</id>
      <amount type="decimal">199.99</amount>
      <occurred-at>2013-04-20</occurred-at>
      <document nil="true" />
      <observation nil="true" />
      <description nil="true" />
      <classification-center_id nil="true" />
      <category-id nil="true" />
      <person-id nil="true" />
      <credit-card-id type="integer">1</credit-card-id>
      <credit-card-invoice-id type="integer">1</credit-card-invoice-id>
      <parcels type="integer">5</parcels>
      <parcel type="integer">3</parcel>
      <links type="array">
        <link>
          <rel>self</rel>
          <href>https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1</href>
          <method>get</method>
        <link>
      </links>
    </credit-card-transaction>
    <credit-card-transaction>
      <id type="integer">2</id>
      <amount type="decimal">85.60</amount>
      <occurred-at>2013-04-18</occurred-at>
      <document nil="true" />
      <observation nil="true" />
      <description nil="true" />
      <classification-center_id nil="true" />
      <category-id nil="true" />
      <person-id nil="true" />
      <credit-card-id type="integer">1</credit-card-id>
      <credit-card-invoice-id type="integer">1</credit-card-invoice-id>
      <parcels nil="true" />
      <parcel nil="true" />
      <links type="array">
        <link>
          <rel>self</rel>
          <href>https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/2</href>
          <method>get</method>
        <link>
      </links>
    </credit-card-transaction>
  </credit-card-transactions>

Exibir um Cartão de Crédito

GET /entities/:entity_id/credit_cards/:credit_card_id/transactions/:id

Retorna 200 OK e os dados da transação do cartão de crédito solicitado.

Exemplo de Resposta

HTTP/1.1 200 OK
Date: Mon, 26 Apr 2013 20:00:02 GMT
Content-Type: application/json; charset=utf-8
{
  "credit_card_transaction": {
    "id": 1,
    "amount": 199.99,
    "occurred_at": "2013-04-20",
    "document": null,
    "observation": null,
    "description": null,
    "classification_center_id": null,
    "category_id": null,
    "person_id": null,
    "credit_card_id": 1,
    "credit_card_invoice_id": 1,
    "parcels": 5,
    "parcel": 3,
    "links": [
      {
        "rel": "self",
        "href": "https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1",
        "method": "get"
      }
    ]
  }
}
HTTP/1.1 200 OK
Date: Mon, 26 Apr 2013 20:00:02 GMT
Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
  <credit-card-transaction>
    <id type="integer">1</id>
    <amount type="decimal">199.99</amount>
    <occurred-at>2013-04-20</occurred-at>
    <document nil="true" />
    <observation nil="true" />
    <description nil="true" />
    <classification-center_id nil="true" />
    <category-id nil="true" />
    <person-id nil="true" />
    <credit-card-id type="integer">1</credit-card-id>
    <credit-card-invoice-id type="integer">1</credit-card-invoice-id>
    <parcels type="integer">5</parcels>
    <parcel type="integer">3</parcel>
    <links type="array">
      <link>
        <rel>self</rel>
        <href>https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1</href>
        <method>get</method>
      <link>
    </links>
  </credit-card-transaction>

Criar uma Transação de Cartão de Crédito

POST /entities/:entity_id/credit_cards/:credit_card_id/transactions

Cria uma nova transação no cartão de crédito com os parâmetros passados. Em caso de sucesso, retorna 201 Created, juntamente com a URI da transação criada no cabeçalho Location da resposta HTTP. Em caso de falha, retorna 422 Unprocessable entity juntamente com a descrição dos erros.

Exemplo de Requisição

{
  "credit_card_transaction": {
    "amount": 199.99,
    "occurred_at": "2013-04-20",
    "document": null,
    "observation": null,
    "description": null,
    "classification_center_id": null,
    "category_id": null,
    "person_id": null,
    "custom_classifications": [
      {
        "custom_classifier_id": 1,
        "name": "Sudeste",
        "amount": 199.99,
        "percentage": 100
      }
    ]
  }
}
<credit-card-transaction>
  <amount type="decimal">199.99</amount>
  <occurred-at>2013-04-20</occurred-at>
  <document nil="true" />
  <observation nil="true" />
  <description nil="true" />
  <classification_center_id nil="true" />
  <category_id nil="true" />
  <person_id nil="true" />
  <custom-classifications type="array">
    <custom-classification>
      <custom-classifier-id type="integer">1</custom-classifier-id>
      <name type="string">Sudeste</name>
    </custom-classification>
  </custom-classifications-attributes>
</credit-card-transaction>

Exemplo de Resposta

HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/credit_cards/1/transactions
Content-Type: application/json; charset=utf-8
Date: Wed, 26 Jan 2011 13:27:00 GMT
{
  "credit_card_transaction": {
    "id": 1,
    "amount": 199.99,
    "occurred_at": "2013-04-20",
    "document": null,
    "observation": null,
    "description": null,
    "classification_center_id": null,
    "category_id": null,
    "person_id": null,
    "custom_classifications": [
      {
        "id": 27,
        "custom_classifier_id": 1,
        "custom_classifier_name": "Região",
        "value": "Sudeste", # DEPRECATED
        "name": "Sudeste",
        "amount": 199.99,
        "percentage": 100
      }
    ],
    "credit_card_id": 1,
    "credit_card_invoice_id": 1,
    "parcels": 5,
    "parcel": 3,
    "links": [
      {
        "rel": "self",
        "href": "https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1",
        "method": "get"
      }
    ]
  }
}
HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/credit_cards/1/transactions
Content-Type: application/xml; charset=utf-8
Date: Wed, 26 Jan 2011 13:27:00 GMT
<?xml version="1.0" encoding="UTF-8"?>
<credit-card-transaction>
  <id type="integer">1</id>
  <amount type="decimal">199.99</amount>
  <occurred-at>2013-04-20</occurred-at>
  <document nil="true" />
  <observation nil="true" />
  <description nil="true" />
  <classification-center_id nil="true" />
  <category-id nil="true" />
  <person-id nil="true" />
  <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">199.99</amount>
      <percentage type="decimal">100</percentage>
    </custom-classification>
  </custom-classifications>
  <credit-card-id type="integer">1</credit-card-id>
  <credit-card-invoice-id type="integer">1</credit-card-invoice-id>
  <parcels type="integer">5</parcels>
  <parcel type="integer">3</parcel>
  <links type="array">
    <link>
      <rel>self</rel>
      <href>https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1</href>
      <method>get</method>
    <link>
  </links>
</credit-card-transaction>

Criar uma Transação de Cartão de Crédito Parcelada

POST /entities/:entity_id/credit_cards/:credit_card_id/transactions

Para criar uma nova transação no cartão de crédito parcelada, basta informar o parâmetro number_of_parcels com a quantidade de parcelas desejada. Em caso de sucesso, retorna 201 Created, juntamente com a URI da transação criada no cabeçalho Location da resposta HTTP e o link para as próximas transações do parcelamento. Em caso de falha, retorna 422 Unprocessable entity juntamente com a descrição dos erros.

Exemplo de Requisição

{
  "credit_card_transaction": {
    "amount": 199.99,
    "occurred_at": "2013-04-20",
    "document": null,
    "observation": null,
    "description": null,
    "classification_center_id": null,
    "category_id": null,
    "person_id": null,
    "number_of_parcels": 5
  }
}
<credit-card-transaction>
  <amount type="decimal">199.99</amount>
  <occurred-at>2013-04-20</occurred-at>
  <document nil="true" />
  <observation nil="true" />
  <description nil="true" />
  <classification_center_id nil="true" />
  <category_id nil="true" />
  <person_id nil="true" />
  <number-of-parcels type="integer">5</number-of-parcels>
</credit-card-transaction>

Exemplo de Resposta

HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/credit_cards/1/transactions
Content-Type: application/json; charset=utf-8
Date: Wed, 26 Jan 2011 13:27:00 GMT
{
  "credit_card_transaction": {
    "id": 1,
    "amount": 199.99,
    "occurred_at": "2013-04-20",
    "document": null,
    "observation": null,
    "description": null,
    "classification_center_id": null,
    "category_id": null,
    "person_id": null,
    "credit_card_id": 1,
    "credit_card_invoice_id": 1,
    "parcels": 5,
    "parcel": 3,
    "links": [
      {
        "rel": "self",
        "href": "https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1",
        "method": "get"
      },
      {
        "rel": "next",
        "href": "https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/2",
        "method": "get"
      }
    ]
  }
}
HTTP/1.1 201 Created
Location: https://app.myfinance.com.br/entities/1/credit_cards/1/transactions
Content-Type: application/xml; charset=utf-8
Date: Wed, 26 Jan 2011 13:27:00 GMT
<?xml version="1.0" encoding="UTF-8"?>
<credit-card-transaction>
  <id type="integer">1</id>
  <amount type="decimal">199.99</amount>
  <occurred-at>2013-04-20</occurred-at>
  <document nil="true" />
  <observation nil="true" />
  <description nil="true" />
  <classification-center_id nil="true" />
  <category-id nil="true" />
  <person-id nil="true" />
  <credit-card-id type="integer">1</credit-card-id>
  <credit-card-invoice-id type="integer">1</credit-card-invoice-id>
  <parcels type="integer">5</parcels>
  <parcel type="integer">3</parcel>
  <links type="array">
    <link>
      <rel>self</rel>
      <href>https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1</href>
      <method>get</method>
    <link>
    <link>
      <rel>next</rel>
      <href>https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/2</href>
      <method>get</method>
    <link>
  </links>
</credit-card-transaction>

Atualizar uma Transação de Cartão de Crédito

PUT /entities/:entity_id/credit_cards/:credit_card_id/transactions/:id

Atualiza uma transação no cartão de crédito com os parâmetros passados. Em caso de sucesso, retorna 200 OK, juntamente com a URI da transação atualizada no cabeçalho Location da resposta HTTP. Em caso de falha, retorna 422 Unprocessable entity juntamente com a descrição dos erros.

Exemplo de Requisição

{
  "credit_card_transaction": {
    "id": 1,
    "amount": 199.99,
    "occurred_at": "2013-04-20",
    "document": null,
    "observation": null,
    "description": null,
    "classification_center_id": null,
    "category_id": null,
    "person_id": null
  }
}
<credit-card-transaction>
  <id type="integer">1</id>
  <amount type="decimal">199.99</amount>
  <occurred-at>2013-04-20</occurred-at>
  <document nil="true" />
  <observation nil="true" />
  <description nil="true" />
  <classification_center_id nil="true" />
  <category_id nil="true" />
  <person_id nil="true" />
</credit-card-transaction>

Exemplo de Resposta

HTTP/1.1 200 OK
Location: https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1
Content-Type: application/json; charset=utf-8
Date: Wed, 26 Jan 2011 13:27:00 GMT
{
  "credit_card_transaction": {
    "id": 1,
    "amount": 199.99,
    "occurred_at": "2013-04-20",
    "document": null,
    "observation": null,
    "description": null,
    "classification_center_id": null,
    "category_id": null,
    "person_id": null,
    "credit_card_id": 1,
    "credit_card_invoice_id": 1,
    "parcels": 5,
    "parcel": 3,
    "links": [
      {
        "rel": "self",
        "href": "https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1",
        "method": "get"
      }
    ]
  }
}
HTTP/1.1 200 OK
Location: https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1
Content-Type: application/xml; charset=utf-8
Date: Wed, 26 Jan 2011 13:27:00 GMT
<?xml version="1.0" encoding="UTF-8"?>
<credit-card-transaction>
  <id type="integer">1</id>
  <amount type="decimal">199.99</amount>
  <occurred-at>2013-04-20</occurred-at>
  <document nil="true" />
  <observation nil="true" />
  <description nil="true" />
  <classification-center_id nil="true" />
  <category-id nil="true" />
  <person-id nil="true" />
  <credit-card-id type="integer">1</credit-card-id>
  <credit-card-invoice-id type="integer">1</credit-card-invoice-id>
  <parcels type="integer">5</parcels>
  <parcel type="integer">3</parcel>
  <links type="array">
    <link>
      <rel>self</rel>
      <href>https://app.myfinance.com.br/entities/1/credit_cards/1/transactions/1</href>
      <method>get</method>
    <link>
  </links>
</credit-card-transaction>

Apagar uma Transação de Cartão de Crédito

Exemplo de Requisição

DELETE /entities/:entity_id/credit_cards/:credit_card_id/transactions/:id

Apaga a transação de cartão de crédito especificado, retornando uma resposta vazia com status 200 OK.

Apagar uma Transação de Cartão de Crédito Parcelada e as Parcelas não-pagas

Exemplo de Requisição

DELETE /entities/:entity_id/credit_cards/:credit_card_id/transactions/:id/recurrence

Apaga a transação de cartão de crédito parcelada especificada e as parcelas relacionadas em faturas não-pagas/não-recebidas, retornando uma resposta vazia com status 200 OK.