Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return links to unsettled credits links from /accounts/{accounts.id}/credits #730

Open
kyungmin opened this issue Jan 6, 2015 · 14 comments

Comments

@kyungmin
Copy link

kyungmin commented Jan 6, 2015

The accounts endpoint currently returns links to all credits and settlements for the account. It makes it difficult to filter out only unsettled credits from the credits list.

@mjallday
Copy link
Contributor

mjallday commented Jan 6, 2015

the accounts endpoint should only return accounts. can you please expand on what you mean?

@kyungmin kyungmin changed the title Return unsettled credits links from /accounts Return links to unsettled credits links from /accounts Jan 6, 2015
@kyungmin
Copy link
Author

kyungmin commented Jan 6, 2015

  "links": {
    "accounts.credits": "/accounts/{accounts.id}/credits",
    "accounts.reversals": "/accounts/{accounts.id}/reversals",
    "accounts.customer": "/customers/{accounts.customer}",
    "accounts.debits": "/accounts/{accounts.id}/debits",
    "accounts.settlements": "/accounts/{accounts.id}/settlements",
    "accounts.refunds": "/accounts/{accounts.id}/refunds"
  }

@mjallday mjallday changed the title Return links to unsettled credits links from /accounts Return links to unsettled credits links from /accounts/{accounts.id}/credits Jan 6, 2015
@mjallday
Copy link
Contributor

mjallday commented Jan 6, 2015

this is a little more tricky than it first appears. i'm not sure that we currently do any filtering by null or not null so we need to figure out how that would work. we also need to resolve how to deal with the fact that a credit can be associated to more than one settlement.

  • we could explore doing /credits?settlement=null. this seems logical to me however, since a transaction can be associated to more than one settlement this syntax does not necessarily make sense.
  • /credits?credit.settlements.length=0 still does not make sense if it was settled but the settlement failed.
  • /credits?[credit.settlements?state=succeeded].length=0 may be closer to the syntax we want.

i think we need some more thought around how this works! @balanced/spec-ialz any thoughts about how to filter based off of relationships?

a quicker way may be to create a link /unsettled_credits and make it do the magic we want

@matin
Copy link
Member

matin commented Jan 7, 2015

@mjallday

we also need to resolve how to deal with the fact that a credit can be associated to more than one settlement.

when?

@mjallday
Copy link
Contributor

mjallday commented Jan 7, 2015

create a settlement, settlement fails, create a subsequent settlement to retry.

@matin
Copy link
Member

matin commented Jan 7, 2015

I see. A credit can only be associated to one successful settlement. I think that's what @kyungmin is trying to solve.

@mjallday
Copy link
Contributor

mjallday commented Jan 7, 2015

one successful unfailed settlement. agreed that's what we want but still unsure how best to express that via the api.

@kyungmin
Copy link
Author

kyungmin commented Jan 7, 2015

Yes. I like the idea of having the /unsettled_credits provide the magic that we want.

@kyungmin
Copy link
Author

@balanced/spec-ialz Any other thoughts on this?

@kyungmin
Copy link
Author

My response to @remear's comment from chat:

for starters, /accounts/{accounts.id}/credits already returns credits to the account. i also feel it's not critical to finishing Account and Settlement and for now it seems this can be accomplished by checking if a credit or reversal has a settlement and check that settlement's status.

Agreed that this can wait until we have more traction on this feature. However, for the record, this would allow us to implement the following mocks, providing an easier way to view outstanding credits:

settlements tab
customer page

@remear
Copy link
Contributor

remear commented Jan 21, 2015

If an outstanding credit or reversal is defined as one that has not been settled or one that failed to settle, this should already be achievable by displaying as outstanding any credits and reversals without a settlement link. Is pending considered outstanding?

@kyungmin
Copy link
Author

By outstanding, I meant unsettled. Users would need to know which credits made to payable accounts need to be settled.

@remear
Copy link
Contributor

remear commented Jan 21, 2015

If there's a settlement link the credit is either settled or being settled and does not need to be settled. Would you agree?

@kyungmin
Copy link
Author

Yes. We are currently loading all credits for the account and filtering out settled ones on the Account page, but it's too expensive to do this for the entire marketplace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants