-
Notifications
You must be signed in to change notification settings - Fork 135
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
Constructor should not include "total" in list of items #18
Comments
In TAG review @triblondon said:
|
There is a PR #111 which deals with this but also another issue (#15) which has a proposal to change the whole shape of the constructor parameters. ProposalIn support of the proposal in #15 create a new We could optionally support having an |
@adrianhopebailie could you provide some code? I'm finding it hard to parse what your proposal is (I think I get it, but want to be sure). |
@adrianhopebailie just reviewed the PR - +1 to merge PR #133 (with a few reservations I put into the PR) |
Here's a proposal: dictionary PaymentDetails { And define total in the spec as something like this: "This field is used to communicate the total amount of the transaction. Processors are not required Then delete this: "The last PaymentItem in the sequence represents the total amount of the payment request. It is the responsibility of the calling code to ensure that the total amount is the sum of the preceding items. The user agent MAY not validate that this is true. " (In any case "MAY not" needs to be fixed.) Ian |
Am I the only one who has some misgivings about a payments spec that would not enforce that the total amount quoted is the sum of the subtotals? Or will this be enforced elsewhere? |
@kirkalx there isn't anything in there that actually says the "items" need to be comprehensive, so there is no way to enforce the condition even if we wanted to. |
There are a bunch of very real use cases where the subtotals won't sum to the total amount you want to actually authorize payment for. |
Can you give an example please? I struggle to see the point of the subtotals if they can't be tied to the total in an obvious fashion. |
If a merchant doesn't know the final cost of the service they're providing - for example, a ride sharing company may use the sub-totals to indicate the per-mile or per-minute cost of the service, but the total will be the amount to be initially pre-authorized (in such scenarios you also benefit from being able to mark sub-total or total items as pending rather than actual, but that's a matter for another issue). Or, as @halindrome says, where the sub-total list isn't comprehensive. Putting that aside, if you don't have an explicit total then you're relying on the merchant not to make a mistake in the construction of their sub-totals (or the user-agent to not make a mistake summing them. Neither of these are a given). Having an implicit rather than explicit total introduces several potential failure points for no real benefit. It is much better for the merchant to be explicit about the amount they wish to charge. |
Perhaps part of the problem is the use of the term 'subtotal', it doesn't seem appropriate if not part of a complete sum. I am also coming from a bitcoin POV, where there is no concept of pre-authorizing (unless overlaid by some intermediary). |
@kirkalx The labels on the items in the items list are entirely free. The issue at hand here is whether the item list should special-case the last item as the implied total which is the case today. The assertion by most on this thread to date is "No" but there are only two proposals right for how to address this:
|
This issue comes from WICG/paymentrequest#68.
From the spec:
The text was updated successfully, but these errors were encountered: