650
650
< ol >
651
651
< li data-tests =
652
652
"payment-request-ctor-currency-code-checks.https.html ">
653
- < a > Check and canonicalize total</ a >
653
+ < a > Check and canonicalize total amount </ a >
654
654
< var > details</ var > .< a > total</ a > .< a data-lt =
655
655
"PaymentItem.amount "> amount</ a > . Rethrow any exceptions.
656
656
</ li >
@@ -680,13 +680,11 @@ <h2>
680
680
< li > If the < a > shippingOptions</ a > member of < var > details</ var > is
681
681
present, then:
682
682
< ol data-link-for ="PaymentShippingOption ">
683
- < li > Let < var > seenIDs</ var > be an empty list .
683
+ < li > Let < var > seenIDs</ var > be an empty set .
684
684
</ li >
685
- < li > Set < var > options </ var > to
685
+ < li > For each < var > option </ var > in
686
686
< var > details</ var > .< a data-link-for =
687
- "PaymentDetailsBase "> shippingOptions</ a > .
688
- </ li >
689
- < li > For each < var > option</ var > in < var > options</ var > :
687
+ "PaymentDetailsBase "> shippingOptions</ a > :
690
688
< ol >
691
689
< li data-tests =
692
690
"payment-request-ctor-currency-code-checks.https.html ">
@@ -703,10 +701,6 @@ <h2>
703
701
< li > Otherwise, append < var > option</ var > .< a > id</ a > to
704
702
< var > seenIDs</ var > .
705
703
</ li >
706
- </ ol >
707
- </ li >
708
- < li > For each < var > option</ var > in < var > options</ var > :
709
- < ol >
710
704
< li > If < var > option</ var > .< a > selected</ a > is true, then
711
705
set < var > selectedShippingOption</ var > to
712
706
< var > option</ var > .< a > id</ a > .
743
737
< ol >
744
738
< li data-tests =
745
739
"payment-request-ctor-currency-code-checks.https.html ">
746
- < a > Check and canonicalize total</ a >
740
+ < a > Check and canonicalize total amount </ a >
747
741
< var > modifier</ var > .< a data-lt =
748
742
"PaymentDetailsModifier.total "> total</ a > .< a data-lt ="PaymentItem.amount "> amount</ a > .
749
743
Rethrow any exceptions.
989
983
< ol >
990
984
< li > Set < var > request</ var > .< a > [[\updating]]</ a > to true.
991
985
</ li >
992
- < li > Disable the user interface user interface that will allow the
993
- user to interact with the < var > handlers</ var >
994
- </ li >
995
986
< li > Run the < a > update a < code > PaymentRequest</ code > 's details
996
987
algorithm</ a > with < var > detailsPromise</ var > and
997
988
< var > request</ var > .
@@ -1548,14 +1539,9 @@ <h3>
1548
1539
steps:
1549
1540
</ p >
1550
1541
< ol data-link-for ="PaymentCurrencyAmount ">
1551
- < li > Let < var > isValidCurrency</ var > be the result of calling
1552
- < a data-cite =
1553
- "!ecma-402#sec-iswellformedcurrencycode "> IsWellFormedCurrencyCode</ a >
1554
- abstract operation with < var > amount</ var > .< a > currency</ a > as the
1555
- argument.
1556
- </ li >
1557
- < li > If < var > isValidCurrency</ var > is false, then throw a
1558
- < a > RangeError</ a > exception and terminate this algorithm, optionally
1542
+ < li > If the result of < a data-cite =
1543
+ "!ecma-402#sec-iswellformedcurrencycode "> IsWellFormedCurrencyCode</ a > (< var > amount</ var > .< a > currency</ a > )
1544
+ is false, then throw a < a > RangeError</ a > exception, optionally
1559
1545
informing the developer that the currency is invalid.
1560
1546
</ li >
1561
1547
< li > If < var > amount</ var > .< a > value</ a > is not a < a > valid decimal
@@ -1568,18 +1554,18 @@ <h3>
1568
1554
</ li >
1569
1555
</ ol >
1570
1556
< p >
1571
- To < dfn > check and canonicalize total</ dfn > given a
1572
- < a > PaymentCurrencyAmount</ a > < var > total </ var > , run the following
1557
+ To < dfn > check and canonicalize total amount </ dfn > given a
1558
+ < a > PaymentCurrencyAmount</ a > < var > amount </ var > , run the following
1573
1559
steps:
1574
1560
</ p >
1575
1561
< ol data-link-for ="PaymentCurrencyAmount ">
1576
1562
< li >
1577
1563
< a > Check and canonicalize amount</ a > < var > amount</ var > . Rethrow any
1578
1564
exceptions.
1579
1565
</ li >
1580
- < li > If the first < a > code point</ a > of < var > value </ var > is U+002D (-),
1581
- then throw a < a > TypeError</ a > optionally informing the developer that
1582
- a total can't be a negative number.
1566
+ < li > If the first < a > code point</ a > of < var > amount </ var > . < a > value </ a >
1567
+ is U+002D (-), then throw a < a > TypeError</ a > optionally informing the
1568
+ developer that a total's value can't be a negative number.
1583
1569
</ li >
1584
1570
</ ol >
1585
1571
< aside class ="note " title ="No alteration of values ">
@@ -3319,7 +3305,8 @@ <h2>
3319
3305
</ aside >
3320
3306
< p data-tests =
3321
3307
"payment-request-update-event-updatewith-method.https.html, PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html ">
3322
- The < a > updateWith(detailsPromise)</ a > method MUST act as follows:
3308
+ The < a > < code > updateWith(< var > detailsPromise</ var > )</ code > </ a >
3309
+ method MUST act as follows:
3323
3310
</ p >
3324
3311
< ol class ="algorithm ">
3325
3312
< li > Let < var > event</ var > be this < a > PaymentRequestUpdateEvent</ a >
@@ -3333,8 +3320,10 @@ <h2>
3333
3320
throw</ a > an "< a > InvalidStateError</ a > " < a > DOMException</ a > .
3334
3321
</ li >
3335
3322
< li > Let < var > request</ var > be the value of < var > event</ var > 's
3336
- < code > < a data-cite ="DOM#dom-event-target "> target</ a > </ code >
3337
- attribute.
3323
+ < a data-cite ="DOM#event-target "> target</ a > .
3324
+ </ li >
3325
+ < li > Assert: < var > request</ var > is an instance of
3326
+ < a > PaymentRequest</ a > .
3338
3327
</ li >
3339
3328
< li > If < var > request</ var > .< a > [[\state]]</ a > is not
3340
3329
"< a > interactive</ a > ", then < a > throw</ a > an
@@ -3350,13 +3339,6 @@ <h2>
3350
3339
</ li >
3351
3340
< li > Set < var > request</ var > .< a > [[\updating]]</ a > to true.
3352
3341
</ li >
3353
- < li > The < a > user agent</ a > SHOULD disable the user interface that
3354
- allows the user to accept the payment request. This is to ensure
3355
- that the payment is not accepted until developers have made changes
3356
- required by the change. Developers MUST settle the
3357
- < var > detailsPromise</ var > to indicate that the payment request is
3358
- valid again.
3359
- </ li >
3360
3342
< li > Run the < a > update a < code > PaymentRequest</ code > 's details
3361
3343
algorithm</ a > with < var > detailsPromise</ var > and
3362
3344
< var > request</ var > .
@@ -3706,12 +3688,18 @@ <h2>
3706
3688
timeout is a fatal error for the payment request.
3707
3689
</ p >
3708
3690
< ol class ="algorithm ">
3691
+ < li >
3692
+ < a > In parallel</ a > , disable the user interface that allows the user
3693
+ to accept the payment request. This is to ensure that the payment
3694
+ is not accepted until the user interface is updated with any new
3695
+ details.
3696
+ </ li >
3709
3697
< li >
3710
3698
< a > Upon rejection</ a > of < var > detailsPromise</ var > :
3711
3699
< ol >
3712
3700
< li >
3713
- < a > Abort the update</ a > with an " < a > AbortError </ a > "
3714
- < a > DOMException</ a > .
3701
+ < a > Abort the update</ a > with < var > request </ var > and an
3702
+ " < a > AbortError </ a > " < a > DOMException</ a > .
3715
3703
</ li >
3716
3704
</ ol >
3717
3705
</ li >
@@ -3722,7 +3710,8 @@ <h2>
3722
3710
< li > Let < var > details</ var > be the result of < a data-cite =
3723
3711
"!WEBIDL#es-dictionary "> converting</ a > < var > value</ var > to a < a >
3724
3712
PaymentDetailsUpdate</ a > dictionary. If this < a > throws</ a > an
3725
- exception, < a > abort the update</ a > with the thrown exception.
3713
+ exception, < a > abort the update</ a > with < var > request</ var > and
3714
+ with the thrown exception.
3726
3715
</ li >
3727
3716
< li > Let < var > serializedModifierData</ var > be an empty list.
3728
3717
</ li >
@@ -3737,11 +3726,11 @@ <h2>
3737
3726
member of < var > details</ var > is present, then:
3738
3727
< ol >
3739
3728
< li >
3740
- < a > Check and canonicalize total</ a >
3729
+ < a > Check and canonicalize total amount </ a >
3741
3730
< var > details</ var > .< a > total</ a > .< a data-lt =
3742
3731
"PaymentItem.amount "> amount</ a > . If an exception is
3743
- thrown, then < a > abort the update</ a > with that
3744
- exception.
3732
+ thrown, then < a > abort the update</ a > with
3733
+ < var > request </ var > and that exception.
3745
3734
</ li >
3746
3735
</ ol >
3747
3736
</ li >
@@ -3753,8 +3742,8 @@ <h2>
3753
3742
< a > Check and canonicalize amount</ a >
3754
3743
< var > item</ var > .< a data-lt =
3755
3744
"PaymentItem.amount "> amount</ a > . If an exception is
3756
- thrown, then < a > abort the update</ a > with that
3757
- exception.
3745
+ thrown, then < a > abort the update</ a > with
3746
+ < var > request </ var > and that exception.
3758
3747
</ li >
3759
3748
</ ol >
3760
3749
</ li >
@@ -3764,37 +3753,32 @@ <h2>
3764
3753
"PaymentOptions.requestShipping "> requestShipping</ a > is true,
3765
3754
then:
3766
3755
< ol >
3767
- < li > Set < var > shippingOptions</ var > to
3768
- < var > details</ var > .< a > shippingOptions</ a > .
3769
- </ li >
3770
- < li > Let < var > seenIDs</ var > be an empty list.
3756
+ < li > Let < var > seenIDs</ var > be an empty set.
3771
3757
</ li >
3772
3758
< li > For each < var > option</ var > in
3773
- < var > shippingOptions </ var > :
3759
+ < var > details </ var > . < a > shippingOptions </ a > :
3774
3760
< ol >
3775
3761
< li >
3776
3762
< a > Check and canonicalize amount</ a >
3777
3763
< var > option</ var > .< a data-lt =
3778
3764
"PaymentShippingOption.amount "> amount</ a > . If an
3779
3765
exception is thrown, then < a > abort the update</ a >
3780
- with that exception.
3766
+ with < var > request </ var > and that exception.
3781
3767
</ li >
3782
3768
< li data-tests =
3783
3769
"PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html ">
3784
- If < var > seenIDs</ var > contains
3785
- < var > option </ var > . < a data-lt =
3786
- " PaymentShippingOption.id " > id </ a > , then < a > abort the
3787
- update </ a > with a < a > TypeError</ a > .
3770
+ If < var > seenIDs</ var > [ < var > option </ var > . < a data-lt =
3771
+ " PaymentShippingOption.id " > id </ a > ] exists, then
3772
+ < a > abort the update </ a > with < var > request </ var > and a
3773
+ < a > TypeError</ a > .
3788
3774
</ li >
3789
- < li > Otherwise, append < var > option</ var > .< a data-lt =
3775
+ < li > Append < var > option</ var > .< a data-lt =
3790
3776
"PaymentShippingOption.id "> id</ a > to
3791
3777
< var > seenIDs</ var > .
3792
3778
</ li >
3793
- </ ol >
3794
- </ li >
3795
- < li > For each < var > option</ var > in
3796
- < var > shippingOptions</ var > :
3797
- < ol >
3779
+ < li > Append < var > option</ var > to
3780
+ < var > shippingOptions</ var > .
3781
+ </ li >
3798
3782
< li > If < var > option</ var > .< a data-lt =
3799
3783
"PaymentShippingOption.selected "> selected</ a > is
3800
3784
true, then set < var > selectedShippingOption</ var > to
@@ -3825,19 +3809,20 @@ <h2>
3825
3809
< var > modifier</ var > .< a data-lt =
3826
3810
"PaymentDetailsModifier.supportedMethods "> supportedMethods</ a > .
3827
3811
If it returns false, then < a > abort the update</ a >
3828
- with a < a > RangeError</ a > exception. Optional,
3829
- inform the developer that the payment method
3830
- identifier is invalid.
3812
+ with < var > request </ var > and a < a > RangeError</ a >
3813
+ exception. Optionally, inform the developer that
3814
+ the payment method identifier is invalid.
3831
3815
</ li >
3832
3816
< li > If the < a > total</ a > member of < var > modifier</ var >
3833
3817
is present, then:
3834
3818
< ol >
3835
3819
< li >
3836
- < a > Check and canonicalize total</ a >
3820
+ < a > Check and canonicalize total amount </ a >
3837
3821
< var > modifier</ var > .< a > total</ a > .< a data-lt =
3838
3822
"PaymentItem.amount "> amount</ a > . If an
3839
3823
exception is thrown, then < a > abort the
3840
- update</ a > with that exception.
3824
+ update</ a > with < var > request</ var > and that
3825
+ exception.
3841
3826
</ li >
3842
3827
</ ol >
3843
3828
</ li >
@@ -3851,7 +3836,8 @@ <h2>
3851
3836
< var > item</ var > .< a data-lt =
3852
3837
"PaymentItem.amount "> amount</ a > . If an
3853
3838
exception is thrown, then < a > abort the
3854
- update</ a > with that exception.
3839
+ update</ a > with < var > request</ var > and that
3840
+ exception.
3855
3841
</ li >
3856
3842
</ ol >
3857
3843
</ li >
@@ -3863,8 +3849,8 @@ <h2>
3863
3849
< var > modifier</ var > .< a data-lt =
3864
3850
"PaymentDetailsModifier.data "> data</ a > into a
3865
3851
string. If < a > JSON-serializing</ a > throws an
3866
- exception, then < a > abort the update</ a > with that
3867
- exception.
3852
+ exception, then < a > abort the update</ a > with
3853
+ < var > request </ var > and that exception.
3868
3854
</ li >
3869
3855
< li > Add < var > serializedData</ var > to
3870
3856
< var > serializedModifierData</ var > .
@@ -3948,35 +3934,45 @@ <h2>
3948
3934
</ li >
3949
3935
</ ol >
3950
3936
</ li >
3951
- < li > In either case, run the following steps, after either the upon
3952
- rejection or upon fulfillment steps have concluded:
3953
- < ol >
3954
- < li > Set < var > request</ var > .< a > [[\updating]]</ a > to false.
3955
- </ li >
3956
- < li > The < a > user agent</ a > SHOULD update the user interface based
3957
- on any changed values in < var > request</ var > . If appropriate, the
3958
- user agent SHOULD re-enable user interface elements that might
3959
- have been disabled prior to running this algorithm.
3960
- </ li >
3961
- </ ol >
3962
- </ li >
3963
- </ ol >
3964
- < p >
3965
- If any of the above steps say to < dfn > abort the update</ dfn > with an
3966
- exception < var > exception</ var > , then:
3967
- </ p >
3968
- < ol >
3969
- < li > Abort the current user interaction and close down any remaining
3970
- user interface.
3971
- </ li >
3972
- < li > Set < var > request</ var > .< a > [[\state]]</ a > to "< a > closed</ a > ".
3973
- </ li >
3974
- < li > Reject the promise < var > request</ var > .< a > [[\acceptPromise]]</ a >
3975
- with < var > exception</ var > .
3937
+ < li > Set < var > request</ var > .< a > [[\updating]]</ a > to false.
3976
3938
</ li >
3977
- < li > Abort the algorithm.
3939
+ < li > Update the user interface based on any changed values in
3940
+ < var > request</ var > . Re-enable user interface elements disabled prior
3941
+ to running this algorithm.
3978
3942
</ li >
3979
3943
</ ol >
3944
+ < section >
3945
+ < h2 >
3946
+ Abort the update
3947
+ </ h2 >
3948
+ < p >
3949
+ To < dfn > abort the update</ dfn > with a < a > PaymentRequest</ a >
3950
+ < var > request</ var > and < a data-cite =
3951
+ "WEBIDL#dfn-exception "> exception</ a > < var > exception</ var > :
3952
+ </ p >
3953
+ < ol class ="algorithm ">
3954
+ < li > Abort the current user interaction and close down any remaining
3955
+ user interface.
3956
+ </ li >
3957
+ < li >
3958
+ < a > Queue a task</ a > on the < a > user interaction task source</ a > to
3959
+ perform the following steps:
3960
+ < ol >
3961
+ < li > Set < var > request</ var > .< a > [[\state]]</ a > to
3962
+ "< a > closed</ a > ".
3963
+ </ li >
3964
+ < li > Reject the promise
3965
+ < var > request</ var > .< a > [[\acceptPromise]]</ a > with
3966
+ < var > exception</ var > .
3967
+ </ li >
3968
+ < li > Set < var > request</ var > .< a > [[\updating]]</ a > to false.
3969
+ </ li >
3970
+ </ ol >
3971
+ </ li >
3972
+ < li > Abort the algorithm.
3973
+ </ li >
3974
+ </ ol >
3975
+ </ section >
3980
3976
< div class ="note ">
3981
3977
< p >
3982
3978
< a data-lt ="abort the update "> Aborting the update</ a > is performed
0 commit comments