Open kyungmin opened 9 years ago
the accounts endpoint should only return accounts. can you please expand on what you mean?
"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"
}
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.
/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
@mjallday
we also need to resolve how to deal with the fact that a credit can be associated to more than one settlement.
when?
create a settlement, settlement fails, create a subsequent settlement to retry.
I see. A credit can only be associated to one successful settlement. I think that's what @kyungmin is trying to solve.
one successful unfailed settlement. agreed that's what we want but still unsure how best to express that via the api.
Yes. I like the idea of having the /unsettled_credits
provide the magic that we want.
@balanced/spec-ialz Any other thoughts on this?
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:
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?
By outstanding, I meant unsettled. Users would need to know which credits made to payable accounts need to be settled.
If there's a settlement link the credit is either settled or being settled and does not need to be settled. Would you agree?
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.
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.