Skip to content

Non-reference-able entities #436

Open
@mjallday

Description

@mjallday

Rev1 does not nest resources. Balanced, allows you to create credits to one-time-use funding instruments by passing the funding instrument details directly in the body of a credit request. Since you're not tokenizing the funding instrument, there is no addressable resource created (e.g. you cannot issue a GET /bank_accounts/BA123 since the resource only existed for this single credit, it is not a separate resource. This causes an issue when there's a non-addressable resource such as an inlined bank account.

e.g.

GET /credits/CR123

{
  "credits": [
    {
      "status": "succeeded",
      "description": "Withdrawal from foo.com",
      "links": {
        "customer": "CU123",
        "destination": "BA123",
        "order": null
      },
      "href": "/credits/CR123",
      "appears_on_statement_as": "BAL*FOO.",
      "id": "CR123"
    }
  ],
  "links": {
    "credits.order": "/orders/{credits.order}",
    "credits.customer": "/customers/{credits.customer}",
    "credits.destination": "/resources/{credits.destination}",
    "credits.reversals": "/credits/{credits.id}/reversals",
    "credits.events": "/credits/{credits.id}/events"
  }
}

Now let's try and get the destination: GET /resources/BA123 gives you a 404 since the bank account is not addressable. The question becomes: "How do I view the bank account details?"

@steveklabnik suggested inlining the funding instrument similar to how revision 1.0 works e.g.

{
  "credits": [
    {
      ...
      "bank_account": {

      },
      ...
    }
  ],
  "links": {
    "credits.destination": "what goes here?",
  }
}

Maybe we could also side load the bank account?

{
  "bank_accounts" [
      {
           ...
      }
  ],
  "credits": [
    {
      ...
    }
  ],
  "links": {
    "credits.destination": "what goes here?",
  }
}

Thoughts and suggestions welcome.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions