Changeset 236552 in webkit
- Timestamp:
- Sep 27, 2018, 9:44:49 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 17 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r236550 r236552 1 2018-09-27 Andy Estes <aestes@apple.com> 2 3 [Apple Pay] Support granular errors in PaymentDetailsUpdate 4 https://bugs.webkit.org/show_bug.cgi?id=189938 5 6 Reviewed by Youenn Fablet. 7 8 * http/tests/resources/payment-request.js: 9 (validPaymentDetails): 10 (updateDetailsOnShippingAddressChange): 11 * http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrors.https-expected.txt: Added. 12 * http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrors.https.html: Added. 13 * http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https-expected.txt: Added. 14 * http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html: Added. 15 * platform/mac-wk2/TestExpectations: 16 1 17 2018-09-27 Chris Dumez <cdumez@apple.com> 2 18 -
trunk/LayoutTests/http/tests/resources/payment-request.js
r224402 r236552 19 19 }, name); 20 20 } 21 22 function validPaymentMethod() 23 { 24 return { 25 supportedMethods: 'https://apple.com/apple-pay', 26 data: { 27 version: 2, 28 merchantIdentifier: '', 29 countryCode: 'US', 30 supportedNetworks: ['visa', 'masterCard'], 31 merchantCapabilities: ['supports3DS'], 32 }, 33 } 34 } 35 36 function validPaymentDetails() 37 { 38 return { 39 total: { 40 label: 'Total', 41 amount: { 42 currency: 'USD', 43 value: '10.00', 44 }, 45 }, 46 displayItems: [{ 47 label: 'Item', 48 amount: { 49 currency: 'USD', 50 value: '10.00', 51 }, 52 }], 53 } 54 } 55 56 function updateDetailsOnShippingAddressChange(paymentDetailsInit, paymentOptions, detailsUpdate) 57 { 58 return new Promise((resolve, reject) => { 59 activateThen(() => { 60 var request = new PaymentRequest([validPaymentMethod()], paymentDetailsInit, paymentOptions); 61 request.onmerchantvalidation = (event) => { 62 event.complete({ }); 63 }; 64 request.onshippingaddresschange = (event) => { 65 var detailsUpdatePromise = new Promise((resolve, reject) => { 66 resolve(detailsUpdate); 67 }); 68 event.updateWith(detailsUpdatePromise); 69 detailsUpdatePromise.then(() => { 70 resolve(); 71 request.abort(); 72 }); 73 }; 74 request.show().catch(error => error); 75 }); 76 }); 77 } -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r236481 r236552 27 27 [ Sierra ] http/tests/ssl/applepay/ApplePaySessionV4.html [ Skip ] 28 28 [ Sierra ] http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html [ Skip ] 29 [ Sierra ] http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html [ Skip ] 29 30 [ HighSierra ] http/tests/ssl/applepay/ApplePayButtonV4.html [ Skip ] 30 31 [ HighSierra ] http/tests/ssl/applepay/ApplePaySessionV4.html [ Skip ] … … 758 759 [ Mojave+ ] http/tests/ssl/applepay/ApplePaySessionV4.html [ Pass ] 759 760 [ HighSierra+ ] http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html [ Pass ] 761 [ HighSierra+ ] http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html [ Pass ] 760 762 # <rdar://problem/31634451> 761 763 [ HighSierra+ ] http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html [ Pass ] -
trunk/Source/WebCore/ChangeLog
r236551 r236552 1 2018-09-27 Andy Estes <aestes@apple.com> 2 3 [Apple Pay] Support granular errors in PaymentDetailsUpdate 4 https://bugs.webkit.org/show_bug.cgi?id=189938 5 6 Reviewed by Youenn Fablet. 7 8 Implemented the shippingAddressErrors, payerErrors, and paymentMethodErrors properties on 9 PaymentDetailsUpdate, as specified in the Payment Request API W3C Editor's Draft of 10 26 September 2018. 11 12 When these errors are specified in a PaymentDetailsUpdate, map them to PaymentErrors. For 13 shippingAddressErrors and payerErrors, we use the "shippingContactInvalid" code and a 14 contact field that matches the shippingAddressError or payerError property specified. 15 16 For paymentMethodErrors, we interpret this as a sequence of ApplePayErrors, which are 17 converted to PaymentErrors as in Apple Pay JS. 18 19 Tests: http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrors.https.html 20 http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html 21 22 * DerivedSources.make: Removed some tabs and added new .idl files. 23 * Modules/applepay/ApplePayError.idl: Moved ApplePayErrorCode and ApplePayErrorContactField 24 into their own .idl files so they can be used in MockPaymentError. 25 * Modules/applepay/ApplePayErrorCode.h: Added. 26 * Modules/applepay/ApplePayErrorCode.idl: Added. 27 * Modules/applepay/ApplePayErrorContactField.h: Added. 28 * Modules/applepay/ApplePayErrorContactField.idl: Added. 29 30 * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: 31 (WebCore::appendShippingContactInvalidError): Appended a "shippingContactInvalid" 32 PaymentError to errors if the message is non-null. 33 (WebCore::ApplePayPaymentHandler::computeErrors const): 34 (WebCore::ApplePayPaymentHandler::detailsUpdated): 35 (WebCore::ApplePayPaymentHandler::shippingAddressUpdated): Computed a vector of PaymentErrors 36 based on shippingAddressErrors, payerErrors, and paymentMethodErrors. 37 38 * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: 39 40 * Modules/paymentrequest/PaymentDetailsUpdate.h: 41 * Modules/paymentrequest/PaymentDetailsUpdate.idl: Defined shippingAddressErrors, 42 payerErrors, and paymentMethodErrors. 43 44 * Modules/paymentrequest/PaymentHandler.h: 45 * Modules/paymentrequest/PaymentRequest.cpp: 46 (WebCore::PaymentRequest::paymentMethodChanged): 47 (WebCore::PaymentRequest::settleDetailsPromise): Passed shippingAddressErrors, payerErrors, 48 and paymentMethodErrors to the payment handler. 49 50 * SourcesCocoa.txt: 51 * WebCore.xcodeproj/project.pbxproj: 52 53 * testing/MockPaymentCoordinator.cpp: 54 (WebCore::MockPaymentCoordinator::completeShippingContactSelection): Stored errors in m_errors. 55 * testing/MockPaymentCoordinator.h: 56 * testing/MockPaymentCoordinator.idl: Added an errors attribute. 57 58 * testing/MockPaymentError.h: Added. 59 * testing/MockPaymentError.idl: Added. 60 1 61 2018-09-27 Alex Christensen <achristensen@webkit.org> 2 62 -
trunk/Source/WebCore/DerivedSources.make
r236481 r236552 1 # Copyright (C) 2006-201 7Apple Inc. All rights reserved.1 # Copyright (C) 2006-2018 Apple Inc. All rights reserved. 2 2 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 3 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> … … 91 91 $(WebCore)/Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl \ 92 92 $(WebCore)/Modules/applepay/ApplePayContactField.idl \ 93 $(WebCore)/Modules/applepay/ApplePayError.idl \ 93 $(WebCore)/Modules/applepay/ApplePayError.idl \ 94 $(WebCore)/Modules/applepay/ApplePayErrorCode.idl \ 95 $(WebCore)/Modules/applepay/ApplePayErrorContactField.idl \ 94 96 $(WebCore)/Modules/applepay/ApplePayLineItem.idl \ 95 97 $(WebCore)/Modules/applepay/ApplePayMerchantCapability.idl \ 96 98 $(WebCore)/Modules/applepay/ApplePayPayment.idl \ 97 99 $(WebCore)/Modules/applepay/ApplePayPaymentAuthorizedEvent.idl \ 98 100 $(WebCore)/Modules/applepay/ApplePayPaymentAuthorizationResult.idl \ 99 101 $(WebCore)/Modules/applepay/ApplePayPaymentContact.idl \ 100 102 $(WebCore)/Modules/applepay/ApplePayPaymentMethod.idl \ 101 103 $(WebCore)/Modules/applepay/ApplePayPaymentMethodSelectedEvent.idl \ 102 104 $(WebCore)/Modules/applepay/ApplePayPaymentMethodType.idl \ 103 105 $(WebCore)/Modules/applepay/ApplePayPaymentMethodUpdate.idl \ 104 106 $(WebCore)/Modules/applepay/ApplePayPaymentPass.idl \ 105 107 $(WebCore)/Modules/applepay/ApplePayPaymentRequest.idl \ … … 107 109 $(WebCore)/Modules/applepay/ApplePaySession.idl \ 108 110 $(WebCore)/Modules/applepay/ApplePayShippingContactSelectedEvent.idl \ 109 111 $(WebCore)/Modules/applepay/ApplePayShippingContactUpdate.idl \ 110 112 $(WebCore)/Modules/applepay/ApplePayShippingMethod.idl \ 111 113 $(WebCore)/Modules/applepay/ApplePayShippingMethodSelectedEvent.idl \ 112 114 $(WebCore)/Modules/applepay/ApplePayShippingMethodUpdate.idl \ 113 115 $(WebCore)/Modules/applepay/ApplePayValidateMerchantEvent.idl \ 114 116 $(WebCore)/Modules/applepay/paymentrequest/ApplePayModifier.idl \ … … 983 985 $(WebCore)/testing/MockPaymentAddress.idl \ 984 986 $(WebCore)/testing/MockPaymentCoordinator.idl \ 987 $(WebCore)/testing/MockPaymentError.idl \ 985 988 $(WebCore)/testing/ServiceWorkerInternals.idl \ 986 989 $(WebCore)/testing/TypeConversions.idl \ -
trunk/Source/WebCore/Modules/applepay/ApplePayError.idl
r223580 r236552 25 25 26 26 [ 27 Conditional=APPLE_PAY_SESSION_V3,28 ] enum ApplePayErrorCode {29 "unknown",30 "shippingContactInvalid",31 "billingContactInvalid",32 "addressUnserviceable"33 };34 35 [36 Conditional=APPLE_PAY_SESSION_V3,37 ] enum ApplePayErrorContactField {38 "phoneNumber",39 "emailAddress",40 "name",41 "phoneticName",42 "postalAddress",43 "addressLines",44 "subLocality",45 "locality",46 "postalCode",47 "subAdministrativeArea",48 "administrativeArea",49 "country",50 "countryCode"51 };52 53 [54 27 Constructor(ApplePayErrorCode errorCode, optional ApplePayErrorContactField contactField, optional DOMString message = ""), 55 28 Conditional=APPLE_PAY_SESSION_V3, -
trunk/Source/WebCore/Modules/applepay/ApplePayErrorCode.h
r236551 r236552 24 24 */ 25 25 26 [ 27 Conditional=PAYMENT_REQUEST 28 ] dictionary PaymentDetailsUpdate : PaymentDetailsBase { 29 DOMString error; 30 PaymentItem total; 31 }; 26 #pragma once 27 28 #if ENABLE(APPLE_PAY) 29 30 #include "ApplePaySessionPaymentRequest.h" 31 32 namespace WebCore { 33 34 using ApplePayErrorCode = PaymentError::Code; 35 36 } // namespace WebCore 37 38 #endif // ENABLE(APPLE_PAY) -
trunk/Source/WebCore/Modules/applepay/ApplePayErrorCode.idl
r236551 r236552 25 25 26 26 [ 27 Conditional=PAYMENT_REQUEST 28 ] dictionary PaymentDetailsUpdate : PaymentDetailsBase { 29 DOMString error; 30 PaymentItem total; 27 Conditional=APPLE_PAY, 28 ExportMacro=WEBCORE_EXPORT, 29 ] enum ApplePayErrorCode { 30 "unknown", 31 "shippingContactInvalid", 32 "billingContactInvalid", 33 "addressUnserviceable" 31 34 }; -
trunk/Source/WebCore/Modules/applepay/ApplePayErrorContactField.h
r236551 r236552 24 24 */ 25 25 26 [ 27 Conditional=PAYMENT_REQUEST 28 ] dictionary PaymentDetailsUpdate : PaymentDetailsBase { 29 DOMString error; 30 PaymentItem total; 31 }; 26 #pragma once 27 28 #if ENABLE(APPLE_PAY) 29 30 #include "ApplePaySessionPaymentRequest.h" 31 32 namespace WebCore { 33 34 using ApplePayErrorContactField = PaymentError::ContactField; 35 36 } // namespace WebCore 37 38 #endif // ENABLE(APPLE_PAY) -
trunk/Source/WebCore/Modules/applepay/ApplePayErrorContactField.idl
r236551 r236552 25 25 26 26 [ 27 Conditional=PAYMENT_REQUEST 28 ] dictionary PaymentDetailsUpdate : PaymentDetailsBase { 29 DOMString error; 30 PaymentItem total; 27 Conditional=APPLE_PAY, 28 ExportMacro=WEBCORE_EXPORT, 29 ] enum ApplePayErrorContactField { 30 "phoneNumber", 31 "emailAddress", 32 "name", 33 "phoneticName", 34 "postalAddress", 35 "addressLines", 36 "subLocality", 37 "locality", 38 "postalCode", 39 "subAdministrativeArea", 40 "administrativeArea", 41 "country", 42 "countryCode" 31 43 }; -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
r236429 r236552 29 29 #if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_REQUEST) 30 30 31 #include "AddressErrors.h" 31 32 #include "ApplePayContactField.h" 32 33 #include "ApplePayMerchantCapability.h" … … 37 38 #include "EventNames.h" 38 39 #include "Frame.h" 40 #include "JSApplePayError.h" 39 41 #include "JSApplePayPayment.h" 40 42 #include "JSApplePayPaymentMethod.h" … … 43 45 #include "MerchantValidationEvent.h" 44 46 #include "Page.h" 47 #include "PayerErrorFields.h" 45 48 #include "Payment.h" 46 49 #include "PaymentAuthorizationStatus.h" … … 310 313 } 311 314 312 ExceptionOr<void> ApplePayPaymentHandler::detailsUpdated(PaymentRequest::UpdateReason reason, const String& error) 315 static inline void appendShippingContactInvalidError(String&& message, std::optional<PaymentError::ContactField> contactField, Vector<PaymentError>& errors) 316 { 317 if (!message.isNull()) 318 errors.append({ PaymentError::Code::ShippingContactInvalid, WTFMove(message), WTFMove(contactField) }); 319 } 320 321 Vector<PaymentError> ApplePayPaymentHandler::computeErrors(String&& error, AddressErrors&& addressErrors, PayerErrorFields&& payerErrors, JSC::JSObject* paymentMethodErrors) const 322 { 323 Vector<PaymentError> errors; 324 325 auto& options = m_paymentRequest->paymentOptions(); 326 using ContactField = PaymentError::ContactField; 327 328 if (options.requestShipping && m_paymentRequest->paymentDetails().shippingOptions.isEmpty()) { 329 appendShippingContactInvalidError(WTFMove(error), std::nullopt, errors); 330 appendShippingContactInvalidError(WTFMove(addressErrors.addressLine), ContactField::AddressLines, errors); 331 appendShippingContactInvalidError(WTFMove(addressErrors.city), ContactField::Locality, errors); 332 appendShippingContactInvalidError(WTFMove(addressErrors.country), ContactField::Country, errors); 333 appendShippingContactInvalidError(WTFMove(addressErrors.dependentLocality), ContactField::SubLocality, errors); 334 appendShippingContactInvalidError(WTFMove(addressErrors.phone), ContactField::PhoneNumber, errors); 335 appendShippingContactInvalidError(WTFMove(addressErrors.postalCode), ContactField::PostalCode, errors); 336 appendShippingContactInvalidError(WTFMove(addressErrors.recipient), ContactField::Name, errors); 337 appendShippingContactInvalidError(WTFMove(addressErrors.region), ContactField::AdministrativeArea, errors); 338 } 339 340 if (options.requestPayerName) 341 appendShippingContactInvalidError(WTFMove(payerErrors.name), ContactField::Name, errors); 342 343 if (options.requestPayerEmail) 344 appendShippingContactInvalidError(WTFMove(payerErrors.email), ContactField::EmailAddress, errors); 345 346 if (options.requestPayerPhone) 347 appendShippingContactInvalidError(WTFMove(payerErrors.phone), ContactField::PhoneNumber, errors); 348 349 #if ENABLE(APPLE_PAY_SESSION_V3) 350 if (paymentMethodErrors) { 351 auto& context = *scriptExecutionContext(); 352 auto throwScope = DECLARE_THROW_SCOPE(context.vm()); 353 auto applePayErrors = convert<IDLSequence<IDLInterface<ApplePayError>>>(*context.execState(), paymentMethodErrors); 354 if (!throwScope.exception()) { 355 for (auto& applePayError : applePayErrors) { 356 if (applePayError) 357 errors.append({ applePayError->code(), applePayError->message(), applePayError->contactField() }); 358 } 359 } 360 } 361 #else 362 UNUSED_PARAM(paymentMethodErrors); 363 #endif 364 365 return errors; 366 } 367 368 ExceptionOr<void> ApplePayPaymentHandler::detailsUpdated(PaymentRequest::UpdateReason reason, String&& error, AddressErrors&& addressErrors, PayerErrorFields&& payerErrors, JSC::JSObject* paymentMethodErrors) 313 369 { 314 370 using Reason = PaymentRequest::UpdateReason; … … 317 373 return { }; 318 374 case Reason::ShippingAddressChanged: 319 return shippingAddressUpdated( error);375 return shippingAddressUpdated(computeErrors(WTFMove(error), WTFMove(addressErrors), WTFMove(payerErrors), paymentMethodErrors)); 320 376 case Reason::ShippingOptionChanged: 321 377 return shippingOptionUpdated(); … … 345 401 } 346 402 347 ExceptionOr<void> ApplePayPaymentHandler::shippingAddressUpdated( const String& error)403 ExceptionOr<void> ApplePayPaymentHandler::shippingAddressUpdated(Vector<PaymentError>&& errors) 348 404 { 349 405 ASSERT(m_isUpdating); … … 351 407 352 408 ShippingContactUpdate update; 353 354 if (m_paymentRequest->paymentOptions().requestShipping && m_paymentRequest->paymentDetails().shippingOptions.isEmpty()) { 355 PaymentError paymentError; 356 paymentError.code = PaymentError::Code::ShippingContactInvalid; 357 paymentError.message = error; 358 update.errors.append(WTFMove(paymentError)); 359 } 409 update.errors = WTFMove(errors); 360 410 361 411 auto newTotalAndLineItems = computeTotalAndLineItems(); -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h
r236429 r236552 54 54 55 55 ExceptionOr<ApplePaySessionPaymentRequest::TotalAndLineItems> computeTotalAndLineItems(); 56 Vector<PaymentError> computeErrors(String&& error, AddressErrors&&, PayerErrorFields&&, JSC::JSObject* paymentMethodErrors) const; 56 57 57 ExceptionOr<void> shippingAddressUpdated( const String& error);58 ExceptionOr<void> shippingAddressUpdated(Vector<PaymentError>&& errors); 58 59 ExceptionOr<void> shippingOptionUpdated(); 59 60 ExceptionOr<void> paymentMethodUpdated(); … … 64 65 void hide() final; 65 66 void canMakePayment(WTF::Function<void(bool)>&& completionHandler) final; 66 ExceptionOr<void> detailsUpdated(PaymentRequest::UpdateReason, const String& error) final;67 ExceptionOr<void> detailsUpdated(PaymentRequest::UpdateReason, String&& error, AddressErrors&&, PayerErrorFields&&, JSC::JSObject* paymentMethodErrors) final; 67 68 ExceptionOr<void> merchantValidationCompleted(JSC::JSValue&&) final; 68 69 void complete(std::optional<PaymentComplete>&&) final; -
trunk/Source/WebCore/Modules/paymentrequest/PaymentDetailsUpdate.h
r220955 r236552 1 1 /* 2 * Copyright (C) 2017 Apple Inc. All rights reserved.2 * Copyright (C) 2017-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(PAYMENT_REQUEST) 29 29 30 #include "AddressErrors.h" 31 #include "PayerErrorFields.h" 30 32 #include "PaymentDetailsBase.h" 31 33 #include "PaymentItem.h" … … 34 36 namespace WebCore { 35 37 36 struct PaymentDetailsUpdate final : publicPaymentDetailsBase {38 struct PaymentDetailsUpdate final : PaymentDetailsBase { 37 39 String error; 38 40 PaymentItem total; 41 AddressErrors shippingAddressErrors; 42 PayerErrorFields payerErrors; 43 JSC::Strong<JSC::JSObject> paymentMethodErrors; 39 44 }; 40 45 -
trunk/Source/WebCore/Modules/paymentrequest/PaymentDetailsUpdate.idl
r220955 r236552 1 1 /* 2 * Copyright (C) 2017 Apple Inc. All rights reserved.2 * Copyright (C) 2017-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 DOMString error; 30 30 PaymentItem total; 31 AddressErrors shippingAddressErrors; 32 PayerErrorFields payerErrors; 33 object paymentMethodErrors; 31 34 }; -
trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.h
r228195 r236552 39 39 40 40 class Document; 41 struct AddressErrors; 42 struct PayerErrorFields; 41 43 42 44 class PaymentHandler : public virtual PaymentSessionBase { … … 50 52 virtual void hide() = 0; 51 53 virtual void canMakePayment(WTF::Function<void(bool)>&& completionHandler) = 0; 52 virtual ExceptionOr<void> detailsUpdated(PaymentRequest::UpdateReason, const String& error) = 0;54 virtual ExceptionOr<void> detailsUpdated(PaymentRequest::UpdateReason, String&& error, AddressErrors&&, PayerErrorFields&&, JSC::JSObject* paymentMethodErrors) = 0; 53 55 virtual ExceptionOr<void> merchantValidationCompleted(JSC::JSValue&&) = 0; 54 56 virtual void complete(std::optional<PaymentComplete>&&) = 0; -
trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp
r236429 r236552 560 560 dispatchEvent(PaymentMethodChangeEvent::create(eventName, methodName, WTFMove(methodDetailsFunction))); 561 561 else 562 m_activePaymentHandler->detailsUpdated(UpdateReason::PaymentMethodChanged, { } );562 m_activePaymentHandler->detailsUpdated(UpdateReason::PaymentMethodChanged, { }, { }, { }, { }); 563 563 }); 564 564 } … … 628 628 auto& context = *m_detailsPromise->scriptExecutionContext(); 629 629 auto throwScope = DECLARE_THROW_SCOPE(context.vm()); 630 auto paymentDetailsUpdate = convertDictionary<PaymentDetailsUpdate>(*context.execState(), m_detailsPromise->result());630 auto detailsUpdate = convertDictionary<PaymentDetailsUpdate>(*context.execState(), m_detailsPromise->result()); 631 631 if (throwScope.exception()) { 632 632 abortWithException(Exception { ExistingExceptionError }); … … 634 634 } 635 635 636 auto totalResult = checkAndCanonicalizeTotal( paymentDetailsUpdate.total.amount);636 auto totalResult = checkAndCanonicalizeTotal(detailsUpdate.total.amount); 637 637 if (totalResult.hasException()) { 638 638 abortWithException(totalResult.releaseException()); … … 640 640 } 641 641 642 auto detailsResult = checkAndCanonicalizeDetails(*context.execState(), paymentDetailsUpdate, m_options.requestShipping, ShouldValidatePaymentMethodIdentifier::Yes);642 auto detailsResult = checkAndCanonicalizeDetails(*context.execState(), detailsUpdate, m_options.requestShipping, ShouldValidatePaymentMethodIdentifier::Yes); 643 643 if (detailsResult.hasException()) { 644 644 abortWithException(detailsResult.releaseException()); … … 648 648 auto shippingOptionAndModifierData = detailsResult.releaseReturnValue(); 649 649 650 m_details.total = WTFMove( paymentDetailsUpdate.total);651 m_details.displayItems = WTFMove( paymentDetailsUpdate.displayItems);650 m_details.total = WTFMove(detailsUpdate.total); 651 m_details.displayItems = WTFMove(detailsUpdate.displayItems); 652 652 if (m_options.requestShipping) { 653 m_details.shippingOptions = WTFMove( paymentDetailsUpdate.shippingOptions);653 m_details.shippingOptions = WTFMove(detailsUpdate.shippingOptions); 654 654 m_shippingOption = WTFMove(std::get<0>(shippingOptionAndModifierData)); 655 655 } 656 656 657 m_details.modifiers = WTFMove( paymentDetailsUpdate.modifiers);657 m_details.modifiers = WTFMove(detailsUpdate.modifiers); 658 658 m_serializedModifierData = WTFMove(std::get<1>(shippingOptionAndModifierData)); 659 659 660 auto result = m_activePaymentHandler->detailsUpdated(reason, paymentDetailsUpdate.error);660 auto result = m_activePaymentHandler->detailsUpdated(reason, WTFMove(detailsUpdate.error), WTFMove(detailsUpdate.shippingAddressErrors), WTFMove(detailsUpdate.payerErrors), detailsUpdate.paymentMethodErrors.get()); 661 661 if (result.hasException()) { 662 662 abortWithException(result.releaseException()); -
trunk/Source/WebCore/SourcesCocoa.txt
r236494 r236552 1 // Copyright (C) 2017 Apple Inc. All rights reserved.1 // Copyright (C) 2017-2018 Apple Inc. All rights reserved. 2 2 // 3 3 // Redistribution and use in source and binary forms, with or without … … 588 588 JSApplePayContactField.cpp 589 589 JSApplePayError.cpp 590 JSApplePayErrorCode.cpp 591 JSApplePayErrorContactField.cpp 590 592 JSApplePayLineItem.cpp 591 593 JSApplePayMerchantCapability.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r236494 r236552 2956 2956 A1B5B29E1AAA846E008B6042 /* MockContentFilterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */; }; 2957 2957 A1B5B29F1AAA846F008B6042 /* MockContentFilterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2958 A1BB859C2159AEA10067E07D /* ApplePayErrorCode.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB85992159AEA10067E07D /* ApplePayErrorCode.h */; }; 2959 A1BB85A32159AF570067E07D /* ApplePayErrorContactField.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB85A02159AF570067E07D /* ApplePayErrorContactField.h */; }; 2960 A1BB85A92159B02C0067E07D /* MockPaymentError.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB85A62159B02C0067E07D /* MockPaymentError.h */; }; 2961 A1BB85B22159B1A10067E07D /* JSApplePayErrorCode.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB85AE2159B1A00067E07D /* JSApplePayErrorCode.h */; }; 2962 A1BB85B32159B1A10067E07D /* JSApplePayErrorContactField.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB85AF2159B1A00067E07D /* JSApplePayErrorContactField.h */; }; 2963 A1BB85B82159B3A40067E07D /* JSMockPaymentError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1BB85B42159B3890067E07D /* JSMockPaymentError.cpp */; }; 2964 A1BB85B92159B3AE0067E07D /* JSMockPaymentError.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB85B52159B38A0067E07D /* JSMockPaymentError.h */; }; 2958 2965 A1BF6B821AA96C7D00AF4A8A /* MockContentFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1BF6B801AA96C7D00AF4A8A /* MockContentFilter.cpp */; }; 2959 2966 A1BF6B831AA96C7D00AF4A8A /* MockContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BF6B811AA96C7D00AF4A8A /* MockContentFilter.h */; }; … … 11047 11054 A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockContentFilterSettings.cpp; sourceTree = "<group>"; }; 11048 11055 A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockContentFilterSettings.h; sourceTree = "<group>"; }; 11056 A1BB85992159AEA10067E07D /* ApplePayErrorCode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePayErrorCode.h; sourceTree = "<group>"; }; 11057 A1BB859B2159AEA10067E07D /* ApplePayErrorCode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ApplePayErrorCode.idl; sourceTree = "<group>"; }; 11058 A1BB85A02159AF570067E07D /* ApplePayErrorContactField.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePayErrorContactField.h; sourceTree = "<group>"; }; 11059 A1BB85A22159AF570067E07D /* ApplePayErrorContactField.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ApplePayErrorContactField.idl; sourceTree = "<group>"; }; 11060 A1BB85A62159B02C0067E07D /* MockPaymentError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockPaymentError.h; sourceTree = "<group>"; }; 11061 A1BB85A82159B02C0067E07D /* MockPaymentError.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockPaymentError.idl; sourceTree = "<group>"; }; 11062 A1BB85AC2159B19F0067E07D /* JSApplePayErrorContactField.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSApplePayErrorContactField.cpp; sourceTree = "<group>"; }; 11063 A1BB85AD2159B1A00067E07D /* JSApplePayErrorCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSApplePayErrorCode.cpp; sourceTree = "<group>"; }; 11064 A1BB85AE2159B1A00067E07D /* JSApplePayErrorCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSApplePayErrorCode.h; sourceTree = "<group>"; }; 11065 A1BB85AF2159B1A00067E07D /* JSApplePayErrorContactField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSApplePayErrorContactField.h; sourceTree = "<group>"; }; 11066 A1BB85B42159B3890067E07D /* JSMockPaymentError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockPaymentError.cpp; sourceTree = "<group>"; }; 11067 A1BB85B52159B38A0067E07D /* JSMockPaymentError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockPaymentError.h; sourceTree = "<group>"; }; 11049 11068 A1BF6B801AA96C7D00AF4A8A /* MockContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockContentFilter.cpp; sourceTree = "<group>"; }; 11050 11069 A1BF6B811AA96C7D00AF4A8A /* MockContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockContentFilter.h; sourceTree = "<group>"; }; … … 16096 16115 1ADFDFD61E71D8DF008F5D34 /* ApplePayError.h */, 16097 16116 1ADFDFD71E71D8DF008F5D34 /* ApplePayError.idl */, 16117 A1BB85992159AEA10067E07D /* ApplePayErrorCode.h */, 16118 A1BB859B2159AEA10067E07D /* ApplePayErrorCode.idl */, 16119 A1BB85A02159AF570067E07D /* ApplePayErrorContactField.h */, 16120 A1BB85A22159AF570067E07D /* ApplePayErrorContactField.idl */, 16098 16121 7C6579E21E00827000E3A27A /* ApplePayLineItem.h */, 16099 16122 7C6579E41E0082C800E3A27A /* ApplePayLineItem.idl */, … … 16269 16292 1ADFDFE11E71DCA0008F5D34 /* JSApplePayError.cpp */, 16270 16293 1ADFDFE21E71DCA0008F5D34 /* JSApplePayError.h */, 16294 A1BB85AD2159B1A00067E07D /* JSApplePayErrorCode.cpp */, 16295 A1BB85AE2159B1A00067E07D /* JSApplePayErrorCode.h */, 16296 A1BB85AC2159B19F0067E07D /* JSApplePayErrorContactField.cpp */, 16297 A1BB85AF2159B1A00067E07D /* JSApplePayErrorContactField.h */, 16271 16298 7C6579E91E00856600E3A27A /* JSApplePayLineItem.cpp */, 16272 16299 7C6579EA1E00856600E3A27A /* JSApplePayLineItem.h */, … … 17040 17067 A1AFEDE41F8BFF6D0087013F /* MockPaymentCoordinator.h */, 17041 17068 A146D3161F99B53D00D29196 /* MockPaymentCoordinator.idl */, 17069 A1BB85A62159B02C0067E07D /* MockPaymentError.h */, 17070 A1BB85A82159B02C0067E07D /* MockPaymentError.idl */, 17042 17071 A1CBEF631F9F11290028DE7C /* MockPaymentMethod.h */, 17043 17072 A14061891E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp */, … … 17080 17109 A146D3191F99BCBB00D29196 /* JSMockPaymentCoordinator.cpp */, 17081 17110 A146D3181F99BCBA00D29196 /* JSMockPaymentCoordinator.h */, 17111 A1BB85B42159B3890067E07D /* JSMockPaymentError.cpp */, 17112 A1BB85B52159B38A0067E07D /* JSMockPaymentError.h */, 17082 17113 427DA71B13735DFA007C57FB /* JSServiceWorkerInternals.cpp */, 17083 17114 427DA71C13735DFA007C57FB /* JSServiceWorkerInternals.h */, … … 27114 27145 A146D3231F99D0EF00D29196 /* JSMockPaymentAddress.h in Headers */, 27115 27146 A146D31B1F99BCFB00D29196 /* JSMockPaymentCoordinator.h in Headers */, 27147 A1BB85B92159B3AE0067E07D /* JSMockPaymentError.h in Headers */, 27116 27148 427DA71E13735DFA007C57FB /* JSServiceWorkerInternals.h in Headers */, 27117 27149 EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */, … … 27208 27240 A1DF5A941F7EC4320058A477 /* ApplePayContactField.h in Headers */, 27209 27241 A12C59EE2035FC9B0012236B /* ApplePayError.h in Headers */, 27242 A1BB859C2159AEA10067E07D /* ApplePayErrorCode.h in Headers */, 27243 A1BB85A32159AF570067E07D /* ApplePayErrorContactField.h in Headers */, 27210 27244 7C6579E31E00827000E3A27A /* ApplePayLineItem.h in Headers */, 27211 27245 A1DF5A861F7EBDF20058A477 /* ApplePayMerchantCapability.h in Headers */, … … 28555 28589 A1DF5A991F7EC8C00058A477 /* JSApplePayContactField.h in Headers */, 28556 28590 A12C59F920360ACB0012236B /* JSApplePayError.h in Headers */, 28591 A1BB85B22159B1A10067E07D /* JSApplePayErrorCode.h in Headers */, 28592 A1BB85B32159B1A10067E07D /* JSApplePayErrorContactField.h in Headers */, 28557 28593 7C6579F01E00856600E3A27A /* JSApplePayLineItem.h in Headers */, 28558 28594 A1DF5A8E1F7EC0020058A477 /* JSApplePayMerchantCapability.h in Headers */, … … 29619 29655 CDF2B0131820540600F2B424 /* MockMediaPlayerMediaSource.h in Headers */, 29620 29656 CDF2B0151820540600F2B424 /* MockMediaSourcePrivate.h in Headers */, 29657 A1BB85A92159B02C0067E07D /* MockPaymentError.h in Headers */, 29621 29658 07D6A4F41BED5F8800174146 /* MockRealtimeAudioSource.h in Headers */, 29622 29659 4A0FFA9E1AAF5E7E0062803B /* MockRealtimeMediaSourceCenter.h in Headers */, … … 31537 31574 A146D3221F99D0EC00D29196 /* JSMockPaymentAddress.cpp in Sources */, 31538 31575 A146D31A1F99BCF800D29196 /* JSMockPaymentCoordinator.cpp in Sources */, 31576 A1BB85B82159B3A40067E07D /* JSMockPaymentError.cpp in Sources */, 31539 31577 427DA71D13735DFA007C57FB /* JSServiceWorkerInternals.cpp in Sources */, 31540 31578 EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */, -
trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp
r235251 r236552 152 152 void MockPaymentCoordinator::completeShippingContactSelection(std::optional<ShippingContactUpdate>&& shippingContactUpdate) 153 153 { 154 if (shippingContactUpdate) 155 updateTotalAndLineItems(shippingContactUpdate->newTotalAndLineItems); 156 } 157 154 if (!shippingContactUpdate) 155 return; 156 157 updateTotalAndLineItems(shippingContactUpdate->newTotalAndLineItems); 158 m_errors = WTFMove(shippingContactUpdate->errors); 159 } 160 158 161 void MockPaymentCoordinator::completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&& paymentMethodUpdate) 159 162 { -
trunk/Source/WebCore/testing/MockPaymentCoordinator.h
r230211 r236552 30 30 #include "ApplePayLineItem.h" 31 31 #include "MockPaymentAddress.h" 32 #include "MockPaymentError.h" 32 33 #include "PaymentCoordinatorClient.h" 33 34 #include <wtf/HashSet.h> … … 51 52 const ApplePayLineItem& total() const { return m_total; } 52 53 const Vector<ApplePayLineItem>& lineItems() const { return m_lineItems; } 54 const Vector<MockPaymentError>& errors() const { return m_errors; } 53 55 54 56 void ref() const { } … … 77 79 ApplePayLineItem m_total; 78 80 Vector<ApplePayLineItem> m_lineItems; 81 Vector<MockPaymentError> m_errors; 79 82 HashSet<String, ASCIICaseInsensitiveHash> m_availablePaymentNetworks; 80 83 }; -
trunk/Source/WebCore/testing/MockPaymentCoordinator.idl
r225849 r236552 1 1 /* 2 * Copyright (C) 2017 Apple Inc. All rights reserved.2 * Copyright (C) 2017-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 readonly attribute ApplePayLineItem total; 37 37 readonly attribute sequence<ApplePayLineItem> lineItems; 38 readonly attribute sequence<MockPaymentError> errors; 38 39 }; -
trunk/Source/WebCore/testing/MockPaymentError.h
r236551 r236552 1 1 /* 2 * Copyright (C) 201 7Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 [ 27 Conditional=PAYMENT_REQUEST 28 ] dictionary PaymentDetailsUpdate : PaymentDetailsBase { 29 DOMString error; 30 PaymentItem total; 31 }; 26 #pragma once 27 28 #if ENABLE(APPLE_PAY) 29 30 #include "ApplePaySessionPaymentRequest.h" 31 32 namespace WebCore { 33 34 using MockPaymentError = PaymentError; 35 36 } // namespace WebCore 37 38 #endif // ENABLE(APPLE_PAY) -
trunk/Source/WebCore/testing/MockPaymentError.idl
r236551 r236552 1 1 /* 2 * Copyright (C) 201 7Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 [ 27 Conditional=PAYMENT_REQUEST 28 ] dictionary PaymentDetailsUpdate : PaymentDetailsBase { 29 DOMString error; 30 PaymentItem total; 27 Conditional=APPLE_PAY, 28 JSGenerateToJSObject, 29 ] dictionary MockPaymentError { 30 required ApplePayErrorCode code; 31 required DOMString message; 32 ApplePayErrorContactField contactField; 31 33 };
Note:
See TracChangeset
for help on using the changeset viewer.