balanced / balanced-api

Balanced API specification.
220 stars 72 forks source link

"/customers/{:customer_id}/orders" returns the entire orders in the marketplace #739

Open kyungmin opened 9 years ago

kyungmin commented 9 years ago

/customers/{:customer_id}/orders should only return the orders that belong to this customer. This could be further broken down based on whether the customer is a merchant or not.

mjallday commented 9 years ago

confirmed, here's an example

curl https://api.balancedpayments.com/customers/CU2uvjkAym0FLvDJtVhpWFWR/orders -u ak-test-1xGEmbY58peQpnsgKEpgjuXgR1TjYdGpj:

{
  "meta": {
    "last": "/customers/CU2uvjkAym0FLvDJtVhpWFWR/orders?limit=10&offset=0",
    "next": null,
    "href": "/customers/CU2uvjkAym0FLvDJtVhpWFWR/orders?limit=10&offset=0",
    "limit": 10,
    "offset": 0,
    "previous": null,
    "total": 3,
    "first": "/customers/CU2uvjkAym0FLvDJtVhpWFWR/orders?limit=10&offset=0"
  },
  "orders": [
    {
      "delivery_address": {
        "city": null,
        "line2": null,
        "line1": null,
        "state": null,
        "postal_code": null,
        "country_code": null
      },
      "description": null,
      "links": {
        "merchant": "CU2uvjkAym0FLvDJtVhpWFWR"
      },
      "href": "/orders/OR2JQOzm14HXcYjTt4LSCf53",
      "created_at": "2015-01-23T18:29:29.317112Z",
      "updated_at": "2015-01-23T18:29:29.317113Z",
      "id": "OR2JQOzm14HXcYjTt4LSCf53",
      "currency": "USD",
      "amount": 0,
      "meta": {},
      "amount_escrowed": 0
    },
    {
      "delivery_address": {
        "city": null,
        "line2": null,
        "line1": null,
        "state": null,
        "postal_code": null,
        "country_code": null
      },
      "description": "New description for order",
      "links": {
        "merchant": "CUuKoL77fBHdpNEp8yc5gln"
      },
      "href": "/orders/OR168Jo07ajan4WNrZGK1zaM",
      "created_at": "2015-01-12T22:44:02.169777Z",
      "updated_at": "2015-01-12T22:44:05.987271Z",
      "id": "OR168Jo07ajan4WNrZGK1zaM",
      "currency": "USD",
      "amount": 0,
      "meta": {
        "product.id": "1234567890",
        "anykey": "valuegoeshere"
      },
      "amount_escrowed": 0
    },
    {
      "delivery_address": {
        "city": null,
        "line2": null,
        "line1": null,
        "state": null,
        "postal_code": null,
        "country_code": null
      },
      "description": "Order #12341234",
      "links": {
        "merchant": "CU6T8PWyIPpBnKRDaCzjzs3u"
      },
      "href": "/orders/OR6WOo9lApIMupmo5s4xoGhL",
      "created_at": "2015-01-12T22:42:15.130038Z",
      "updated_at": "2015-01-12T22:42:15.130039Z",
      "id": "OR6WOo9lApIMupmo5s4xoGhL",
      "currency": "USD",
      "amount": 50520000,
      "meta": {},
      "amount_escrowed": 50514000
    }
  ],
  "links": {
    "orders.merchant": "/customers/{orders.merchant}",
    "orders.reversals": "/orders/{orders.id}/reversals",
    "orders.debits": "/orders/{orders.id}/debits",
    "orders.credits": "/orders/{orders.id}/credits",
    "orders.events": "/orders/{orders.id}/events",
    "orders.refunds": "/orders/{orders.id}/refunds",
    "orders.buyers": "/orders/{orders.id}/buyers"
  }
}