Title: [220821] trunk/Source
Revision
220821
Author
[email protected]
Date
2017-08-16 18:24:30 -0700 (Wed, 16 Aug 2017)

Log Message

[Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
https://bugs.webkit.org/show_bug.cgi?id=175648

Reviewed by Tim Horton.

Source/WebCore:

The W3C Payment Request API defines an interface called PaymentRequest, which conflicts with
an existing Apple Pay class. This patch renames PaymentRequest to
ApplePaySessionPaymentRequest so that a follow-on patch can introduce PaymentRequest for the
W3C API.

* Modules/applepay/ApplePayError.h:
* Modules/applepay/ApplePayLineItem.h:
* Modules/applepay/ApplePayPaymentRequest.h:
* Modules/applepay/ApplePaySession.cpp:
(WebCore::convertAndValidateTotal):
(WebCore::convertAndValidate):
(WebCore::ApplePaySession::ApplePaySession):
(WebCore::ApplePaySession::didSelectShippingMethod):
* Modules/applepay/ApplePaySession.h:
* Modules/applepay/ApplePaySessionPaymentRequest.cpp: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.cpp.
(WebCore::ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest):
(WebCore::ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest):
(WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork):
* Modules/applepay/ApplePaySessionPaymentRequest.h: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.h.
* Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
(WebCore::convert):
(WebCore::ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent):
* Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
* Modules/applepay/PaymentCoordinator.cpp:
(WebCore::PaymentCoordinator::beginPaymentSession):
(WebCore::PaymentCoordinator::didSelectShippingMethod):
* Modules/applepay/PaymentCoordinator.h:
* Modules/applepay/PaymentCoordinatorClient.h:
* Modules/applepay/PaymentHeaders.h:
* Modules/applepay/PaymentRequestValidator.cpp:
(WebCore::PaymentRequestValidator::validate):
(WebCore::PaymentRequestValidator::validateTotal):
(WebCore::validateMerchantCapabilities):
(WebCore::validateShippingMethod):
(WebCore::validateShippingMethods):
* Modules/applepay/PaymentRequestValidator.h:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:

Source/WebKit:

* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::encode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::decode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::encode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::decode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::MerchantCapabilities>::encode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::MerchantCapabilities>::decode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::encode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::decode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::encode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::decode):
(IPC::ArgumentCoder<PaymentRequest>::encode): Deleted.
(IPC::ArgumentCoder<PaymentRequest>::decode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::ContactFields>::encode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::ContactFields>::decode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::LineItem>::encode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::LineItem>::decode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::MerchantCapabilities>::encode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::MerchantCapabilities>::decode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::ShippingMethod>::encode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::ShippingMethod>::decode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::TotalAndLineItems>::encode): Deleted.
(IPC::ArgumentCoder<PaymentRequest::TotalAndLineItems>::decode): Deleted.
* Shared/WebCoreArgumentCoders.h:
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
(WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod):
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(toShippingMethod):
(WebKit::toPKContactFields):
(WebKit::toPKAddressField):
(WebKit::toPKPaymentSummaryItemType):
(WebKit::toPKPaymentSummaryItem):
(WebKit::toPKPaymentSummaryItems):
(WebKit::toPKMerchantCapabilities):
(WebKit::toPKShippingType):
(WebKit::toPKShippingMethod):
(WebKit::toPKPaymentRequest):
* UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
* UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::WebPaymentCoordinator::showPaymentUI):
(WebKit::WebPaymentCoordinator::didSelectShippingMethod):
* WebProcess/ApplePay/WebPaymentCoordinator.h:
* WebProcess/ApplePay/WebPaymentCoordinator.messages.in:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebPaymentCoordinatorClient.h:
* WebCoreSupport/WebPaymentCoordinatorClient.mm:
(WebPaymentCoordinatorClient::showPaymentUI):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220820 => 220821)


--- trunk/Source/WebCore/ChangeLog	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/ChangeLog	2017-08-17 01:24:30 UTC (rev 220821)
@@ -1,3 +1,49 @@
+2017-08-16  Andy Estes  <[email protected]>
+
+        [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
+        https://bugs.webkit.org/show_bug.cgi?id=175648
+
+        Reviewed by Tim Horton.
+
+        The W3C Payment Request API defines an interface called PaymentRequest, which conflicts with
+        an existing Apple Pay class. This patch renames PaymentRequest to
+        ApplePaySessionPaymentRequest so that a follow-on patch can introduce PaymentRequest for the
+        W3C API.
+
+        * Modules/applepay/ApplePayError.h:
+        * Modules/applepay/ApplePayLineItem.h:
+        * Modules/applepay/ApplePayPaymentRequest.h:
+        * Modules/applepay/ApplePaySession.cpp:
+        (WebCore::convertAndValidateTotal):
+        (WebCore::convertAndValidate):
+        (WebCore::ApplePaySession::ApplePaySession):
+        (WebCore::ApplePaySession::didSelectShippingMethod):
+        * Modules/applepay/ApplePaySession.h:
+        * Modules/applepay/ApplePaySessionPaymentRequest.cpp: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.cpp.
+        (WebCore::ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest):
+        (WebCore::ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest):
+        (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork):
+        * Modules/applepay/ApplePaySessionPaymentRequest.h: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.h.
+        * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
+        (WebCore::convert):
+        (WebCore::ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent):
+        * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
+        * Modules/applepay/PaymentCoordinator.cpp:
+        (WebCore::PaymentCoordinator::beginPaymentSession):
+        (WebCore::PaymentCoordinator::didSelectShippingMethod):
+        * Modules/applepay/PaymentCoordinator.h:
+        * Modules/applepay/PaymentCoordinatorClient.h:
+        * Modules/applepay/PaymentHeaders.h:
+        * Modules/applepay/PaymentRequestValidator.cpp:
+        (WebCore::PaymentRequestValidator::validate):
+        (WebCore::PaymentRequestValidator::validateTotal):
+        (WebCore::validateMerchantCapabilities):
+        (WebCore::validateShippingMethod):
+        (WebCore::validateShippingMethods):
+        * Modules/applepay/PaymentRequestValidator.h:
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/EmptyClients.cpp:
+
 2017-08-16  Chris Dumez  <[email protected]>
 
         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayError.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePayError.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayError.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -27,7 +27,7 @@
 
 #if ENABLE(APPLE_PAY)
 
-#include "PaymentRequest.h"
+#include "ApplePaySessionPaymentRequest.h"
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayLineItem.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePayLineItem.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayLineItem.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -27,12 +27,12 @@
 
 #if ENABLE(APPLE_PAY)
 
-#include "PaymentRequest.h"
+#include "ApplePaySessionPaymentRequest.h"
 
 namespace WebCore {
 
 struct ApplePayLineItem {
-    using Type = PaymentRequest::LineItem::Type;
+    using Type = ApplePaySessionPaymentRequest::LineItem::Type;
 
     Type type { Type::Final };
     String label;

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -29,8 +29,8 @@
 
 #include "ApplePayLineItem.h"
 #include "ApplePayPaymentContact.h"
+#include "ApplePaySessionPaymentRequest.h"
 #include "ApplePayShippingMethod.h"
-#include "PaymentRequest.h"
 
 namespace WebCore {
 
@@ -38,7 +38,7 @@
     enum class MerchantCapability { Supports3DS, SupportsEMV, SupportsCredit, SupportsDebit };
     enum class ContactField { Email, Name, PhoneticName, Phone, PostalAddress };
 
-    using ShippingType = PaymentRequest::ShippingType;
+    using ShippingType = ApplePaySessionPaymentRequest::ShippingType;
 
     Vector<MerchantCapability> merchantCapabilities;
     Vector<String> supportedNetworks;

Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -166,13 +166,13 @@
     return amount;
 }
 
-static ExceptionOr<PaymentRequest::LineItem> convertAndValidateTotal(ApplePayLineItem&& lineItem)
+static ExceptionOr<ApplePaySessionPaymentRequest::LineItem> convertAndValidateTotal(ApplePayLineItem&& lineItem)
 {
     auto amount = parseAmount(lineItem.amount);
     if (!amount)
         return Exception { TypeError, makeString("\"" + lineItem.amount, "\" is not a valid amount.") };
 
-    PaymentRequest::LineItem result;
+    ApplePaySessionPaymentRequest::LineItem result;
     result.amount = *amount;
     result.type = lineItem.type;
     result.label = lineItem.label;
@@ -180,12 +180,12 @@
     return WTFMove(result);
 }
 
-static ExceptionOr<PaymentRequest::LineItem> convertAndValidate(ApplePayLineItem&& lineItem)
+static ExceptionOr<ApplePaySessionPaymentRequest::LineItem> convertAndValidate(ApplePayLineItem&& lineItem)
 {
-    PaymentRequest::LineItem result;
+    ApplePaySessionPaymentRequest::LineItem result;
 
     // It is OK for pending types to not have an amount.
-    if (lineItem.type != PaymentRequest::LineItem::Type::Pending) {
+    if (lineItem.type != ApplePaySessionPaymentRequest::LineItem::Type::Pending) {
         auto amount = parseAmount(lineItem.amount);
         if (!amount)
             return Exception { TypeError, makeString("\"" + lineItem.amount, "\" is not a valid amount.") };
@@ -199,9 +199,9 @@
     return WTFMove(result);
 }
 
-static ExceptionOr<Vector<PaymentRequest::LineItem>> convertAndValidate(std::optional<Vector<ApplePayLineItem>>&& lineItems)
+static ExceptionOr<Vector<ApplePaySessionPaymentRequest::LineItem>> convertAndValidate(std::optional<Vector<ApplePayLineItem>>&& lineItems)
 {
-    Vector<PaymentRequest::LineItem> result;
+    Vector<ApplePaySessionPaymentRequest::LineItem> result;
     if (!lineItems)
         return WTFMove(result);
 
@@ -217,12 +217,12 @@
     return WTFMove(result);
 }
 
-static ExceptionOr<PaymentRequest::MerchantCapabilities> convertAndValidate(Vector<ApplePayPaymentRequest::MerchantCapability>&& merchantCapabilities)
+static ExceptionOr<ApplePaySessionPaymentRequest::MerchantCapabilities> convertAndValidate(Vector<ApplePayPaymentRequest::MerchantCapability>&& merchantCapabilities)
 {
     if (merchantCapabilities.isEmpty())
         return Exception { TypeError, "At least one merchant capability must be provided." };
 
-    PaymentRequest::MerchantCapabilities result;
+    ApplePaySessionPaymentRequest::MerchantCapabilities result;
 
     for (auto& merchantCapability : merchantCapabilities) {
         switch (merchantCapability) {
@@ -250,7 +250,7 @@
         return Exception { TypeError, "At least one supported network must be provided." };
 
     for (auto& supportedNetwork : supportedNetworks) {
-        if (!PaymentRequest::isValidSupportedNetwork(version, supportedNetwork))
+        if (!ApplePaySessionPaymentRequest::isValidSupportedNetwork(version, supportedNetwork))
             return Exception { TypeError, makeString("\"" + supportedNetwork, "\" is not a valid payment network.") };
     }
 
@@ -257,9 +257,9 @@
     return WTFMove(supportedNetworks);
 }
 
-static ExceptionOr<PaymentRequest::ContactFields> convertAndValidate(unsigned version, Vector<ApplePayPaymentRequest::ContactField>&& contactFields)
+static ExceptionOr<ApplePaySessionPaymentRequest::ContactFields> convertAndValidate(unsigned version, Vector<ApplePayPaymentRequest::ContactField>&& contactFields)
 {
-    PaymentRequest::ContactFields result;
+    ApplePaySessionPaymentRequest::ContactFields result;
 
     for (auto& contactField : contactFields) {
         switch (contactField) {
@@ -286,13 +286,13 @@
     return WTFMove(result);
 }
 
-static ExceptionOr<PaymentRequest::ShippingMethod> convertAndValidate(ApplePayShippingMethod&& shippingMethod)
+static ExceptionOr<ApplePaySessionPaymentRequest::ShippingMethod> convertAndValidate(ApplePayShippingMethod&& shippingMethod)
 {
     auto amount = parseAmount(shippingMethod.amount);
     if (!amount)
         return Exception { TypeError, makeString("\"" + shippingMethod.amount, "\" is not a valid amount.") };
 
-    PaymentRequest::ShippingMethod result;
+    ApplePaySessionPaymentRequest::ShippingMethod result;
     result.amount = *amount;
     result.label = shippingMethod.label;
     result.detail = shippingMethod.detail;
@@ -301,9 +301,9 @@
     return WTFMove(result);
 }
 
-static ExceptionOr<Vector<PaymentRequest::ShippingMethod>> convertAndValidate(Vector<ApplePayShippingMethod>&& shippingMethods)
+static ExceptionOr<Vector<ApplePaySessionPaymentRequest::ShippingMethod>> convertAndValidate(Vector<ApplePayShippingMethod>&& shippingMethods)
 {
-    Vector<PaymentRequest::ShippingMethod> result;
+    Vector<ApplePaySessionPaymentRequest::ShippingMethod> result;
     result.reserveInitialCapacity(shippingMethods.size());
     
     for (auto& shippingMethod : shippingMethods) {
@@ -316,9 +316,9 @@
     return WTFMove(result);
 }
 
-static ExceptionOr<PaymentRequest> convertAndValidate(unsigned version, ApplePayPaymentRequest&& paymentRequest)
+static ExceptionOr<ApplePaySessionPaymentRequest> convertAndValidate(unsigned version, ApplePayPaymentRequest&& paymentRequest)
 {
-    PaymentRequest result;
+    ApplePaySessionPaymentRequest result;
 
     auto total = convertAndValidateTotal(WTFMove(paymentRequest.total));
     if (total.hasException())
@@ -587,7 +587,7 @@
     return adoptRef(*new ApplePaySession(document, convertedPaymentRequest.releaseReturnValue()));
 }
 
-ApplePaySession::ApplePaySession(Document& document, PaymentRequest&& paymentRequest)
+ApplePaySession::ApplePaySession(Document& document, ApplePaySessionPaymentRequest&& paymentRequest)
     : ActiveDOMObject(&document)
     , m_paymentRequest(WTFMove(paymentRequest))
 {
@@ -936,7 +936,7 @@
     dispatchEvent(event.get());
 }
 
-void ApplePaySession::didSelectShippingMethod(const PaymentRequest::ShippingMethod& shippingMethod)
+void ApplePaySession::didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     ASSERT(m_state == State::Active);
 

Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -90,11 +90,11 @@
     ExceptionOr<void> completePaymentMethodSelection(ApplePayLineItem&& newTotal, Vector<ApplePayLineItem>&& newLineItems);
     ExceptionOr<void> completePayment(unsigned short status);
 
-    const PaymentRequest& paymentRequest() const { return m_paymentRequest; }
+    const ApplePaySessionPaymentRequest& paymentRequest() const { return m_paymentRequest; }
 
     void validateMerchant(const URL&);
     void didAuthorizePayment(const Payment&);
-    void didSelectShippingMethod(const PaymentRequest::ShippingMethod&);
+    void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&);
     void didSelectShippingContact(const PaymentContact&);
     void didSelectPaymentMethod(const PaymentMethod&);
     void didCancelPaymentSession();
@@ -103,7 +103,7 @@
     using RefCounted<ApplePaySession>::deref;
 
 private:
-    ApplePaySession(Document&, PaymentRequest&&);
+    ApplePaySession(Document&, ApplePaySessionPaymentRequest&&);
 
     // ActiveDOMObject.
     const char* activeDOMObjectName() const override;
@@ -151,7 +151,7 @@
         ValidationComplete,
     } m_merchantValidationState { MerchantValidationState::Idle };
 
-    const PaymentRequest m_paymentRequest;
+    const ApplePaySessionPaymentRequest m_paymentRequest;
 };
 
 }

Copied: trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp (from rev 220820, trunk/Source/WebCore/Modules/applepay/PaymentRequest.cpp) (0 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2015-2017 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.
+ */
+
+#include "config.h"
+#include "ApplePaySessionPaymentRequest.h"
+
+#if ENABLE(APPLE_PAY)
+
+#include "PaymentAuthorizationStatus.h"
+#include <wtf/SoftLinking.h>
+
+namespace WebCore {
+
+ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest()
+{
+}
+
+ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest()
+{
+}
+
+bool ApplePaySessionPaymentRequest::isValidSupportedNetwork(unsigned version, const String& supportedNetwork)
+{
+    if (supportedNetwork == "amex")
+        return true;
+    if (supportedNetwork == "chinaUnionPay")
+        return true;
+    if (supportedNetwork == "discover")
+        return true;
+    if (supportedNetwork == "interac")
+        return true;
+    if (supportedNetwork == "masterCard")
+        return true;
+    if (supportedNetwork == "privateLabel")
+        return true;
+    if (supportedNetwork == "visa")
+        return true;
+    if (version >= 2 && supportedNetwork == "jcb")
+        return true;
+    if (version >= 3 && supportedNetwork == "carteBancaire")
+        return true;
+
+    return false;
+}
+
+bool isFinalStateResult(const std::optional<PaymentAuthorizationResult>& result)
+{
+    if (!result)
+        return true;
+
+    switch (result->status) {
+    case PaymentAuthorizationStatus::Success:
+        return true;
+
+    case PaymentAuthorizationStatus::PINRequired:
+    case PaymentAuthorizationStatus::PINIncorrect:
+    case PaymentAuthorizationStatus::PINLockout:
+        return false;
+
+    case PaymentAuthorizationStatus::Failure:
+        if (result->errors.isEmpty())
+            return true;
+
+        for (auto& error : result->errors) {
+            if (error.code == PaymentError::Code::Unknown)
+                return true;
+        }
+        return false;
+    }
+}
+
+}
+
+#endif

Copied: trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h (from rev 220820, trunk/Source/WebCore/Modules/applepay/PaymentRequest.h) (0 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2015-2017 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 "PaymentContact.h"
+#include <wtf/EnumTraits.h>
+#include <wtf/Optional.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+enum class PaymentAuthorizationStatus;
+
+class ApplePaySessionPaymentRequest {
+public:
+    WEBCORE_EXPORT ApplePaySessionPaymentRequest();
+    WEBCORE_EXPORT ~ApplePaySessionPaymentRequest();
+
+    const String& countryCode() const { return m_countryCode; }
+    void setCountryCode(const String& countryCode) { m_countryCode = countryCode; }
+
+    const String& currencyCode() const { return m_currencyCode; }
+    void setCurrencyCode(const String& currencyCode) { m_currencyCode = currencyCode; }
+
+    struct ContactFields {
+        bool postalAddress { false };
+        bool phone { false };
+        bool email { false };
+        bool name { false };
+        bool phoneticName { false };
+    };
+
+    const ContactFields& requiredBillingContactFields() const { return m_requiredBillingContactFields; }
+    void setRequiredBillingContactFields(const ContactFields& requiredBillingContactFields) { m_requiredBillingContactFields = requiredBillingContactFields; }
+
+    const PaymentContact& billingContact() const { return m_billingContact; }
+    void setBillingContact(const PaymentContact& billingContact) { m_billingContact = billingContact; }
+
+    const ContactFields& requiredShippingContactFields() const { return m_requiredShippingContactFields; }
+    void setRequiredShippingContactFields(const ContactFields& requiredShippingContactFields) { m_requiredShippingContactFields = requiredShippingContactFields; }
+
+    const PaymentContact& shippingContact() const { return m_shippingContact; }
+    void setShippingContact(const PaymentContact& shippingContact) { m_shippingContact = shippingContact; }
+
+    static bool isValidSupportedNetwork(unsigned version, const String&);
+
+    const Vector<String>& supportedNetworks() const { return m_supportedNetworks; }
+    void setSupportedNetworks(const Vector<String>& supportedNetworks) { m_supportedNetworks = supportedNetworks; }
+
+    struct MerchantCapabilities {
+        bool supports3DS { false };
+        bool supportsEMV { false };
+        bool supportsCredit { false };
+        bool supportsDebit { false };
+    };
+
+    const MerchantCapabilities& merchantCapabilities() const { return m_merchantCapabilities; }
+    void setMerchantCapabilities(const MerchantCapabilities& merchantCapabilities) { m_merchantCapabilities = merchantCapabilities; }
+
+    struct LineItem {
+        enum class Type {
+            Pending,
+            Final,
+        } type { Type::Final };
+
+        // Stored as a fixed point decimal number with two decimals:
+        // 1.23 -> 123.
+        // 0.01 -> 1.
+        std::optional<int64_t> amount;
+        String label;
+    };
+
+    enum class ShippingType {
+        Shipping,
+        Delivery,
+        StorePickup,
+        ServicePickup,
+    };
+    ShippingType shippingType() const { return m_shippingType; }
+    void setShippingType(ShippingType shippingType) { m_shippingType = shippingType; }
+
+    struct ShippingMethod {
+        String label;
+        String detail;
+        int64_t amount;
+
+        String identifier;
+    };
+    const Vector<ShippingMethod>& shippingMethods() const { return m_shippingMethods; }
+    void setShippingMethods(const Vector<ShippingMethod>& shippingMethods) { m_shippingMethods = shippingMethods; }
+
+    const Vector<LineItem>& lineItems() const { return m_lineItems; }
+    void setLineItems(const Vector<LineItem>& lineItems) { m_lineItems = lineItems; }
+
+    const LineItem& total() const { return m_total; };
+    void setTotal(const LineItem& total) { m_total = total; }
+
+    struct TotalAndLineItems {
+        ApplePaySessionPaymentRequest::LineItem total;
+        Vector<ApplePaySessionPaymentRequest::LineItem> lineItems;
+    };
+
+    const String& applicationData() const { return m_applicationData; }
+    void setApplicationData(const String& applicationData) { m_applicationData = applicationData; }
+
+    const Vector<String>& supportedCountries() const { return m_supportedCountries; }
+    void setSupportedCountries(Vector<String>&& supportedCountries) { m_supportedCountries = WTFMove(supportedCountries); }
+
+private:
+    String m_countryCode;
+    String m_currencyCode;
+
+    ContactFields m_requiredBillingContactFields;
+    PaymentContact m_billingContact;
+
+    ContactFields m_requiredShippingContactFields;
+    PaymentContact m_shippingContact;
+
+    Vector<String> m_supportedNetworks;
+    MerchantCapabilities m_merchantCapabilities;
+
+    ShippingType m_shippingType { ShippingType::Shipping };
+    Vector<ShippingMethod> m_shippingMethods;
+
+    Vector<LineItem> m_lineItems;
+    LineItem m_total;
+
+    String m_applicationData;
+    Vector<String> m_supportedCountries;
+};
+
+struct PaymentError {
+    enum class Code {
+        Unknown,
+        ShippingContactInvalid,
+        BillingContactInvalid,
+        AddressUnserviceable,
+    };
+
+    enum class ContactField {
+        PhoneNumber,
+        EmailAddress,
+        Name,
+        PhoneticName,
+        PostalAddress,
+        AddressLines,
+        Locality,
+        PostalCode,
+        AdministrativeArea,
+        Country,
+        CountryCode,
+    };
+
+    Code code;
+    String message;
+    std::optional<ContactField> contactField;
+};
+
+struct PaymentAuthorizationResult {
+    PaymentAuthorizationStatus status;
+    Vector<PaymentError> errors;
+};
+
+struct PaymentMethodUpdate {
+    ApplePaySessionPaymentRequest::TotalAndLineItems newTotalAndLineItems;
+};
+
+struct ShippingContactUpdate {
+    Vector<PaymentError> errors;
+
+    Vector<ApplePaySessionPaymentRequest::ShippingMethod> newShippingMethods;
+    ApplePaySessionPaymentRequest::TotalAndLineItems newTotalAndLineItems;
+};
+
+struct ShippingMethodUpdate {
+    ApplePaySessionPaymentRequest::TotalAndLineItems newTotalAndLineItems;
+};
+
+WEBCORE_EXPORT bool isFinalStateResult(const std::optional<PaymentAuthorizationResult>&);
+
+}
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::PaymentError::Code> {
+    using values = EnumValues<
+        WebCore::PaymentError::Code,
+        WebCore::PaymentError::Code::Unknown,
+        WebCore::PaymentError::Code::ShippingContactInvalid,
+        WebCore::PaymentError::Code::BillingContactInvalid,
+        WebCore::PaymentError::Code::AddressUnserviceable
+    >;
+};
+
+template<> struct EnumTraits<WebCore::PaymentError::ContactField> {
+    using values = EnumValues<
+        WebCore::PaymentError::ContactField,
+        WebCore::PaymentError::ContactField::PhoneNumber,
+        WebCore::PaymentError::ContactField::EmailAddress,
+        WebCore::PaymentError::ContactField::Name,
+        WebCore::PaymentError::ContactField::PostalAddress,
+        WebCore::PaymentError::ContactField::AddressLines,
+        WebCore::PaymentError::ContactField::Locality,
+        WebCore::PaymentError::ContactField::PostalCode,
+        WebCore::PaymentError::ContactField::AdministrativeArea,
+        WebCore::PaymentError::ContactField::Country,
+        WebCore::PaymentError::ContactField::CountryCode
+    >;
+};
+
+}
+
+#endif

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -46,7 +46,7 @@
     return amountString.toString();
 }
 
-static inline ApplePayShippingMethod convert(const PaymentRequest::ShippingMethod& shippingMethod)
+static inline ApplePayShippingMethod convert(const ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     ApplePayShippingMethod convertedMethod;
     convertedMethod.label = shippingMethod.label;
@@ -57,7 +57,7 @@
     return convertedMethod; 
 }
 
-ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent(const AtomicString& type, const PaymentRequest::ShippingMethod& shippingMethod)
+ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent(const AtomicString& type, const ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
     : Event(type, false, false)
     , m_shippingMethod(convert(shippingMethod))
 {

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodSelectedEvent.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodSelectedEvent.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodSelectedEvent.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -27,15 +27,15 @@
 
 #if ENABLE(APPLE_PAY)
 
+#include "ApplePaySessionPaymentRequest.h"
 #include "ApplePayShippingMethod.h"
 #include "Event.h"
-#include "PaymentRequest.h"
 
 namespace WebCore {
 
 class ApplePayShippingMethodSelectedEvent final : public Event {
 public:
-    static Ref<ApplePayShippingMethodSelectedEvent> create(const AtomicString& type, const PaymentRequest::ShippingMethod& shippingMethod)
+    static Ref<ApplePayShippingMethodSelectedEvent> create(const AtomicString& type, const ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
     {
         return adoptRef(*new ApplePayShippingMethodSelectedEvent(type, shippingMethod));
     }
@@ -45,7 +45,7 @@
     const ApplePayShippingMethod& shippingMethod() const { return m_shippingMethod; }
 
 private:
-    ApplePayShippingMethodSelectedEvent(const AtomicString& type, const PaymentRequest::ShippingMethod&);
+    ApplePayShippingMethodSelectedEvent(const AtomicString& type, const ApplePaySessionPaymentRequest::ShippingMethod&);
 
     // Event.
     EventInterface eventInterface() const override;

Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -65,7 +65,7 @@
     m_client.openPaymentSetup(merchantIdentifier, domainName, WTFMove(completionHandler));
 }
 
-bool PaymentCoordinator::beginPaymentSession(ApplePaySession& paymentSession, const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest& paymentRequest)
+bool PaymentCoordinator::beginPaymentSession(ApplePaySession& paymentSession, const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest& paymentRequest)
 {
     ASSERT(!m_activeSession);
 
@@ -163,7 +163,7 @@
     m_activeSession->didSelectPaymentMethod(paymentMethod);
 }
 
-void PaymentCoordinator::didSelectShippingMethod(const PaymentRequest::ShippingMethod& shippingMethod)
+void PaymentCoordinator::didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     if (!m_activeSession) {
         // It's possible that the payment has been aborted already.

Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -27,7 +27,7 @@
 
 #if ENABLE(APPLE_PAY)
 
-#include "PaymentRequest.h"
+#include "ApplePaySessionPaymentRequest.h"
 #include <wtf/Function.h>
 
 namespace WebCore {
@@ -57,7 +57,7 @@
 
     bool hasActiveSession() const { return m_activeSession; }
 
-    bool beginPaymentSession(ApplePaySession&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&);
+    bool beginPaymentSession(ApplePaySession&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest&);
     void completeMerchantValidation(const PaymentMerchantSession&);
     void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&);
     void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&);
@@ -69,7 +69,7 @@
     WEBCORE_EXPORT void validateMerchant(const URL& validationURL);
     WEBCORE_EXPORT void didAuthorizePayment(const Payment&);
     WEBCORE_EXPORT void didSelectPaymentMethod(const PaymentMethod&);
-    WEBCORE_EXPORT void didSelectShippingMethod(const PaymentRequest::ShippingMethod&);
+    WEBCORE_EXPORT void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&);
     WEBCORE_EXPORT void didSelectShippingContact(const PaymentContact&);
     WEBCORE_EXPORT void didCancelPaymentSession();
 

Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -27,7 +27,7 @@
 
 #if ENABLE(APPLE_PAY)
 
-#include "PaymentRequest.h"
+#include "ApplePaySessionPaymentRequest.h"
 #include <wtf/Forward.h>
 #include <wtf/Function.h>
 
@@ -47,7 +47,7 @@
     virtual void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) = 0;
     virtual void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) = 0;
 
-    virtual bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&) = 0;
+    virtual bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest&) = 0;
     virtual void completeMerchantValidation(const PaymentMerchantSession&) = 0;
     virtual void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) = 0;
     virtual void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) = 0;

Modified: trunk/Source/WebCore/Modules/applepay/PaymentHeaders.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/PaymentHeaders.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/PaymentHeaders.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -25,9 +25,9 @@
 
 #pragma once
 
+#include "ApplePaySessionPaymentRequest.h"
 #include "Payment.h"
 #include "PaymentContact.h"
 #include "PaymentMerchantSession.h"
 #include "PaymentMethod.h"
-#include "PaymentRequest.h"
 

Deleted: trunk/Source/WebCore/Modules/applepay/PaymentRequest.cpp (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/PaymentRequest.cpp	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/PaymentRequest.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2015, 2016 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.
- */
-
-#include "config.h"
-#include "PaymentRequest.h"
-
-#if ENABLE(APPLE_PAY)
-
-#include "PaymentAuthorizationStatus.h"
-#include <wtf/SoftLinking.h>
-
-namespace WebCore {
-
-PaymentRequest::PaymentRequest()
-{
-}
-
-PaymentRequest::~PaymentRequest()
-{
-}
-
-bool PaymentRequest::isValidSupportedNetwork(unsigned version, const String& supportedNetwork)
-{
-    if (supportedNetwork == "amex")
-        return true;
-    if (supportedNetwork == "chinaUnionPay")
-        return true;
-    if (supportedNetwork == "discover")
-        return true;
-    if (supportedNetwork == "interac")
-        return true;
-    if (supportedNetwork == "masterCard")
-        return true;
-    if (supportedNetwork == "privateLabel")
-        return true;
-    if (supportedNetwork == "visa")
-        return true;
-    if (version >= 2 && supportedNetwork == "jcb")
-        return true;
-    if (version >= 3 && supportedNetwork == "carteBancaire")
-        return true;
-
-    return false;
-}
-
-bool isFinalStateResult(const std::optional<PaymentAuthorizationResult>& result)
-{
-    if (!result)
-        return true;
-
-    switch (result->status) {
-    case PaymentAuthorizationStatus::Success:
-        return true;
-
-    case PaymentAuthorizationStatus::PINRequired:
-    case PaymentAuthorizationStatus::PINIncorrect:
-    case PaymentAuthorizationStatus::PINLockout:
-        return false;
-
-    case PaymentAuthorizationStatus::Failure:
-        if (result->errors.isEmpty())
-            return true;
-
-        for (auto& error : result->errors) {
-            if (error.code == PaymentError::Code::Unknown)
-                return true;
-        }
-        return false;
-    }
-}
-
-}
-
-#endif

Deleted: trunk/Source/WebCore/Modules/applepay/PaymentRequest.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/PaymentRequest.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/PaymentRequest.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2015-2017 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 "PaymentContact.h"
-#include <wtf/EnumTraits.h>
-#include <wtf/Optional.h>
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-enum class PaymentAuthorizationStatus;
-
-class PaymentRequest {
-public:
-    WEBCORE_EXPORT PaymentRequest();
-    WEBCORE_EXPORT ~PaymentRequest();
-
-    const String& countryCode() const { return m_countryCode; }
-    void setCountryCode(const String& countryCode) { m_countryCode = countryCode; }
-
-    const String& currencyCode() const { return m_currencyCode; }
-    void setCurrencyCode(const String& currencyCode) { m_currencyCode = currencyCode; }
-
-    struct ContactFields {
-        bool postalAddress { false };
-        bool phone { false };
-        bool email { false };
-        bool name { false };
-        bool phoneticName { false };
-    };
-
-    const ContactFields& requiredBillingContactFields() const { return m_requiredBillingContactFields; }
-    void setRequiredBillingContactFields(const ContactFields& requiredBillingContactFields) { m_requiredBillingContactFields = requiredBillingContactFields; }
-
-    const PaymentContact& billingContact() const { return m_billingContact; }
-    void setBillingContact(const PaymentContact& billingContact) { m_billingContact = billingContact; }
-
-    const ContactFields& requiredShippingContactFields() const { return m_requiredShippingContactFields; }
-    void setRequiredShippingContactFields(const ContactFields& requiredShippingContactFields) { m_requiredShippingContactFields = requiredShippingContactFields; }
-
-    const PaymentContact& shippingContact() const { return m_shippingContact; }
-    void setShippingContact(const PaymentContact& shippingContact) { m_shippingContact = shippingContact; }
-
-    static bool isValidSupportedNetwork(unsigned version, const String&);
-
-    const Vector<String>& supportedNetworks() const { return m_supportedNetworks; }
-    void setSupportedNetworks(const Vector<String>& supportedNetworks) { m_supportedNetworks = supportedNetworks; }
-
-    struct MerchantCapabilities {
-        bool supports3DS { false };
-        bool supportsEMV { false };
-        bool supportsCredit { false };
-        bool supportsDebit { false };
-    };
-
-    const MerchantCapabilities& merchantCapabilities() const { return m_merchantCapabilities; }
-    void setMerchantCapabilities(const MerchantCapabilities& merchantCapabilities) { m_merchantCapabilities = merchantCapabilities; }
-
-    struct LineItem {
-        enum class Type {
-            Pending,
-            Final,
-        } type { Type::Final };
-
-        // Stored as a fixed point decimal number with two decimals:
-        // 1.23 -> 123.
-        // 0.01 -> 1.
-        std::optional<int64_t> amount;
-        String label;
-    };
-
-    enum class ShippingType {
-        Shipping,
-        Delivery,
-        StorePickup,
-        ServicePickup,
-    };
-    ShippingType shippingType() const { return m_shippingType; }
-    void setShippingType(ShippingType shippingType) { m_shippingType = shippingType; }
-
-    struct ShippingMethod {
-        String label;
-        String detail;
-        int64_t amount;
-
-        String identifier;
-    };
-    const Vector<ShippingMethod>& shippingMethods() const { return m_shippingMethods; }
-    void setShippingMethods(const Vector<ShippingMethod>& shippingMethods) { m_shippingMethods = shippingMethods; }
-
-    const Vector<LineItem>& lineItems() const { return m_lineItems; }
-    void setLineItems(const Vector<LineItem>& lineItems) { m_lineItems = lineItems; }
-
-    const LineItem& total() const { return m_total; };
-    void setTotal(const LineItem& total) { m_total = total; }
-
-    struct TotalAndLineItems {
-        PaymentRequest::LineItem total;
-        Vector<PaymentRequest::LineItem> lineItems;
-    };
-
-    const String& applicationData() const { return m_applicationData; }
-    void setApplicationData(const String& applicationData) { m_applicationData = applicationData; }
-
-    const Vector<String>& supportedCountries() const { return m_supportedCountries; }
-    void setSupportedCountries(Vector<String>&& supportedCountries) { m_supportedCountries = WTFMove(supportedCountries); }
-
-private:
-    String m_countryCode;
-    String m_currencyCode;
-
-    ContactFields m_requiredBillingContactFields;
-    PaymentContact m_billingContact;
-
-    ContactFields m_requiredShippingContactFields;
-    PaymentContact m_shippingContact;
-
-    Vector<String> m_supportedNetworks;
-    MerchantCapabilities m_merchantCapabilities;
-
-    ShippingType m_shippingType { ShippingType::Shipping };
-    Vector<ShippingMethod> m_shippingMethods;
-
-    Vector<LineItem> m_lineItems;
-    LineItem m_total;
-
-    String m_applicationData;
-    Vector<String> m_supportedCountries;
-};
-
-struct PaymentError {
-    enum class Code {
-        Unknown,
-        ShippingContactInvalid,
-        BillingContactInvalid,
-        AddressUnserviceable,
-    };
-
-    enum class ContactField {
-        PhoneNumber,
-        EmailAddress,
-        Name,
-        PhoneticName,
-        PostalAddress,
-        AddressLines,
-        Locality,
-        PostalCode,
-        AdministrativeArea,
-        Country,
-        CountryCode,
-    };
-
-    Code code;
-    String message;
-    std::optional<ContactField> contactField;
-};
-
-struct PaymentAuthorizationResult {
-    PaymentAuthorizationStatus status;
-    Vector<PaymentError> errors;
-};
-
-struct PaymentMethodUpdate {
-    PaymentRequest::TotalAndLineItems newTotalAndLineItems;
-};
-
-struct ShippingContactUpdate {
-    Vector<PaymentError> errors;
-
-    Vector<PaymentRequest::ShippingMethod> newShippingMethods;
-    PaymentRequest::TotalAndLineItems newTotalAndLineItems;
-};
-
-struct ShippingMethodUpdate {
-    PaymentRequest::TotalAndLineItems newTotalAndLineItems;
-};
-
-WEBCORE_EXPORT bool isFinalStateResult(const std::optional<PaymentAuthorizationResult>&);
-
-}
-
-namespace WTF {
-
-template<> struct EnumTraits<WebCore::PaymentError::Code> {
-    using values = EnumValues<
-        WebCore::PaymentError::Code,
-        WebCore::PaymentError::Code::Unknown,
-        WebCore::PaymentError::Code::ShippingContactInvalid,
-        WebCore::PaymentError::Code::BillingContactInvalid,
-        WebCore::PaymentError::Code::AddressUnserviceable
-    >;
-};
-
-template<> struct EnumTraits<WebCore::PaymentError::ContactField> {
-    using values = EnumValues<
-        WebCore::PaymentError::ContactField,
-        WebCore::PaymentError::ContactField::PhoneNumber,
-        WebCore::PaymentError::ContactField::EmailAddress,
-        WebCore::PaymentError::ContactField::Name,
-        WebCore::PaymentError::ContactField::PostalAddress,
-        WebCore::PaymentError::ContactField::AddressLines,
-        WebCore::PaymentError::ContactField::Locality,
-        WebCore::PaymentError::ContactField::PostalCode,
-        WebCore::PaymentError::ContactField::AdministrativeArea,
-        WebCore::PaymentError::ContactField::Country,
-        WebCore::PaymentError::ContactField::CountryCode
-    >;
-};
-
-}
-
-#endif

Modified: trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.cpp (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.cpp	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -28,7 +28,7 @@
 
 #if ENABLE(APPLE_PAY)
 
-#include "PaymentRequest.h"
+#include "ApplePaySessionPaymentRequest.h"
 #include <unicode/ucurr.h>
 #include <unicode/uloc.h>
 
@@ -36,13 +36,13 @@
 
 static ExceptionOr<void> validateCountryCode(const String&);
 static ExceptionOr<void> validateCurrencyCode(const String&);
-static ExceptionOr<void> validateMerchantCapabilities(const PaymentRequest::MerchantCapabilities&);
+static ExceptionOr<void> validateMerchantCapabilities(const ApplePaySessionPaymentRequest::MerchantCapabilities&);
 static ExceptionOr<void> validateSupportedNetworks(const Vector<String>&);
-static ExceptionOr<void> validateShippingMethods(const Vector<PaymentRequest::ShippingMethod>&);
-static ExceptionOr<void> validateShippingMethod(const PaymentRequest::ShippingMethod&);
+static ExceptionOr<void> validateShippingMethods(const Vector<ApplePaySessionPaymentRequest::ShippingMethod>&);
+static ExceptionOr<void> validateShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&);
 
 
-ExceptionOr<void> PaymentRequestValidator::validate(const PaymentRequest& paymentRequest)
+ExceptionOr<void> PaymentRequestValidator::validate(const ApplePaySessionPaymentRequest& paymentRequest)
 {
     auto validatedCountryCode = validateCountryCode(paymentRequest.countryCode());
     if (validatedCountryCode.hasException())
@@ -77,7 +77,7 @@
     return { };
 }
 
-ExceptionOr<void> PaymentRequestValidator::validateTotal(const PaymentRequest::LineItem& total)
+ExceptionOr<void> PaymentRequestValidator::validateTotal(const ApplePaySessionPaymentRequest::LineItem& total)
 {
     if (!total.label)
         return Exception { TypeError, "Missing total label." };
@@ -124,7 +124,7 @@
     return Exception { TypeError, makeString("\"" + currencyCode, "\" is not a valid currency code.") };
 }
 
-static ExceptionOr<void> validateMerchantCapabilities(const PaymentRequest::MerchantCapabilities& merchantCapabilities)
+static ExceptionOr<void> validateMerchantCapabilities(const ApplePaySessionPaymentRequest::MerchantCapabilities& merchantCapabilities)
 {
     if (!merchantCapabilities.supports3DS && !merchantCapabilities.supportsEMV && !merchantCapabilities.supportsCredit && !merchantCapabilities.supportsDebit)
         return Exception { TypeError, "Missing merchant capabilities." };
@@ -140,7 +140,7 @@
     return { };
 }
 
-static ExceptionOr<void> validateShippingMethod(const PaymentRequest::ShippingMethod& shippingMethod)
+static ExceptionOr<void> validateShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     if (shippingMethod.amount < 0)
         return Exception { TypeError, "Shipping method amount must be greater than or equal to zero." };
@@ -148,7 +148,7 @@
     return { };
 }
 
-static ExceptionOr<void> validateShippingMethods(const Vector<PaymentRequest::ShippingMethod>& shippingMethods)
+static ExceptionOr<void> validateShippingMethods(const Vector<ApplePaySessionPaymentRequest::ShippingMethod>& shippingMethods)
 {
     for (const auto& shippingMethod : shippingMethods) {
         auto validatedShippingMethod = validateShippingMethod(shippingMethod);

Modified: trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.h (220820 => 220821)


--- trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -27,15 +27,15 @@
 
 #if ENABLE(APPLE_PAY)
 
+#include "ApplePaySessionPaymentRequest.h"
 #include "ExceptionOr.h"
-#include "PaymentRequest.h"
 
 namespace WebCore {
 
 class PaymentRequestValidator {
 public:
-    static ExceptionOr<void> validate(const PaymentRequest&);
-    static ExceptionOr<void> validateTotal(const PaymentRequest::LineItem&);
+    static ExceptionOr<void> validate(const ApplePaySessionPaymentRequest&);
+    static ExceptionOr<void> validateTotal(const ApplePaySessionPaymentRequest::LineItem&);
 };
 
 }

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (220820 => 220821)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-08-17 01:24:30 UTC (rev 220821)
@@ -760,9 +760,9 @@
 		1A569D230D7E2B82007C3983 /* runtime_object.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CF40D7E2B82007C3983 /* runtime_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1A569D240D7E2B82007C3983 /* runtime_root.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CF50D7E2B82007C3983 /* runtime_root.cpp */; };
 		1A569D250D7E2B82007C3983 /* runtime_root.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CF60D7E2B82007C3983 /* runtime_root.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		1A58E8651D19D4EB00C0EA73 /* PaymentRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A58E8641D19D4DF00C0EA73 /* PaymentRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		1A58E8651D19D4EB00C0EA73 /* ApplePaySessionPaymentRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A58E8641D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1A58E8661D19D4F000C0EA73 /* PaymentCoordinatorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A58E8621D19D3BF00C0EA73 /* PaymentCoordinatorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		1A58E8671D19D80E00C0EA73 /* PaymentRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A58E8631D19D4DF00C0EA73 /* PaymentRequest.cpp */; };
+		1A58E8671D19D80E00C0EA73 /* ApplePaySessionPaymentRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A58E8631D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.cpp */; };
 		1A58E86D1D19E42D00C0EA73 /* PaymentCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A58E86B1D19E42D00C0EA73 /* PaymentCoordinator.cpp */; };
 		1A58E86E1D19E42D00C0EA73 /* PaymentCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A58E86C1D19E42D00C0EA73 /* PaymentCoordinator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1A71D57B0F33819000F9CE4E /* IdentifierRep.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A71D5790F33819000F9CE4E /* IdentifierRep.cpp */; };
@@ -8216,8 +8216,8 @@
 		1A569CF50D7E2B82007C3983 /* runtime_root.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = runtime_root.cpp; sourceTree = "<group>"; };
 		1A569CF60D7E2B82007C3983 /* runtime_root.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = runtime_root.h; sourceTree = "<group>"; };
 		1A58E8621D19D3BF00C0EA73 /* PaymentCoordinatorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentCoordinatorClient.h; sourceTree = "<group>"; };
-		1A58E8631D19D4DF00C0EA73 /* PaymentRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentRequest.cpp; sourceTree = "<group>"; };
-		1A58E8641D19D4DF00C0EA73 /* PaymentRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentRequest.h; sourceTree = "<group>"; };
+		1A58E8631D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplePaySessionPaymentRequest.cpp; sourceTree = "<group>"; };
+		1A58E8641D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplePaySessionPaymentRequest.h; sourceTree = "<group>"; };
 		1A58E86B1D19E42D00C0EA73 /* PaymentCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentCoordinator.cpp; sourceTree = "<group>"; };
 		1A58E86C1D19E42D00C0EA73 /* PaymentCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentCoordinator.h; sourceTree = "<group>"; };
 		1A71D5790F33819000F9CE4E /* IdentifierRep.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdentifierRep.cpp; sourceTree = "<group>"; };
@@ -16930,6 +16930,8 @@
 				1A8A64441D19FCFB00D0E00F /* ApplePaySession.cpp */,
 				1A8A64451D19FCFB00D0E00F /* ApplePaySession.h */,
 				1A8A64461D19FCFB00D0E00F /* ApplePaySession.idl */,
