balanced / balanced-api

Balanced API specification.
221 stars 72 forks source link

Transactions endpoint giving incorrect counts in rev1 #523

Closed mjallday closed 10 years ago

mjallday commented 10 years ago

curl 'https://api.balancedpayments.com/transactions' -H 'Authorization: Basic YWstdGVzdC1aeFpCcU9Takw1RnNPWHVYM3Rvdk5VRlR4WHZCMkxmMzo='

{
  "meta": {
    "last": "/transactions?limit=10&offset=0",
    "next": null,
    "href": "/transactions?limit=10&offset=0",
    "limit": 10,
    "offset": 0,
    "previous": null,
    "counts": {
      "refund": 0,
      "customer": 0,
      "card_hold": 0,
      "credit": 0,
      "card": 0,
      "debit": 9,
      "order": 0,
      "bank_account": 0
    },
    "total": 9,
    "first": "/transactions?limit=10&offset=0"
  },

-vs-

curl 'https://api.balancedpayments.com/v1/transactions' -H 'Authorization: Basic YWstdGVzdC1aeFpCcU9Takw1RnNPWHVYM3Rvdk5VRlR4WHZCMkxmMzo='

{
  "limit": 10,
  "offset": 0,
  "counts": {
    "refund": 4,
    "account": 5,
    "credit": 29,
    "bank_account": 6,
    "debit": 10,
    "hold": 4,
    "order": 0,
    "card": 3
  },
  "total": 47,
  "next_uri": "/v1/transactions?limit=10&offset=10",
  "last_uri": "/v1/transactions?limit=10&offset=40"
}

Results are also incorrect, not just the counts. Originally reported https://github.com/balanced/balanced-dashboard/issues/1011#issuecomment-36598154

mjallday commented 10 years ago

This has been resolved.

curl 'https://api.balancedpayments.com/transactions' -H 'Authorization: Basic YWstdGVzdC1aeFpCcU9Takw1RnNPWHVYM3Rvdk5VRlR4WHZCMkxmMzo='

{
  "meta": {
    "last": "/transactions?limit=10&offset=50",
    "next": "/transactions?limit=10&offset=10",
    "href": "/transactions?limit=10&offset=0",
    "limit": 10,
    "offset": 0,
    "previous": null,
    "counts": {
      "refund": 6,
      "customer": 0,
      "card_hold": 6,
      "credit": 29,
      "card": 0,
      "debit": 15,
      "order": 0,
      "bank_account": 0
    },
    "total": 56,
    "first": "/transactions?limit=10&offset=0"
  },
  "links": {
    "debits.customer": "/customers/{debits.customer}",
    "debits.dispute": "/disputes/{debits.dispute}",
    "debits.events": "/debits/{debits.id}/events",
    "refunds.events": "/refunds/{refunds.id}/events",
    "card_holds.debits": "/card_holds/{card_holds.id}/debits",
    "refunds.dispute": "/disputes/{refunds.dispute}",
    "refunds.debit": "/debits/{refunds.debit}",
    "card_holds.card": "/cards/{card_holds.card}",
    "card_holds.debit": "/debits/{card_holds.debit}",
    "card_holds.events": "/card_holds/{card_holds.id}/events",
    "debits.order": "/orders/{debits.order}",
    "debits.refunds": "/debits/{debits.id}/refunds",
    "refunds.order": "/orders/{refunds.order}",
    "debits.source": "/resources/{debits.source}"
  },
...
}