[Payment Request] Resolve PaymentRequest.show()'s accept promise when a payment is...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Oct 2017 21:00:45 +0000 (21:00 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Oct 2017 21:00:45 +0000 (21:00 +0000)
commitd3a879a506ec9a7a64637f04409deb469e693030
tree6bafeff31f276c667f7d0c31494e28721844051d
parentf5f83a1e158cbcff6b157761fafa960fc153cc57
[Payment Request] Resolve PaymentRequest.show()'s accept promise when a payment is authorized
https://bugs.webkit.org/show_bug.cgi?id=178609
<rdar://problem/33542813>

Reviewed by Alex Christensen.

Source/WebCore:

This patch implements the logic for resolving PaymentRequest.show()'s accept promise when
the user authorizes a payment, and implements PaymentResponse.complete().

Tests: http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html
       http/tests/paymentrequest/payment-response-complete-method.https.html
       http/tests/paymentrequest/payment-response-methodName-attribute.https.html
       http/tests/paymentrequest/payment-response-payerEmail-attribute.https.html
       http/tests/paymentrequest/payment-response-payerName-attribute.https.html
       http/tests/paymentrequest/payment-response-payerPhone-attribute.https.html

* DerivedSources.make:
* Modules/applepay/ApplePayPaymentContact.h:
* Modules/applepay/Payment.h:
(WebCore::Payment::Payment): Deleted.
(WebCore::Payment::pkPayment const): Deleted.
* Modules/applepay/PaymentContact.h:
(WebCore::PaymentContact::PaymentContact): Deleted.
(WebCore::PaymentContact::pkContact const): Deleted.
* Modules/applepay/cocoa/PaymentContactCocoa.mm:
(WebCore::convert):
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::hasActiveSession):
(WebCore::ApplePayPaymentHandler::ApplePayPaymentHandler):
(WebCore::ApplePayPaymentHandler::document):
(WebCore::ApplePayPaymentHandler::paymentCoordinator):
(WebCore::ApplePayPaymentHandler::convertData):
(WebCore::ApplePayPaymentHandler::show):
(WebCore::ApplePayPaymentHandler::hide):
(WebCore::ApplePayPaymentHandler::canMakePayment):
(WebCore::ApplePayPaymentHandler::complete):
(WebCore::convert):
(WebCore::ApplePayPaymentHandler::didAuthorizePayment):
(WebCore::ApplePayPaymentHandler::didSelectShippingMethod):
(WebCore::ApplePayPaymentHandler::didSelectShippingContact):
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
* Modules/paymentrequest/PaymentAddress.h:
* Modules/paymentrequest/PaymentAddress.idl:
* Modules/paymentrequest/PaymentHandler.cpp:
(WebCore::PaymentHandler::create):
* Modules/paymentrequest/PaymentHandler.h:
* Modules/paymentrequest/PaymentRequest.cpp:
(WebCore::PaymentRequest::show):
(WebCore::PaymentRequest::stop):
(WebCore::PaymentRequest::canMakePayment):
(WebCore::PaymentRequest::canSuspendForDocumentSuspension const):
(WebCore::PaymentRequest::shippingAddressChanged):
(WebCore::PaymentRequest::shippingOptionChanged):
(WebCore::PaymentRequest::accept):
(WebCore::PaymentRequest::complete):
* Modules/paymentrequest/PaymentRequest.h:
* Modules/paymentrequest/PaymentResponse.cpp:
(WebCore::PaymentResponse::PaymentResponse):
(WebCore::PaymentResponse::complete):
* Modules/paymentrequest/PaymentResponse.h:
* WebCore.xcodeproj/project.pbxproj:
* testing/Internals.cpp:
(WebCore::Internals::Internals):
(WebCore::Internals::mockPaymentCoordinator const):
* testing/Internals.h:
* testing/Internals.idl:
* testing/MockPayment.h: Added.
* testing/MockPaymentAddress.h: Added.
* testing/MockPaymentAddress.idl: Added.
* testing/MockPaymentContact.h: Added.
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
(WebCore::MockPaymentCoordinator::openPaymentSetup):
(WebCore::dispatchIfShowing):
(WebCore::MockPaymentCoordinator::showPaymentUI):
(WebCore::MockPaymentCoordinator::completeMerchantValidation):
(WebCore::MockPaymentCoordinator::completePaymentSession):
(WebCore::MockPaymentCoordinator::abortPaymentSession):
(WebCore::MockPaymentCoordinator::cancelPaymentSession):
(WebCore::MockPaymentCoordinator::paymentCoordinatorDestroyed):
* testing/MockPaymentCoordinator.h:
* testing/MockPaymentCoordinator.idl: Added.

LayoutTests:

* http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https-expected.txt: Added.
* http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html: Copied from imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html.
* http/tests/paymentrequest/payment-response-complete-method.https-expected.txt: Added.
* http/tests/paymentrequest/payment-response-complete-method.https.html: Copied from imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html.
* http/tests/paymentrequest/payment-response-methodName-attribute.https-expected.txt: Added.
* http/tests/paymentrequest/payment-response-methodName-attribute.https.html: Copied from imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html.
* http/tests/paymentrequest/payment-response-payerEmail-attribute.https-expected.txt: Added.
* http/tests/paymentrequest/payment-response-payerEmail-attribute.https.html: Copied from imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html.
* http/tests/paymentrequest/payment-response-payerName-attribute.https-expected.txt: Added.
* http/tests/paymentrequest/payment-response-payerName-attribute.https.html: Copied from imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html.
* http/tests/paymentrequest/payment-response-payerPhone-attribute.https-expected.txt: Added.
* http/tests/paymentrequest/payment-response-payerPhone-attribute.https.html: Copied from imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html.
* http/tests/paymentrequest/resources/helpers.js: Copied from imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js.
(test):
(async.getPaymentResponse):
(async.getPaymentRequestResponse):
(async.runTest):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223855 268f45cc-cd09-0410-ab3c-d52691b4dbfc
42 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-complete-method.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-complete-method.https.html [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-methodName-attribute.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-methodName-attribute.https.html [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-payerEmail-attribute.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-payerEmail-attribute.https.html [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-payerName-attribute.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-payerName-attribute.https.html [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-payerPhone-attribute.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/payment-response-payerPhone-attribute.https.html [new file with mode: 0644]
LayoutTests/http/tests/paymentrequest/resources/helpers.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/applepay/ApplePayPaymentContact.h
Source/WebCore/Modules/applepay/Payment.h
Source/WebCore/Modules/applepay/PaymentContact.h
Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm
Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h
Source/WebCore/Modules/paymentrequest/PaymentAddress.cpp [new file with mode: 0644]
Source/WebCore/Modules/paymentrequest/PaymentAddress.h
Source/WebCore/Modules/paymentrequest/PaymentAddress.idl
Source/WebCore/Modules/paymentrequest/PaymentHandler.cpp
Source/WebCore/Modules/paymentrequest/PaymentHandler.h
Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp
Source/WebCore/Modules/paymentrequest/PaymentRequest.h
Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp
Source/WebCore/Modules/paymentrequest/PaymentResponse.h
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/testing/MockPayment.h [new file with mode: 0644]
Source/WebCore/testing/MockPaymentAddress.h [new file with mode: 0644]
Source/WebCore/testing/MockPaymentAddress.idl [new file with mode: 0644]
Source/WebCore/testing/MockPaymentContact.h [new file with mode: 0644]
Source/WebCore/testing/MockPaymentCoordinator.cpp
Source/WebCore/testing/MockPaymentCoordinator.h
Source/WebCore/testing/MockPaymentCoordinator.idl [new file with mode: 0644]