+				1A58E8631D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.cpp */,
+				1A58E8641D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.h */,
 				1A8A64471D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.cpp */,
 				1A8A64481D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.h */,
 				1A8A64491D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.idl */,
@@ -16954,8 +16956,6 @@
 				7CF930E61E01F9AD00BAFFBE /* PaymentHeaders.h */,
 				1AE96A871D1A0CEB00B86768 /* PaymentMerchantSession.h */,
 				1A8A64391D19FC5300D0E00F /* PaymentMethod.h */,
-				1A58E8631D19D4DF00C0EA73 /* PaymentRequest.cpp */,
-				1A58E8641D19D4DF00C0EA73 /* PaymentRequest.h */,
 				1A8A64651D19FDFF00D0E00F /* PaymentRequestValidator.cpp */,
 				1A8A64661D19FDFF00D0E00F /* PaymentRequestValidator.h */,
 			);
@@ -26561,6 +26561,7 @@
 				7C6522F51E00A51700677F22 /* ApplePayPaymentPass.h in Headers */,
 				7C6579E01E0079F900E3A27A /* ApplePayPaymentRequest.h in Headers */,
 				1A8A64591D19FCFC00D0E00F /* ApplePaySession.h in Headers */,
+				1A58E8651D19D4EB00C0EA73 /* ApplePaySessionPaymentRequest.h in Headers */,
 				1A8A645C1D19FCFC00D0E00F /* ApplePayShippingContactSelectedEvent.h in Headers */,
 				7C6579E81E00831600E3A27A /* ApplePayShippingMethod.h in Headers */,
 				1A8A64601D19FCFC00D0E00F /* ApplePayShippingMethodSelectedEvent.h in Headers */,
