[Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Aug 2017 01:24:30 +0000 (01:24 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Aug 2017 01:24:30 +0000 (01:24 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220821 268f45cc-cd09-0410-ab3c-d52691b4dbfc

35 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/applepay/ApplePayError.h
Source/WebCore/Modules/applepay/ApplePayLineItem.h
Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h
Source/WebCore/Modules/applepay/ApplePaySession.cpp
Source/WebCore/Modules/applepay/ApplePaySession.h
Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp [moved from Source/WebCore/Modules/applepay/PaymentRequest.cpp with 88% similarity]
Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h [moved from Source/WebCore/Modules/applepay/PaymentRequest.h with 93% similarity]
Source/WebCore/Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp
Source/WebCore/Modules/applepay/ApplePayShippingMethodSelectedEvent.h
Source/WebCore/Modules/applepay/PaymentCoordinator.cpp
Source/WebCore/Modules/applepay/PaymentCoordinator.h
Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h
Source/WebCore/Modules/applepay/PaymentHeaders.h
Source/WebCore/Modules/applepay/PaymentRequestValidator.cpp
Source/WebCore/Modules/applepay/PaymentRequestValidator.h
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/EmptyClients.cpp
Source/WebKit/ChangeLog
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
Source/WebKit/Shared/WebCoreArgumentCoders.h
Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp
Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h
Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in
Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h
Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm
Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm
Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp
Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h
Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.messages.in
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h
Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm

index 53c226b..25c2436 100644 (file)
@@ -1,3 +1,49 @@
+2017-08-16  Andy Estes  <aestes@apple.com>
+
+        [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  <cdumez@apple.com>
 
         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
index f948fe9..e9defce 100644 (file)
@@ -27,7 +27,7 @@
 
 #if ENABLE(APPLE_PAY)
 
-#include "PaymentRequest.h"
+#include "ApplePaySessionPaymentRequest.h"
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
index e3ec6f6..187f69a 100644 (file)
 
 #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;
index b3b0864..0fdbacd 100644 (file)
@@ -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 @@ struct ApplePayPaymentRequest {
     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;
index 201aca0..385d94d 100644 (file)
@@ -166,13 +166,13 @@ static std::optional<int64_t> parseAmount(const String& amountString)
     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 @@ static ExceptionOr<PaymentRequest::LineItem> convertAndValidateTotal(ApplePayLin
     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 @@ static ExceptionOr<PaymentRequest::LineItem> convertAndValidate(ApplePayLineItem
     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 @@ static ExceptionOr<Vector<PaymentRequest::LineItem>> convertAndValidate(std::opt
     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,16 +250,16 @@ static ExceptionOr<Vector<String>> convertAndValidate(unsigned version, Vector<S
         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.") };
     }
 
     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 @@ static ExceptionOr<PaymentRequest::ContactFields> convertAndValidate(unsigned ve
     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 @@ static ExceptionOr<PaymentRequest::ShippingMethod> convertAndValidate(ApplePaySh
     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 @@ static ExceptionOr<Vector<PaymentRequest::ShippingMethod>> convertAndValidate(Ve
     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 @@ ExceptionOr<Ref<ApplePaySession>> ApplePaySession::create(Document& document, un
     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 @@ void ApplePaySession::didAuthorizePayment(const Payment& payment)
     dispatchEvent(event.get());
 }
 
-void ApplePaySession::didSelectShippingMethod(const PaymentRequest::ShippingMethod& shippingMethod)
+void ApplePaySession::didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     ASSERT(m_state == State::Active);
 
index a9be087..0209ff9 100644 (file)
@@ -90,11 +90,11 @@ public:
     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 @@ public:
     using RefCounted<ApplePaySession>::deref;
 
 private:
-    ApplePaySession(Document&, PaymentRequest&&);
+    ApplePaySession(Document&, ApplePaySessionPaymentRequest&&);
 
     // ActiveDOMObject.
     const char* activeDOMObjectName() const override;
@@ -151,7 +151,7 @@ private:
         ValidationComplete,
     } m_merchantValidationState { MerchantValidationState::Idle };
 
-    const PaymentRequest m_paymentRequest;
+    const ApplePaySessionPaymentRequest m_paymentRequest;
 };
 
 }
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ * 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
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "PaymentRequest.h"
+#include "ApplePaySessionPaymentRequest.h"
 
 #if ENABLE(APPLE_PAY)
 
 
 namespace WebCore {
 
-PaymentRequest::PaymentRequest()
+ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest()
 {
 }
 
-PaymentRequest::~PaymentRequest()
+ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest()
 {
 }
 
-bool PaymentRequest::isValidSupportedNetwork(unsigned version, const String& supportedNetwork)
+bool ApplePaySessionPaymentRequest::isValidSupportedNetwork(unsigned version, const String& supportedNetwork)
 {
     if (supportedNetwork == "amex")
         return true;
@@ -37,10 +37,10 @@ namespace WebCore {
 
 enum class PaymentAuthorizationStatus;
 
-class PaymentRequest {
+class ApplePaySessionPaymentRequest {
 public:
-    WEBCORE_EXPORT PaymentRequest();
-    WEBCORE_EXPORT ~PaymentRequest();
+    WEBCORE_EXPORT ApplePaySessionPaymentRequest();
+    WEBCORE_EXPORT ~ApplePaySessionPaymentRequest();
 
     const String& countryCode() const { return m_countryCode; }
     void setCountryCode(const String& countryCode) { m_countryCode = countryCode; }
@@ -122,8 +122,8 @@ public:
     void setTotal(const LineItem& total) { m_total = total; }
 
     struct TotalAndLineItems {
-        PaymentRequest::LineItem total;
-        Vector<PaymentRequest::LineItem> lineItems;
+        ApplePaySessionPaymentRequest::LineItem total;
+        Vector<ApplePaySessionPaymentRequest::LineItem> lineItems;
     };
 
     const String& applicationData() const { return m_applicationData; }
@@ -188,18 +188,18 @@ struct PaymentAuthorizationResult {
 };
 
 struct PaymentMethodUpdate {
-    PaymentRequest::TotalAndLineItems newTotalAndLineItems;
+    ApplePaySessionPaymentRequest::TotalAndLineItems newTotalAndLineItems;
 };
 
 struct ShippingContactUpdate {
     Vector<PaymentError> errors;
 
-    Vector<PaymentRequest::ShippingMethod> newShippingMethods;
-    PaymentRequest::TotalAndLineItems newTotalAndLineItems;
+    Vector<ApplePaySessionPaymentRequest::ShippingMethod> newShippingMethods;
+    ApplePaySessionPaymentRequest::TotalAndLineItems newTotalAndLineItems;
 };
 
 struct ShippingMethodUpdate {
-    PaymentRequest::TotalAndLineItems newTotalAndLineItems;
+    ApplePaySessionPaymentRequest::TotalAndLineItems newTotalAndLineItems;
 };
 
 WEBCORE_EXPORT bool isFinalStateResult(const std::optional<PaymentAuthorizationResult>&);
index 6c4fff9..4b31fd6 100644 (file)
@@ -46,7 +46,7 @@ static inline String convert(int64_t amount)
     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 @@ static inline ApplePayShippingMethod convert(const PaymentRequest::ShippingMetho
     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))
 {
index 0693487..ec1c64e 100644 (file)
 
 #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 @@ public:
     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;
index 0ea5ec3..713994a 100644 (file)
@@ -65,7 +65,7 @@ void PaymentCoordinator::openPaymentSetup(const String& merchantIdentifier, cons
     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 @@ void PaymentCoordinator::didSelectPaymentMethod(const PaymentMethod& paymentMeth
     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.
index b3b4d8f..c94b822 100644 (file)
@@ -27,7 +27,7 @@
 
 #if ENABLE(APPLE_PAY)
 
-#include "PaymentRequest.h"
+#include "ApplePaySessionPaymentRequest.h"
 #include <wtf/Function.h>
 
 namespace WebCore {
@@ -57,7 +57,7 @@ public:
 
     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 @@ public:
     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();
 
index 7b9b374..d35cf06 100644 (file)
@@ -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 @@ public:
     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;
index 99bcb8b..f1e7e09 100644 (file)
@@ -25,9 +25,9 @@
 
 #pragma once
 
+#include "ApplePaySessionPaymentRequest.h"
 #include "Payment.h"
 #include "PaymentContact.h"
 #include "PaymentMerchantSession.h"
 #include "PaymentMethod.h"
-#include "PaymentRequest.h"
 
index 8be4a76..2c5ba5a 100644 (file)
@@ -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 @@ namespace WebCore {
 
 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 @@ ExceptionOr<void> PaymentRequestValidator::validate(const PaymentRequest& paymen
     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 @@ static ExceptionOr<void> validateCurrencyCode(const String& currencyCode)
     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 @@ static ExceptionOr<void> validateSupportedNetworks(const Vector<String>& support
     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 @@ static ExceptionOr<void> validateShippingMethod(const PaymentRequest::ShippingMe
     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);
index bcd6185..68fa25d 100644 (file)
 
 #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&);
 };
 
 }
index 6c2ddbe..853375a 100644 (file)
                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 */; };
                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>"; };
                                1A8A64441D19FCFB00D0E00F /* ApplePaySession.cpp */,
                                1A8A64451D19FCFB00D0E00F /* ApplePaySession.h */,
                                1A8A64461D19FCFB00D0E00F /* ApplePaySession.idl */,
+                               1A58E8631D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.cpp */,
+                               1A58E8641D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.h */,
                                1A8A64471D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.cpp */,
                                1A8A64481D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.h */,
                                1A8A64491D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.idl */,
                                7CF930E61E01F9AD00BAFFBE /* PaymentHeaders.h */,
                                1AE96A871D1A0CEB00B86768 /* PaymentMerchantSession.h */,
                                1A8A64391D19FC5300D0E00F /* PaymentMethod.h */,
-                               1A58E8631D19D4DF00C0EA73 /* PaymentRequest.cpp */,
-                               1A58E8641D19D4DF00C0EA73 /* PaymentRequest.h */,
                                1A8A64651D19FDFF00D0E00F /* PaymentRequestValidator.cpp */,
                                1A8A64661D19FDFF00D0E00F /* PaymentRequestValidator.h */,
                        );
                                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 */,
                                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 */,
                                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 */,
                                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 */,
index ccdc055..fc3b20b 100644 (file)
@@ -483,7 +483,7 @@ class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient {
     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 { }
index dcd1bc9..11851d5 100644 (file)
@@ -1,3 +1,65 @@
+2017-08-16  Andy Estes  <aestes@apple.com>
+
+        [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  <cdumez@apple.com>
 
         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
index fe6bf89..0c2b2cd 100644 (file)
@@ -364,12 +364,12 @@ def headers_for_type(type):
         '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>'],
index 09e14b6..17c50f0 100644 (file)
@@ -233,7 +233,7 @@ bool ArgumentCoder<WebCore::PaymentMethodUpdate>::decode(Decoder& decoder, WebCo
     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 @@ void ArgumentCoder<PaymentRequest>::encode(Encoder& encoder, const PaymentReques
     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 @@ bool ArgumentCoder<PaymentRequest>::decode(Decoder& decoder, PaymentRequest& req
         return false;
     request.setCurrencyCode(currencyCode);
 
-    PaymentRequest::ContactFields requiredBillingContactFields;
+    ApplePaySessionPaymentRequest::ContactFields requiredBillingContactFields;
     if (!decoder.decode((requiredBillingContactFields)))
         return false;
     request.setRequiredBillingContactFields(requiredBillingContactFields);
@@ -273,7 +273,7 @@ bool ArgumentCoder<PaymentRequest>::decode(Decoder& decoder, PaymentRequest& req
         return false;
     request.setBillingContact(billingContact);
 
-    PaymentRequest::ContactFields requiredShippingContactFields;
+    ApplePaySessionPaymentRequest::ContactFields requiredShippingContactFields;
     if (!decoder.decode((requiredShippingContactFields)))
         return false;
     request.setRequiredShippingContactFields(requiredShippingContactFields);
@@ -283,7 +283,7 @@ bool ArgumentCoder<PaymentRequest>::decode(Decoder& decoder, PaymentRequest& req
         return false;
     request.setShippingContact(shippingContact);
 
-    PaymentRequest::MerchantCapabilities merchantCapabilities;
+    ApplePaySessionPaymentRequest::MerchantCapabilities merchantCapabilities;
     if (!decoder.decode(merchantCapabilities))
         return false;
     request.setMerchantCapabilities(merchantCapabilities);
@@ -293,22 +293,22 @@ bool ArgumentCoder<PaymentRequest>::decode(Decoder& decoder, PaymentRequest& req
         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 @@ bool ArgumentCoder<PaymentRequest>::decode(Decoder& decoder, PaymentRequest& req
     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 @@ void ArgumentCoder<PaymentRequest::ContactFields>::encode(Encoder& encoder, cons
     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,14 +348,14 @@ bool ArgumentCoder<PaymentRequest::ContactFields>::decode(Decoder& decoder, Paym
     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;
     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 @@ bool ArgumentCoder<PaymentRequest::LineItem>::decode(Decoder& decoder, PaymentRe
     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 @@ void ArgumentCoder<PaymentRequest::MerchantCapabilities>::encode(Encoder& encode
     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 @@ bool ArgumentCoder<PaymentRequest::MerchantCapabilities>::decode(Decoder& decode
     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 @@ void ArgumentCoder<PaymentRequest::ShippingMethod>::encode(Encoder& encoder, con
     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 @@ bool ArgumentCoder<PaymentRequest::ShippingMethod>::decode(Decoder& decoder, Pay
     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;
index 923ab79..b022a03 100644 (file)
@@ -592,34 +592,34 @@ template<> struct ArgumentCoder<WebCore::PaymentMethodUpdate> {
     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> {
index a972e62..10e14f7 100644 (file)
@@ -87,7 +87,7 @@ void WebPaymentCoordinatorProxy::openPaymentSetup(const String& merchantIdentifi
     });
 }
 
-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 @@ void WebPaymentCoordinatorProxy::didAuthorizePayment(const WebCore::Payment& pay
     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);
 
index 7ee0ff1..bc02ef3 100644 (file)
@@ -63,7 +63,7 @@ public:
     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 @@ private:
     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 @@ private:
     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>&);
index 03f8cdf..3ff01ae 100644 (file)
@@ -30,7 +30,7 @@ messages -> WebPaymentCoordinatorProxy {
     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)
index 63a70e2..159ac19 100644 (file)
@@ -39,7 +39,7 @@ namespace WebKit {
 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&);
 
 }
 
index 81832d1..0128ec1 100644 (file)
@@ -143,11 +143,11 @@ SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, PassKit, PKCanMakePaymentsWithMer
     }];
 }
 
-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 @@ void WebPaymentCoordinatorProxy::platformOpenPaymentSetup(const String& merchant
 }
 
 #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 @@ static RetainPtr<NSSet> toPKContactFields(const WebCore::PaymentRequest::Contact
     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 @@ static PKAddressField toPKAddressField(const WebCore::PaymentRequest::ContactFie
 }
 #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 @@ static RetainPtr<NSDecimalNumber> toDecimalNumber(int64_t value)
     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 @@ static RetainPtr<NSArray> toPKPaymentSummaryItems(const WebCore::PaymentRequest:
     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 @@ static RetainPtr<NSArray> toSupportedNetworks(const Vector<String>& supportedNet
     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 @@ static RetainPtr<NSSet> toNSSet(const Vector<String>& strings)
 }
 #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]);
 
index fee5b20..b10d92e 100644 (file)
@@ -41,7 +41,7 @@ SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationViewController);
 
 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();
 
index 3d70f0e..3e5069a 100644 (file)
@@ -41,7 +41,7 @@ SOFT_LINK_CONSTANT(PassKit, PKExtensionPaymentAuthorizationUIExtensionPointName,
 
 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);
 
index 62f054e..4716e60 100644 (file)
@@ -103,7 +103,7 @@ void WebPaymentCoordinator::openPaymentSetup(const String& merchantIdentifier, c
     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 @@ void WebPaymentCoordinator::didAuthorizePayment(const WebCore::Payment& payment)
     paymentCoordinator().didAuthorizePayment(payment);
 }
 
-void WebPaymentCoordinator::didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod& shippingMethod)
+void WebPaymentCoordinator::didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod)
 {
     paymentCoordinator().didSelectShippingMethod(shippingMethod);
 }
index e353d66..e82ae3e 100644 (file)
@@ -57,7 +57,7 @@ private:
     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 @@ private:
     // 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();
index d8e51a8..d5dc37c 100644 (file)
@@ -28,7 +28,7 @@ messages -> WebPaymentCoordinator {
 
     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()
index 5d18c3d..7977fb8 100644 (file)
@@ -1,3 +1,14 @@
+2017-08-16  Andy Estes  <aestes@apple.com>
+
+        [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  <Yoshiaki.Jitsukawa@sony.com>
 
         [PAL] Move spi/ios and spi/win directories into PAL
index f5eafe3..e81a8ed 100644 (file)
@@ -40,7 +40,7 @@ private:
     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;
index 09b1c42..6aaf00f 100644 (file)
@@ -62,7 +62,7 @@ void WebPaymentCoordinatorClient::openPaymentSetup(const String&, const String&,
     });
 }
 
-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;
 }