[Payment Request] Support a default shipping address for Apple Pay
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jan 2018 15:42:08 +0000 (15:42 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jan 2018 15:42:08 +0000 (15:42 +0000)
commita5b6d8878350a8cc1033d41de627972cc9e35d13
treef428c77f4f15979a5a35bdb677f9a50cfef01008
parent9f0b348d421a1173f4110fc68969294811b6da90
[Payment Request] Support a default shipping address for Apple Pay
https://bugs.webkit.org/show_bug.cgi?id=181754
<rdar://problem/36009733>

Reviewed by Brady Eidson.

Source/WebCore:

Move shippingContact from ApplePayPaymentRequest to ApplePayRequestBase. This allows
merchants to specify a default shipping address when using Apple Pay with Payment Request.

This also fixes a bug found during testing where
+[NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:style:options:]
would throw an exception when passed a nil NSPersonNameComponents.

Test: http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html

* Modules/applepay/ApplePayPaymentRequest.h:
* Modules/applepay/ApplePayPaymentRequest.idl:
* Modules/applepay/ApplePayRequestBase.cpp:
(WebCore::convertAndValidate):
* Modules/applepay/ApplePayRequestBase.h:
* Modules/applepay/ApplePayRequestBase.idl:
* Modules/applepay/ApplePaySession.cpp:
(WebCore::convertAndValidate):
* Modules/applepay/ApplePaySessionPaymentRequest.h:
(WebCore::ApplePaySessionPaymentRequest::version const):
(WebCore::ApplePaySessionPaymentRequest::setVersion):
* Modules/applepay/cocoa/PaymentContactCocoa.mm:
(WebCore::convert):
* Modules/applepay/paymentrequest/ApplePayRequest.idl:
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::showPaymentUI):
(WebCore::MockPaymentCoordinator::completeMerchantValidation):
* testing/MockPaymentCoordinator.h:

LayoutTests:

* http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt: Added.
* http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227140 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h
Source/WebCore/Modules/applepay/ApplePayPaymentRequest.idl
Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp
Source/WebCore/Modules/applepay/ApplePayRequestBase.h
Source/WebCore/Modules/applepay/ApplePayRequestBase.idl
Source/WebCore/Modules/applepay/ApplePaySession.cpp
Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h
Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm
Source/WebCore/Modules/applepay/paymentrequest/ApplePayRequest.idl
Source/WebCore/testing/MockPaymentCoordinator.cpp
Source/WebCore/testing/MockPaymentCoordinator.h