@@ -28954,7 +28955,6 @@
 				7CF930E71E01F9B400BAFFBE /* PaymentHeaders.h in Headers */,
 				1AE96A891D1A0CEB00B86768 /* PaymentMerchantSession.h in Headers */,
 				1A8A643C1D19FC5300D0E00F /* PaymentMethod.h in Headers */,
-				1A58E8651D19D4EB00C0EA73 /* PaymentRequest.h in Headers */,
 				1A8A64681D19FDFF00D0E00F /* PaymentRequestValidator.h in Headers */,
 				B27535650B053814002CE64F /* PDFDocumentImage.h in Headers */,
 				5E2C43511BCEE2F60001E2BC /* PeerConnectionBackend.h in Headers */,
@@ -30696,6 +30696,7 @@
 				1A8A64511D19FCFB00D0E00F /* ApplePayPaymentAuthorizedEvent.cpp in Sources */,
 				1A8A64541D19FCFC00D0E00F /* ApplePayPaymentMethodSelectedEvent.cpp in Sources */,
 				1A8A64581D19FCFC00D0E00F /* ApplePaySession.cpp in Sources */,
+				1A58E8671D19D80E00C0EA73 /* ApplePaySessionPaymentRequest.cpp in Sources */,
 				1A8A645B1D19FCFC00D0E00F /* ApplePayShippingContactSelectedEvent.cpp in Sources */,
 				1A8A645F1D19FCFC00D0E00F /* ApplePayShippingMethodSelectedEvent.cpp in Sources */,
 				1A8A64621D19FCFC00D0E00F /* ApplePayValidateMerchantEvent.cpp in Sources */,
