balanced / balanced-api

Balanced API specification.
221 stars 72 forks source link

Holds don't show that they are associated to an order #692

Closed rserna2010 closed 9 years ago

rserna2010 commented 10 years ago

EG

curl https://api.balancedpayments.com/cards/CC6ob6OmQVrygRtPoPtdh1te/card_holds \
      -H "Accept: application/vnd.api+json;revision=1.1" \
      -u ak-test-1o9QKwUCrwstHWO5sGxICtIJdQXFTjnrV: \
      -d "amount=5000" \
      -d "order=/orders/OR61dtJapcRfxgLuQH44xEPe"

returns:

{
  "card_holds": [
    {
      "status": "succeeded",
      "description": null,
      "links": {
        "card": "CC6ob6OmQVrygRtPoPtdh1te",
        "debit": null
      },
      "updated_at": "2014-09-16T21:32:41.799481Z",
      "created_at": "2014-09-16T21:32:41.632516Z",
      "transaction_number": "HLJHH-HVE-6E6J",
      "expires_at": "2014-09-23T21:32:41.768514Z",
      "failure_reason": null,
      "currency": "USD",
      "amount": 5000,
      "meta": {},
      "href": "/card_holds/HL7HCHaDpd6BoomwBvwgkDhC",
      "failure_reason_code": null,
      "voided_at": null,
      "id": "HL7HCHaDpd6BoomwBvwgkDhC"
    }
  ],
  "links": {
    "card_holds.events": "/card_holds/{card_holds.id}/events",
    "card_holds.card": "/cards/{card_holds.card}",
    "card_holds.debits": "/card_holds/{card_holds.id}/debits",
    "card_holds.debit": "/debits/{card_holds.debit}"
  }

Once you capture the hold, the debit does show the appropriate order

remear commented 9 years ago

Seems resolved. The CardHold response contains an order link.

curl https://api.balancedpayments.com/cards/CC6ob6OmQVrygRtPoPtdh1te/card_holds \
      -H "Accept: application/vnd.api+json;revision=1.1" \
      -u ak-test-1o9QKwUCrwstHWO5sGxICtIJdQXFTjnrV: \
      -d "amount=5000" \
      -d "order=/orders/OR61dtJapcRfxgLuQH44xEPe"
{
  "card_holds": [
    {
      "status": "succeeded",
      "description": null,
      "links": {
        "order": "OR61dtJapcRfxgLuQH44xEPe",
        "card": "CC6ob6OmQVrygRtPoPtdh1te",
        "debit": null
      },
      "updated_at": "2015-01-06T22:03:42.736557Z",
      "created_at": "2015-01-06T22:03:42.353606Z",
      "transaction_number": "HLZ68-7SR-3DWZ",
      "expires_at": "2015-01-13T22:03:42.627615Z",
      "failure_reason": null,
      "currency": "USD",
      "amount": 5000,
      "meta": {},
      "href": "/card_holds/HL4dK1yNCiaYlqbNQfmw3Jss",
      "failure_reason_code": null,
      "voided_at": null,
      "id": "HL4dK1yNCiaYlqbNQfmw3Jss"
    }
  ],
  "links": {
    "card_holds.events": "/card_holds/{card_holds.id}/events",
    "card_holds.order": "/orders/{card_holds.order}",
    "card_holds.card": "/cards/{card_holds.card}",
    "card_holds.debits": "/card_holds/{card_holds.id}/debits",
    "card_holds.debit": "/debits/{card_holds.debit}"
  }
}