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

Add payeeName input to spec #180

Merged
merged 5 commits into from
Mar 23, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 48 additions & 13 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ const request = new PaymentRequest([{
icon: "https://fancybank.com/card-art.png",
},

payeeName: "Merchant Shop",
payeeOrigin: "https://merchant.com",

timeout: 360000, // 6 minutes
Expand Down Expand Up @@ -512,7 +513,8 @@ Add the following to the [=registry of standardized payment methods=] in
required FrozenArray<BufferSource> credentialIds;
required PaymentCredentialInstrument instrument;
unsigned long timeout;
required USVString payeeOrigin;
DOMString payeeName;
USVString payeeOrigin;
AuthenticationExtensionsClientInputs extensions;
};
</xmp>
Expand Down Expand Up @@ -540,9 +542,15 @@ members:
:: The number of milliseconds before the request to sign the transaction
details times out. At most 1 hour.

: <dfn>payeeName</dfn> member
:: The display name of the payee that this SPC call is for (e.g., the
merchant). Optional, may be provided alongside or instead of
{{SecurePaymentConfirmationRequest/payeeOrigin}}.

: <dfn>payeeOrigin</dfn> member
:: The [=/origin=] of the payee that this SPC call is for (e.g., the
merchant).
merchant). Optional, may be provided alongside or instead of
{{SecurePaymentConfirmationRequest/payeeName}}.

: <dfn>extensions</dfn> member
:: Any [=WebAuthn extensions=] that should be used for the passed
Expand All @@ -562,15 +570,22 @@ input {{SecurePaymentConfirmationRequest}} |data|, are:
1. If |data|["{{SecurePaymentConfirmationRequest/rpId}}"] is not a
[=valid domain=], return `false`.

1. Let |parsedURL| be the result of running the [=URL parser=] on
|data|["{{SecurePaymentConfirmationRequest/payeeOrigin}}"].
1. If both |data|["{{SecurePaymentConfirmationRequest/payeeName}}"] and
|data|["{{SecurePaymentConfirmationRequest/payeeOrigin}}"] are omitted or
empty, return `false`.

1. If |data|["{{SecurePaymentConfirmationRequest/payeeOrigin}}"] is present and
non-empty:

1. Let |parsedURL| be the result of running the [=URL parser=] on
|data|["{{SecurePaymentConfirmationRequest/payeeOrigin}}"].

1. If |parsedURL| is failure, then return `false`.
1. If |parsedURL| is failure, then return `false`.

1. If |parsedURL|'s [=url/scheme=] is not "`https`", then return `false`.
1. If |parsedURL|'s [=url/scheme=] is not "`https`", then return `false`.

1. Set |data|["{{SecurePaymentConfirmationRequest/payeeOrigin}}"] to the
[=serialization of an origin|serialization of=] |parsedURL|'s [=url/origin=].
1. Set |data|["{{SecurePaymentConfirmationRequest/payeeOrigin}}"] to the
[=serialization of an origin|serialization of=] |parsedURL|'s [=url/origin=].

1. If |data|["{{SecurePaymentConfirmationRequest/instrument}}"]["{{PaymentCredentialInstrument/displayName}}"]
is empty, return `false`.
Expand Down Expand Up @@ -620,7 +635,8 @@ Payment Confirmation payment handler=] is selected. However, so that a
is communicated to the user and that the user's consent is collected for the
authentication:

* The {{CollectedClientAdditionalPaymentData/payeeOrigin}}.
* The {{CollectedClientAdditionalPaymentData/payeeName}} if it is present.
* The {{CollectedClientAdditionalPaymentData/payeeOrigin}} if it is present.
stephenmcgruer marked this conversation as resolved.
Show resolved Hide resolved
* The {{CollectedClientAdditionalPaymentData/total}}, that is the
{{PaymentCurrencyAmount/currency}} and {{PaymentCurrencyAmount/value}} of the
transaction.
Expand Down Expand Up @@ -667,8 +683,12 @@ The [=steps to respond to a payment request=] for this payment method, for a giv
:: |data|["{{SecurePaymentConfirmationRequest/rpId}}"]
: {{AuthenticationExtensionsPaymentInputs/topOrigin}}
:: |topOrigin|
: {{AuthenticationExtensionsPaymentInputs/payeeName}}
:: |data|["{{SecurePaymentConfirmationRequest/payeeName}}"] if it is
present, otherwise omitted.
: {{AuthenticationExtensionsPaymentInputs/payeeOrigin}}
:: |data|["{{SecurePaymentConfirmationRequest/payeeOrigin}}"]
:: |data|["{{SecurePaymentConfirmationRequest/payeeOrigin}}"] if it is
present, otherwise omitted.
: {{AuthenticationExtensionsPaymentInputs/total}}
:: |request|.[=payment request details|[[details]]=]["{{PaymentDetailsInit/total}}"]
: {{AuthenticationExtensionsPaymentInputs/instrument}}
Expand Down Expand Up @@ -756,6 +776,7 @@ directly; for authentication the extension can only be accessed via
// Only used for authentication.
USVString rp;
USVString topOrigin;
DOMString payeeName;
USVString payeeOrigin;
PaymentCurrencyAmount total;
PaymentCredentialInstrument instrument;
Expand All @@ -774,8 +795,11 @@ directly; for authentication the extension can only be accessed via
: <dfn>topOrigin</dfn> member
:: The origin of the top-level frame. Only valid at authentication time.

: <dfn>payeeName</dfn> member
:: The payee name, if present, that was displayed to the user. Only valid at authentication time.
nickburris marked this conversation as resolved.
Show resolved Hide resolved

: <dfn>payeeOrigin</dfn> member
:: The payee origin that was displayed to the user. Only valid at authentication time.
:: The payee origin, if present, that was displayed to the user. Only valid at authentication time.

: <dfn>total</dfn> member
:: The transaction amount that was displayed to the user. Only valid at authentication time.
Expand Down Expand Up @@ -844,8 +868,12 @@ directly; for authentication the extension can only be accessed via
:: |extension_inputs|["{{AuthenticationExtensionsPaymentInputs/rp}}"]
: {{CollectedClientAdditionalPaymentData/topOrigin}}
:: |extension_inputs|["{{AuthenticationExtensionsPaymentInputs/topOrigin}}"]
: {{CollectedClientAdditionalPaymentData/payeeName}}
:: |extension_inputs|["{{AuthenticationExtensionsPaymentInputs/payeeName}}"]
if it is present, otherwise omitted.
: {{CollectedClientAdditionalPaymentData/payeeOrigin}}
:: |extension_inputs|["{{AuthenticationExtensionsPaymentInputs/payeeOrigin}}"]
if it is present, otherwise omitted.
: {{CollectedClientAdditionalPaymentData/total}}
:: |extension_inputs|["{{AuthenticationExtensionsPaymentInputs/total}}"]
: {{CollectedClientAdditionalPaymentData/instrument}}
Expand Down Expand Up @@ -881,7 +909,8 @@ The {{CollectedClientPaymentData}} dictionary inherits from
dictionary CollectedClientAdditionalPaymentData {
required USVString rp;
required USVString topOrigin;
required USVString payeeOrigin;
DOMString payeeName;
USVString payeeOrigin;
required PaymentCurrencyAmount total;
required PaymentCredentialInstrument instrument;
};
Expand All @@ -897,8 +926,11 @@ fields:
: <dfn>topOrigin</dfn> member
:: The origin of the top level context that requested to sign the transaction details.

: <dfn>payeeName</dfn> member
:: The name of the payee, if present, that was displayed to the user.

: <dfn>payeeOrigin</dfn> member
:: The origin of the payee that was displayed to the user.
:: The origin of the payee, if present, that was displayed to the user.

: <dfn>total</dfn> member
:: The {{PaymentCurrencyAmount}} of the [[payment-request]] `total` field.
Expand Down Expand Up @@ -1014,6 +1046,9 @@ Confirmation, the [=Relying Party=] MUST proceed as follows:
* Verify that the value of |C|["{{CollectedClientPaymentData/payment}}"]["{{CollectedClientAdditionalPaymentData/topOrigin}}"]
matches the top-level origin that the [=Relying Party=] expects.

* Verify that the value of |C|["{{CollectedClientPaymentData/payment}}"]["{{CollectedClientAdditionalPaymentData/payeeName}}"]
nickburris marked this conversation as resolved.
Show resolved Hide resolved
matches the name of the payee that should have been displayed to the user.

* Verify that the value of |C|["{{CollectedClientPaymentData/payment}}"]["{{CollectedClientAdditionalPaymentData/payeeOrigin}}"]
matches the origin of the payee that should have been displayed to the user.

Expand Down