@@ -32907,7 +32908,6 @@
 				1A58E86D1D19E42D00C0EA73 /* PaymentCoordinator.cpp in Sources */,
 				1ADA4A1C1D22F2C0005A9A15 /* PaymentMerchantSessionCocoa.mm in Sources */,
 				1A8A646E1D19FF8700D0E00F /* PaymentMethodCocoa.mm in Sources */,
-				1A58E8671D19D80E00C0EA73 /* PaymentRequest.cpp in Sources */,
 				1A8A64671D19FDFF00D0E00F /* PaymentRequestValidator.cpp in Sources */,
 				B27535640B053814002CE64F /* PDFDocumentImage.cpp in Sources */,
 				2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */,

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (220820 => 220821)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -483,7 +483,7 @@
     bool canMakePayments() final { return false; }
     void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)] { completionHandler(false); }); }
     void openPaymentSetup(const String&, const String&, WTF::Function<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)] { completionHandler(false); }); }
-    bool showPaymentUI(const URL&, const Vector<URL>&, const PaymentRequest&) final { return false; }
+    bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final { return false; }
     void completeMerchantValidation(const PaymentMerchantSession&) final { }
     void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) final { }
     void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) final { }

Modified: trunk/Source/WebKit/ChangeLog (220820 => 220821)


--- trunk/Source/WebKit/ChangeLog	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/ChangeLog	2017-08-17 01:24:30 UTC (rev 220821)
@@ -1,3 +1,65 @@
+2017-08-16  Andy Estes  <[email protected]>
+
+        [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
+        https://bugs.webkit.org/show_bug.cgi?id=175648
+
+        Reviewed by Tim Horton.
+
+        * Scripts/webkit/messages.py:
+        (headers_for_type):
+        * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::encode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::decode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::encode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::decode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::MerchantCapabilities>::encode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::MerchantCapabilities>::decode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::encode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::decode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::encode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::decode):
+        (IPC::ArgumentCoder<PaymentRequest>::encode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest>::decode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::ContactFields>::encode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::ContactFields>::decode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::LineItem>::encode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::LineItem>::decode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::MerchantCapabilities>::encode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::MerchantCapabilities>::decode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::ShippingMethod>::encode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::ShippingMethod>::decode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::TotalAndLineItems>::encode): Deleted.
+        (IPC::ArgumentCoder<PaymentRequest::TotalAndLineItems>::decode): Deleted.
+        * Shared/WebCoreArgumentCoders.h:
+        * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
+        (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
+        (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod):
+        * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
+        * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
+        * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
+        * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+        (toShippingMethod):
+        (WebKit::toPKContactFields):
+        (WebKit::toPKAddressField):
+        (WebKit::toPKPaymentSummaryItemType):
+        (WebKit::toPKPaymentSummaryItem):
+        (WebKit::toPKPaymentSummaryItems):
+        (WebKit::toPKMerchantCapabilities):
+        (WebKit::toPKShippingType):
+        (WebKit::toPKShippingMethod):
+        (WebKit::toPKPaymentRequest):
+        * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
+        (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
+        * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
+        (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
+        * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+        (WebKit::WebPaymentCoordinator::showPaymentUI):
+        (WebKit::WebPaymentCoordinator::didSelectShippingMethod):
+        * WebProcess/ApplePay/WebPaymentCoordinator.h:
+        * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
+
 2017-08-16  Chris Dumez  <[email protected]>
 
         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (220820 => 220821)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2017-08-17 01:24:30 UTC (rev 220821)
@@ -364,12 +364,12 @@
         'WebCore::PasteboardImage': ['<WebCore/Pasteboard.h>'],
         'WebCore::PasteboardURL': ['<WebCore/Pasteboard.h>'],
         'WebCore::PasteboardWebContent': ['<WebCore/Pasteboard.h>'],
-        'WebCore::PaymentAuthorizationResult': ['<WebCore/PaymentRequest.h>'],
-        'WebCore::PaymentMethodUpdate': ['<WebCore/PaymentRequest.h>'],
+        'WebCore::PaymentAuthorizationResult': ['<WebCore/ApplePaySessionPaymentRequest.h>'],
+        'WebCore::PaymentMethodUpdate': ['<WebCore/ApplePaySessionPaymentRequest.h>'],
         'WebCore::PluginInfo': ['<WebCore/PluginData.h>'],
         'WebCore::RecentSearch': ['<WebCore/SearchPopupMenu.h>'],
-        'WebCore::ShippingContactUpdate': ['<WebCore/PaymentRequest.h>'],
-        'WebCore::ShippingMethodUpdate': ['<WebCore/PaymentRequest.h>'],
+        'WebCore::ShippingContactUpdate': ['<WebCore/ApplePaySessionPaymentRequest.h>'],
+        'WebCore::ShippingMethodUpdate': ['<WebCore/ApplePaySessionPaymentRequest.h>'],
         'WebCore::ShouldSample': ['<WebCore/DiagnosticLoggingClient.h>'],
         'WebCore::TextCheckingRequestData': ['<WebCore/TextChecking.h>'],
         'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'],

Modified: trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (220820 => 220821)


--- trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2017-08-17 01:24:30 UTC (rev 220821)
@@ -233,7 +233,7 @@
     return true;
 }
 
-void ArgumentCoder<PaymentRequest>::encode(Encoder& encoder, const PaymentRequest& request)
+void ArgumentCoder<ApplePaySessionPaymentRequest>::encode(Encoder& encoder, const ApplePaySessionPaymentRequest& request)
 {
     encoder << request.countryCode();
     encoder << request.currencyCode();
@@ -251,7 +251,7 @@
     encoder << request.supportedCountries();
 }
 
-bool ArgumentCoder<PaymentRequest>::decode(Decoder& decoder, PaymentRequest& request)
+bool ArgumentCoder<ApplePaySessionPaymentRequest>::decode(Decoder& decoder, ApplePaySessionPaymentRequest& request)
 {
     String countryCode;
     if (!decoder.decode(countryCode))
@@ -263,7 +263,7 @@
         return false;
     request.setCurrencyCode(currencyCode);
 
-    PaymentRequest::ContactFields requiredBillingContactFields;
+    ApplePaySessionPaymentRequest::ContactFields requiredBillingContactFields;
     if (!decoder.decode((requiredBillingContactFields)))
         return false;
     request.setRequiredBillingContactFields(requiredBillingContactFields);
@@ -273,7 +273,7 @@
         return false;
     request.setBillingContact(billingContact);
 
-    PaymentRequest::ContactFields requiredShippingContactFields;
+    ApplePaySessionPaymentRequest::ContactFields requiredShippingContactFields;
     if (!decoder.decode((requiredShippingContactFields)))
         return false;
     request.setRequiredShippingContactFields(requiredShippingContactFields);
@@ -283,7 +283,7 @@
         return false;
     request.setShippingContact(shippingContact);
 
-    PaymentRequest::MerchantCapabilities merchantCapabilities;
+    ApplePaySessionPaymentRequest::MerchantCapabilities merchantCapabilities;
     if (!decoder.decode(merchantCapabilities))
         return false;
     request.setMerchantCapabilities(merchantCapabilities);
@@ -293,22 +293,22 @@
         return false;
     request.setSupportedNetworks(supportedNetworks);
 
-    PaymentRequest::ShippingType shippingType;
+    ApplePaySessionPaymentRequest::ShippingType shippingType;
     if (!decoder.decodeEnum(shippingType))
         return false;
     request.setShippingType(shippingType);
 
-    Vector<PaymentRequest::ShippingMethod> shippingMethods;
+    Vector<ApplePaySessionPaymentRequest::ShippingMethod> shippingMethods;
     if (!decoder.decode(shippingMethods))
         return false;
     request.setShippingMethods(shippingMethods);
 
-    Vector<PaymentRequest::LineItem> lineItems;
+    Vector<ApplePaySessionPaymentRequest::LineItem> lineItems;
     if (!decoder.decode(lineItems))
         return false;
     request.setLineItems(lineItems);
 
-    PaymentRequest::LineItem total;
+    ApplePaySessionPaymentRequest::LineItem total;
     if (!decoder.decode(total))
         return false;
     request.setTotal(total);
@@ -326,7 +326,7 @@
     return true;
 }
 
-void ArgumentCoder<PaymentRequest::ContactFields>::encode(Encoder& encoder, const PaymentRequest::ContactFields& contactFields)
+void ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::encode(Encoder& encoder, const ApplePaySessionPaymentRequest::ContactFields& contactFields)
 {
     encoder << contactFields.postalAddress;
     encoder << contactFields.phone;
@@ -334,7 +334,7 @@
     encoder << contactFields.name;
 }
 
-bool ArgumentCoder<PaymentRequest::ContactFields>::decode(Decoder& decoder, PaymentRequest::ContactFields& contactFields)
+bool ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::decode(Decoder& decoder, ApplePaySessionPaymentRequest::ContactFields& contactFields)
 {
     if (!decoder.decode(contactFields.postalAddress))
         return false;
@@ -348,7 +348,7 @@
     return true;
 }
 
-void ArgumentCoder<PaymentRequest::LineItem>::encode(Encoder& encoder, const PaymentRequest::LineItem& lineItem)
+void ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::encode(Encoder& encoder, const ApplePaySessionPaymentRequest::LineItem& lineItem)
 {
     encoder.encodeEnum(lineItem.type);
     encoder << lineItem.label;
@@ -355,7 +355,7 @@
     encoder << lineItem.amount;
 }
 
-bool ArgumentCoder<PaymentRequest::LineItem>::decode(Decoder& decoder, PaymentRequest::LineItem& lineItem)
+bool ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::decode(Decoder& decoder, ApplePaySessionPaymentRequest::LineItem& lineItem)
 {
     if (!decoder.decodeEnum(lineItem.type))
         return false;
@@ -367,7 +367,7 @@
     return true;
 }
 
-void ArgumentCoder<PaymentRequest::MerchantCapabilities>::encode(Encoder& encoder, const PaymentRequest::MerchantCapabilities& merchantCapabilities)
+void ArgumentCoder<ApplePaySessionPaymentRequest::MerchantCapabilities>::encode(Encoder& encoder, const ApplePaySessionPaymentRequest::MerchantCapabilities& merchantCapabilities)
 {
     encoder << merchantCapabilities.supports3DS;
     encoder << merchantCapabilities.supportsEMV;
@@ -375,7 +375,7 @@
     encoder << merchantCapabilities.supportsDebit;
 }
 
-bool ArgumentCoder<PaymentRequest::MerchantCapabilities>::decode(Decoder& decoder, PaymentRequest::MerchantCapabilities& merchantCapabilities)
+bool ArgumentCoder<ApplePaySessionPaymentRequest::MerchantCapabilities>::decode(Decoder& decoder, ApplePaySessionPaymentRequest::MerchantCapabilities& merchantCapabilities)
 {
     if (!decoder.decode(merchantCapabilities.supports3DS))
         return false;
@@ -389,7 +389,7 @@
     return true;
 }
 
-void ArgumentCoder<PaymentRequest::ShippingMethod>::encode(Encoder& encoder, const PaymentRequest::ShippingMethod& shippingMethod)
+void ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::encode(Encoder& encoder, const ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     encoder << shippingMethod.label;
     encoder << shippingMethod.detail;
@@ -397,7 +397,7 @@
     encoder << shippingMethod.identifier;
 }
 
-bool ArgumentCoder<PaymentRequest::ShippingMethod>::decode(Decoder& decoder, PaymentRequest::ShippingMethod& shippingMethod)
+bool ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::decode(Decoder& decoder, ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     if (!decoder.decode(shippingMethod.label))
         return false;
@@ -410,13 +410,13 @@
     return true;
 }
 
-void ArgumentCoder<PaymentRequest::TotalAndLineItems>::encode(Encoder& encoder, const PaymentRequest::TotalAndLineItems& totalAndLineItems)
+void ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::encode(Encoder& encoder, const ApplePaySessionPaymentRequest::TotalAndLineItems& totalAndLineItems)
 {
     encoder << totalAndLineItems.total;
     encoder << totalAndLineItems.lineItems;
 }
 
-bool ArgumentCoder<PaymentRequest::TotalAndLineItems>::decode(Decoder& decoder, PaymentRequest::TotalAndLineItems& totalAndLineItems)
+bool ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::decode(Decoder& decoder, ApplePaySessionPaymentRequest::TotalAndLineItems& totalAndLineItems)
 {
     if (!decoder.decode(totalAndLineItems.total))
         return false;

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (220820 => 220821)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -592,34 +592,34 @@
     static bool decode(Decoder&, WebCore::PaymentMethodUpdate&);
 };
 
-template<> struct ArgumentCoder<WebCore::PaymentRequest> {
-    static void encode(Encoder&, const WebCore::PaymentRequest&);
-    static bool decode(Decoder&, WebCore::PaymentRequest&);
+template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest> {
+    static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest&);
+    static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest&);
 };
 
