haikuwebkit/Source/WebCore/testing/MockPaymentContactFields.h

45 lines
1.8 KiB
C
Raw Permalink Normal View History

[Payment Request] It should be possible to require a phonetic name for shipping contacts https://bugs.webkit.org/show_bug.cgi?id=194311 <rdar://46733045> Reviewed by Alex Christensen. Source/WebCore: It should be possible to require that a shipping contact has a phonetic name in Payment Request. To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data. Since required shipping contact fields can now be specified both in requiredShippingContactFields and PaymentOptions, we merge the required fields from these two sources such that, e.g., email is required if it is specified in either place. So that clients can detect this new feature, the API version number is bumped from 5 to 6. Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html. * DerivedSources.make: * Modules/applepay/ApplePayPaymentRequest.h: * Modules/applepay/ApplePayPaymentRequest.idl: * Modules/applepay/ApplePayRequestBase.cpp: (WebCore::convertAndValidate): * Modules/applepay/ApplePayRequestBase.h: * Modules/applepay/ApplePayRequestBase.idl: * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): * Modules/applepay/PaymentCoordinatorClient.cpp: Added. (WebCore::PaymentCoordinatorClient::supportsVersion): * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::mergePaymentOptions): (WebCore::ApplePayPaymentHandler::show): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * loader/EmptyClients.cpp: * testing/MockPaymentContactFields.h: Added. (WebCore::MockPaymentContactFields::MockPaymentContactFields): * testing/MockPaymentContactFields.idl: Added. * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::showPaymentUI): (WebCore::MockPaymentCoordinator::supportsVersion): Deleted. * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.idl: Source/WebKit: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::supportsVersion): Deleted. * WebProcess/ApplePay/WebPaymentCoordinator.h: Source/WebKitLegacy/mac: * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::supportsVersion): Deleted. LayoutTests: * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt: * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html: * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt: * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html: * http/tests/ssl/applepay/PaymentRequest.https-expected.txt: * http/tests/ssl/applepay/PaymentRequest.https.html: Canonical link: https://commits.webkit.org/208800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-02-06 23:18:07 +00:00
/*
* Copyright (C) 2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if ENABLE(APPLE_PAY)
#include "ApplePaySessionPaymentRequest.h"
namespace WebCore {
struct MockPaymentContactFields : public ApplePaySessionPaymentRequest::ContactFields {
MockPaymentContactFields() = default;
MockPaymentContactFields(const ApplePaySessionPaymentRequest::ContactFields& contactFields)
: ApplePaySessionPaymentRequest::ContactFields { contactFields }
{
}
};
} // namespace WebCore
#endif // ENABLE(APPLE_PAY)