[Webkit-unassigned] [Bug 220561] New: Payment Request API - PaymentDetailsUpdate requires "total"
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jan 12 13:32:36 PST 2021
https://bugs.webkit.org/show_bug.cgi?id=220561
Bug ID: 220561
Summary: Payment Request API - PaymentDetailsUpdate requires
"total"
Product: WebKit
Version: Safari 14
Hardware: Mac (Intel)
OS: macOS 10.15
Status: NEW
Severity: Normal
Priority: P2
Component: New Bugs
Assignee: webkit-unassigned at lists.webkit.org
Reporter: nickgzzjr at gmail.com
Calling event.updateWith inside the onshippingaddresschange or onshippingoptionchange event handlers with a PaymentDetailsUpdate object requires “total” to be included. When “total” is not included an error “RangeError: "" is not a valid currency code." is thrown.
I expect “total” to NOT be required in the PaymentDetailsUpdate. Note: “total” should be required for PaymentDetailsInit but not for PaymentDetailsUpdate. Note: “newTotal” is required in the ApplePayJS API when using ApplePayShippingContactUpdate.
Simple example:
request.onshippingaddresschange = event => {
const paymentDetailsUpdate = {};
event.updateWith(paymentDetailsUpdate);
};
The above example will throw an error.
Though the PaymentDetailsUpdate can be more complex.
For example, I might want to include an error in the PaymentDetailsUpdate:
const paymentDetailsUpdate = {
"error": "Can't ship to this address."
}
This won’t work unless I include the total as such:
const paymentDetailsUpdate = {
"total": {
"label": "My Merchant",
"amount": {
"value": "27.50",
"currency": "USD"
}
},
"error": "Can't ship to this address."
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210112/b963a893/attachment.htm>
More information about the webkit-unassigned
mailing list