-template<> struct ArgumentCoder<WebCore::PaymentRequest::ContactFields> {
-    static void encode(Encoder&, const WebCore::PaymentRequest::ContactFields&);
-    static bool decode(Decoder&, WebCore::PaymentRequest::ContactFields&);
+template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ContactFields> {
+    static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ContactFields&);
+    static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::ContactFields&);
 };
 
-template<> struct ArgumentCoder<WebCore::PaymentRequest::LineItem> {
-    static void encode(Encoder&, const WebCore::PaymentRequest::LineItem&);
-    static bool decode(Decoder&, WebCore::PaymentRequest::LineItem&);
+template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::LineItem> {
+    static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::LineItem&);
+    static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::LineItem&);
 };
 
-template<> struct ArgumentCoder<WebCore::PaymentRequest::MerchantCapabilities> {
-    static void encode(Encoder&, const WebCore::PaymentRequest::MerchantCapabilities&);
-    static bool decode(Decoder&, WebCore::PaymentRequest::MerchantCapabilities&);
+template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities> {
+    static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
+    static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
 };
 
-template<> struct ArgumentCoder<WebCore::PaymentRequest::ShippingMethod> {
-    static void encode(Encoder&, const WebCore::PaymentRequest::ShippingMethod&);
-    static bool decode(Decoder&, WebCore::PaymentRequest::ShippingMethod&);
+template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> {
+    static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&);
+    static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::ShippingMethod&);
 };
 
-template<> struct ArgumentCoder<WebCore::PaymentRequest::TotalAndLineItems> {
-    static void encode(Encoder&, const WebCore::PaymentRequest::TotalAndLineItems&);
-    static bool decode(Decoder&, WebCore::PaymentRequest::TotalAndLineItems&);
+template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> {
+    static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems&);
+    static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems&);
 };
 
 template<> struct ArgumentCoder<WebCore::ShippingContactUpdate> {

Modified: trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp (220820 => 220821)


--- trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -87,7 +87,7 @@
     });
 }
 
-void WebPaymentCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::PaymentRequest& paymentRequest, bool& result)
+void WebPaymentCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& paymentRequest, bool& result)
 {
     // FIXME: Make this a message check.
     ASSERT(canBegin());
@@ -234,7 +234,7 @@
     m_webPageProxy.send(Messages::WebPaymentCoordinator::DidAuthorizePayment(payment));
 }
 
-void WebPaymentCoordinatorProxy::didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod& shippingMethod)
+void WebPaymentCoordinatorProxy::didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     ASSERT(m_state == State::Active);
 

Modified: trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h (220820 => 220821)


--- trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -63,7 +63,7 @@
     void didCancelPaymentSession();
     void validateMerchant(const WebCore::URL&);
     void didAuthorizePayment(const WebCore::Payment&);
-    void didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod&);
+    void didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&);
     void didSelectShippingContact(const WebCore::PaymentContact&);
     void didSelectPaymentMethod(const WebCore::PaymentMethod&);
 
@@ -78,7 +78,7 @@
     void canMakePayments(bool& reply);
     void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
     void openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
-    void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::PaymentRequest&, bool& result);
+    void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, bool& result);
     void completeMerchantValidation(const WebCore::PaymentMerchantSession&);
     void completeShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>&);
     void completeShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>&);
@@ -97,7 +97,7 @@
     bool platformCanMakePayments();
     void platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler);
     void platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler);
-    void platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&, WTF::Function<void (bool)>&& completionHandler);
+    void platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&, WTF::Function<void (bool)>&& completionHandler);
     void platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&);
     void platformCompleteShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>&);
     void platformCompleteShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>&);

Modified: trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in (220820 => 220821)


--- trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in	2017-08-17 01:24:30 UTC (rev 220821)
@@ -30,7 +30,7 @@
     CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName, uint64_t requestID)
     OpenPaymentSetup(String merchantIdentifier, String domainName, uint64_t requestID)
 
-    ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::PaymentRequest paymentRequest) -> (bool result)
+    ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result)
     CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession)
     CompleteShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate> update)
     CompleteShippingContactSelection(std::optional<WebCore::ShippingContactUpdate> update)

Modified: trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h (220820 => 220821)


--- trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -39,7 +39,7 @@
 class WebPageProxy;
 class WebPaymentCoordinatorProxy;
 
-RetainPtr<PKPaymentRequest> toPKPaymentRequest(WebPageProxy&, const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&);
+RetainPtr<PKPaymentRequest> toPKPaymentRequest(WebPageProxy&, const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&);
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (220820 => 220821)


--- trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2017-08-17 01:24:30 UTC (rev 220821)
@@ -143,11 +143,11 @@
     }];
 }
 
-static WebCore::PaymentRequest::ShippingMethod toShippingMethod(PKShippingMethod *shippingMethod)
+static WebCore::ApplePaySessionPaymentRequest::ShippingMethod toShippingMethod(PKShippingMethod *shippingMethod)
 {
     ASSERT(shippingMethod);
 
-    WebCore::PaymentRequest::ShippingMethod result;
+    WebCore::ApplePaySessionPaymentRequest::ShippingMethod result;
     result.label = shippingMethod.label;
     result.detail = shippingMethod.detail;
     result.amount = [shippingMethod.amount decimalNumberByMultiplyingByPowerOf10:2].integerValue;
@@ -351,7 +351,7 @@
 }
 
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
-static RetainPtr<NSSet> toPKContactFields(const WebCore::PaymentRequest::ContactFields& contactFields)
+static RetainPtr<NSSet> toPKContactFields(const WebCore::ApplePaySessionPaymentRequest::ContactFields& contactFields)
 {
     Vector<NSString *> result;
 
@@ -369,7 +369,7 @@
     return adoptNS([[NSSet alloc] initWithObjects:result.data() count:result.size()]);
 }
 #else
-static PKAddressField toPKAddressField(const WebCore::PaymentRequest::ContactFields& contactFields)
+static PKAddressField toPKAddressField(const WebCore::ApplePaySessionPaymentRequest::ContactFields& contactFields)
 {
     PKAddressField result = 0;
 
@@ -386,13 +386,13 @@
 }
 #endif
 
-static PKPaymentSummaryItemType toPKPaymentSummaryItemType(WebCore::PaymentRequest::LineItem::Type type)
+static PKPaymentSummaryItemType toPKPaymentSummaryItemType(WebCore::ApplePaySessionPaymentRequest::LineItem::Type type)
 {
     switch (type) {
-    case WebCore::PaymentRequest::LineItem::Type::Final:
+    case WebCore::ApplePaySessionPaymentRequest::LineItem::Type::Final:
         return PKPaymentSummaryItemTypeFinal;
 
-    case WebCore::PaymentRequest::LineItem::Type::Pending:
+    case WebCore::ApplePaySessionPaymentRequest::LineItem::Type::Pending:
         return PKPaymentSummaryItemTypePending;
     }
 }
@@ -402,12 +402,12 @@
     return adoptNS([[NSDecimalNumber alloc] initWithMantissa:llabs(value) exponent:-2 isNegative:value < 0]);
 }
 
-static RetainPtr<PKPaymentSummaryItem> toPKPaymentSummaryItem(const WebCore::PaymentRequest::LineItem& lineItem)
+static RetainPtr<PKPaymentSummaryItem> toPKPaymentSummaryItem(const WebCore::ApplePaySessionPaymentRequest::LineItem& lineItem)
 {
     return [getPKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:toDecimalNumber(lineItem.amount.value_or(0)).get() type:toPKPaymentSummaryItemType(lineItem.type)];
 }
 
-static RetainPtr<NSArray> toPKPaymentSummaryItems(const WebCore::PaymentRequest::TotalAndLineItems& totalAndLineItems)
+static RetainPtr<NSArray> toPKPaymentSummaryItems(const WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems& totalAndLineItems)
 {
     auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
     for (auto& lineItem : totalAndLineItems.lineItems) {
@@ -421,7 +421,7 @@
     return paymentSummaryItems;
 }
 
-static PKMerchantCapability toPKMerchantCapabilities(const WebCore::PaymentRequest::MerchantCapabilities& merchantCapabilities)
+static PKMerchantCapability toPKMerchantCapabilities(const WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities& merchantCapabilities)
 {
     PKMerchantCapability result = 0;
     if (merchantCapabilities.supports3DS)
@@ -472,24 +472,24 @@
     return result;
 }
 
-static PKShippingType toPKShippingType(WebCore::PaymentRequest::ShippingType shippingType)
+static PKShippingType toPKShippingType(WebCore::ApplePaySessionPaymentRequest::ShippingType shippingType)
 {
     switch (shippingType) {
-    case WebCore::PaymentRequest::ShippingType::Shipping:
+    case WebCore::ApplePaySessionPaymentRequest::ShippingType::Shipping:
         return PKShippingTypeShipping;
 
-    case WebCore::PaymentRequest::ShippingType::Delivery:
+    case WebCore::ApplePaySessionPaymentRequest::ShippingType::Delivery:
         return PKShippingTypeDelivery;
 
-    case WebCore::PaymentRequest::ShippingType::StorePickup:
+    case WebCore::ApplePaySessionPaymentRequest::ShippingType::StorePickup:
         return PKShippingTypeStorePickup;
 
-    case WebCore::PaymentRequest::ShippingType::ServicePickup:
+    case WebCore::ApplePaySessionPaymentRequest::ShippingType::ServicePickup:
         return PKShippingTypeServicePickup;
     }
 }
 
-static RetainPtr<PKShippingMethod> toPKShippingMethod(const WebCore::PaymentRequest::ShippingMethod& shippingMethod)
+static RetainPtr<PKShippingMethod> toPKShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     RetainPtr<PKShippingMethod> result = [getPKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:toDecimalNumber(shippingMethod.amount).get()];
     [result setIdentifier:shippingMethod.identifier];
@@ -512,7 +512,7 @@
 }
 #endif
 
-RetainPtr<PKPaymentRequest> toPKPaymentRequest(WebPageProxy& webPageProxy, const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest& paymentRequest)
+RetainPtr<PKPaymentRequest> toPKPaymentRequest(WebPageProxy& webPageProxy, const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
 {
     auto result = adoptNS([allocPKPaymentRequestInstance() init]);
 

Modified: trunk/Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm (220820 => 220821)


--- trunk/Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm	2017-08-17 01:24:30 UTC (rev 220821)
@@ -41,7 +41,7 @@
 
 namespace WebKit {
 
-void WebPaymentCoordinatorProxy::platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLStrings, const WebCore::PaymentRequest& request, WTF::Function<void (bool)>&& completionHandler)
+void WebPaymentCoordinatorProxy::platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, WTF::Function<void (bool)>&& completionHandler)
 {
     UIViewController *presentingViewController = m_webPageProxy.uiClient().presentingViewController();
 

Modified: trunk/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm (220820 => 220821)


--- trunk/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm	2017-08-17 01:24:30 UTC (rev 220821)
@@ -41,7 +41,7 @@
 
 namespace WebKit {
 
-void WebPaymentCoordinatorProxy::platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLStrings, const WebCore::PaymentRequest& request, WTF::Function<void (bool)>&& completionHandler)
+void WebPaymentCoordinatorProxy::platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, WTF::Function<void (bool)>&& completionHandler)
 {
     auto paymentRequest = toPKPaymentRequest(m_webPageProxy, originatingURL, linkIconURLStrings, request);
 

Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp (220820 => 220821)


--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp	2017-08-17 01:24:30 UTC (rev 220821)
@@ -103,7 +103,7 @@
     m_webPage.send(Messages::WebPaymentCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName, replyID));
 }
 
-bool WebPaymentCoordinator::showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest& paymentRequest)
+bool WebPaymentCoordinator::showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
 {
     Vector<String> linkIconURLStrings;
     for (const auto& linkIconURL : linkIconURLs)
@@ -166,7 +166,7 @@
     paymentCoordinator().didAuthorizePayment(payment);
 }
 
-void WebPaymentCoordinator::didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod& shippingMethod)
+void WebPaymentCoordinator::didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     paymentCoordinator().didSelectShippingMethod(shippingMethod);
 }

Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h (220820 => 220821)


--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -57,7 +57,7 @@
     bool canMakePayments() override;
     void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override;
     void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override;
-    bool showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
+    bool showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override;
     void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
     void completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&&) override;
     void completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&&) override;
@@ -75,7 +75,7 @@
     // Message handlers.
     void validateMerchant(const String& validationURLString);
     void didAuthorizePayment(const WebCore::Payment&);
-    void didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod&);
+    void didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&);
     void didSelectShippingContact(const WebCore::PaymentContact&);
     void didSelectPaymentMethod(const WebCore::PaymentMethod&);
     void didCancelPaymentSession();

Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in (220820 => 220821)


--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in	2017-08-17 01:24:30 UTC (rev 220821)
@@ -28,7 +28,7 @@
 
     ValidateMerchant(String validationURLString)
     DidAuthorizePayment(WebCore::Payment payment)
-    DidSelectShippingMethod(WebCore::PaymentRequest::ShippingMethod shippingMethod)
+    DidSelectShippingMethod(WebCore::ApplePaySessionPaymentRequest::ShippingMethod shippingMethod)
     DidSelectShippingContact(WebCore::PaymentContact shippingContact)
     DidSelectPaymentMethod(WebCore::PaymentMethod paymentMethod)
     DidCancelPaymentSession()

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (220820 => 220821)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2017-08-17 01:24:30 UTC (rev 220821)
@@ -1,3 +1,14 @@
+2017-08-16  Andy Estes  <[email protected]>
+
+        [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
+        https://bugs.webkit.org/show_bug.cgi?id=175648
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebPaymentCoordinatorClient.h:
+        * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+        (WebPaymentCoordinatorClient::showPaymentUI):
+
 2017-08-16  Yoshiaki Jitsukawa  <[email protected]>
 
         [PAL] Move spi/ios and spi/win directories into PAL

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (220820 => 220821)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h	2017-08-17 01:24:30 UTC (rev 220821)
@@ -40,7 +40,7 @@
     bool canMakePayments() override;
     void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void (bool)>&& completionHandler) override;
     void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override;
-    bool showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
+    bool showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override;
     void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
     void completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&&) override;
     void completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&&) override;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (220820 => 220821)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm	2017-08-17 00:45:54 UTC (rev 220820)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm	2017-08-17 01:24:30 UTC (rev 220821)
@@ -62,7 +62,7 @@
     });
 }
 
-bool WebPaymentCoordinatorClient::showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>&, const WebCore::PaymentRequest&)
+bool WebPaymentCoordinatorClient::showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>&, const WebCore::ApplePaySessionPaymentRequest&)
 {
     return false;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to