Changeset 241105 in webkit
- Timestamp:
- Feb 6, 2019 3:18:07 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 29 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r241104 r241105 1 2019-02-06 Andy Estes <aestes@apple.com> 2 3 [Payment Request] It should be possible to require a phonetic name for shipping contacts 4 https://bugs.webkit.org/show_bug.cgi?id=194311 5 <rdar://46733045> 6 7 Reviewed by Alex Christensen. 8 9 * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt: 10 * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html: 11 * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt: 12 * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html: 13 * http/tests/ssl/applepay/PaymentRequest.https-expected.txt: 14 * http/tests/ssl/applepay/PaymentRequest.https.html: 15 1 16 2019-02-06 Yusuke Suzuki <ysuzuki@apple.com> 2 17 -
trunk/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt
r235607 r241105 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 6 Test setting required contact fields in a version 2 request. 7 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.name is true 8 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.email is false 9 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.phone is false 10 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.postalAddress is true 11 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.name is true 12 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.email is true 13 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.phone is false 14 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.postalAddress is true 5 15 6 16 Test setting a default shipping contact in a version 2 request. -
trunk/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html
r235607 r241105 84 84 async function runTests() { 85 85 await new Promise((resolve, reject) => { 86 debug("Test setting required contact fields in a version 2 request."); 87 88 var paymentMethod = validPaymentMethod(2, validShippingContact()); 89 paymentMethod.data.requiredBillingContactFields = ["name", "postalAddress"]; 90 paymentMethod.data.requiredShippingContactFields = ["email"]; 91 92 var paymentOptions = validPaymentOptions(); 93 paymentOptions.requestPayerEmail = false; 94 paymentOptions.requestPayerPhone = false; 95 96 var paymentRequest = new PaymentRequest([paymentMethod], validPaymentDetails(), paymentOptions); 97 98 activateThen(() => { 99 paymentRequest.show().then((response) => { 100 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.name", "true"); 101 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.email", "false"); 102 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.phone", "false"); 103 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.postalAddress", "true"); 104 105 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.name", "true"); 106 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.email", "true"); 107 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.phone", "false"); 108 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.postalAddress", "true"); 109 110 response.complete("success"); 111 resolve(); 112 }); 113 114 internals.mockPaymentCoordinator.acceptPayment(); 115 }); 116 }); 117 debug(""); 118 119 await new Promise((resolve, reject) => { 86 120 debug("Test setting a default shipping contact in a version 2 request."); 87 121 -
trunk/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt
r227260 r241105 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 6 Test setting required contact fields in a version 3 request. 7 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.name is false 8 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.phoneticName is false 9 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.email is false 10 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.phone is false 11 PASS internals.mockPaymentCoordinator.requiredBillingContactFields.postalAddress is false 12 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.name is true 13 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.phoneticName is true 14 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.email is true 15 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.phone is true 16 PASS internals.mockPaymentCoordinator.requiredShippingContactFields.postalAddress is true 5 17 6 18 Test setting a default shipping contact in a version 3 request. -
trunk/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html
r227260 r241105 84 84 async function runTests() { 85 85 await new Promise((resolve, reject) => { 86 debug("Test setting required contact fields in a version 3 request."); 87 88 var paymentMethod = validPaymentMethod(3, validShippingContact()); 89 paymentMethod.data.requiredShippingContactFields = ["phoneticName"]; 90 91 var paymentRequest = new PaymentRequest([paymentMethod], validPaymentDetails(), validPaymentOptions()); 92 93 activateThen(() => { 94 paymentRequest.show().then((response) => { 95 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.name", "false"); 96 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.phoneticName", "false"); 97 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.email", "false"); 98 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.phone", "false"); 99 shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.postalAddress", "false"); 100 101 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.name", "true"); 102 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.phoneticName", "true"); 103 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.email", "true"); 104 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.phone", "true"); 105 shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.postalAddress", "true"); 106 107 response.complete("success"); 108 resolve(); 109 }); 110 111 internals.mockPaymentCoordinator.acceptPayment(); 112 }); 113 }); 114 debug(""); 115 116 await new Promise((resolve, reject) => { 86 117 debug("Test setting a default shipping contact in a version 3 request."); 87 118 -
trunk/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt
r235342 r241105 125 125 PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidStateError: The object is in an invalid state.. 126 126 127 Testing ApplePayRequest.requiredShippingContactFields 128 129 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = ''; 130 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence. 131 132 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = null; 133 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence. 134 135 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = 7; 136 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence. 137 138 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = { }; 139 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error. 140 141 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = ['']; 142 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error. 143 144 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [null]; 145 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error. 146 147 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [undefined]; 148 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error. 149 150 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [{}]; 151 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error. 152 153 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = ['invalid']; 154 PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error. 155 156 Testing ApplePayRequest.shippingContact 157 158 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = ''; 159 PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidStateError: The object is in an invalid state.. 160 161 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = 7; 162 PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidStateError: The object is in an invalid state.. 163 127 164 Testing ApplePayRequest.applicationData 128 165 -
trunk/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html
r235342 r241105 142 142 debug("") 143 143 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.billingContact = 7;", "new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 144 debug("") 145 146 debug("Testing ApplePayRequest.requiredShippingContactFields") 147 debug("") 148 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = '';", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 149 debug("") 150 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = null;", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 151 debug("") 152 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = 7;", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 153 debug("") 154 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = { };", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 155 debug("") 156 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [''];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 157 debug("") 158 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [null];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 159 debug("") 160 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [undefined];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 161 debug("") 162 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [{}];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 163 debug("") 164 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = ['invalid'];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 165 debug("") 166 167 debug("Testing ApplePayRequest.shippingContact") 168 debug("") 169 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = '';", "new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 170 debug("") 171 await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = 7;", "new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()") 144 172 debug("") 145 173 -
trunk/Source/WebCore/ChangeLog
r241104 r241105 1 2019-02-06 Andy Estes <aestes@apple.com> 2 3 [Payment Request] It should be possible to require a phonetic name for shipping contacts 4 https://bugs.webkit.org/show_bug.cgi?id=194311 5 <rdar://46733045> 6 7 Reviewed by Alex Christensen. 8 9 It should be possible to require that a shipping contact has a phonetic name in Payment Request. 10 To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to 11 ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data. 12 13 Since required shipping contact fields can now be specified both in 14 requiredShippingContactFields and PaymentOptions, we merge the required fields from these 15 two sources such that, e.g., email is required if it is specified in either place. 16 17 So that clients can detect this new feature, the API version number is bumped from 5 to 6. 18 19 Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html. 20 21 * DerivedSources.make: 22 * Modules/applepay/ApplePayPaymentRequest.h: 23 * Modules/applepay/ApplePayPaymentRequest.idl: 24 * Modules/applepay/ApplePayRequestBase.cpp: 25 (WebCore::convertAndValidate): 26 * Modules/applepay/ApplePayRequestBase.h: 27 * Modules/applepay/ApplePayRequestBase.idl: 28 * Modules/applepay/ApplePaySession.cpp: 29 (WebCore::convertAndValidate): 30 * Modules/applepay/PaymentCoordinatorClient.cpp: Added. 31 (WebCore::PaymentCoordinatorClient::supportsVersion): 32 * Modules/applepay/PaymentCoordinatorClient.h: 33 * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: 34 (WebCore::mergePaymentOptions): 35 (WebCore::ApplePayPaymentHandler::show): 36 * SourcesCocoa.txt: 37 * WebCore.xcodeproj/project.pbxproj: 38 * loader/EmptyClients.cpp: 39 * testing/MockPaymentContactFields.h: Added. 40 (WebCore::MockPaymentContactFields::MockPaymentContactFields): 41 * testing/MockPaymentContactFields.idl: Added. 42 * testing/MockPaymentCoordinator.cpp: 43 (WebCore::MockPaymentCoordinator::showPaymentUI): 44 (WebCore::MockPaymentCoordinator::supportsVersion): Deleted. 45 * testing/MockPaymentCoordinator.h: 46 * testing/MockPaymentCoordinator.idl: 47 1 48 2019-02-06 Yusuke Suzuki <ysuzuki@apple.com> 2 49 -
trunk/Source/WebCore/DerivedSources.make
r241048 r241105 1055 1055 $(WebCore)/testing/MockPageOverlay.idl \ 1056 1056 $(WebCore)/testing/MockPaymentAddress.idl \ 1057 $(WebCore)/testing/MockPaymentContactFields.idl \ 1057 1058 $(WebCore)/testing/MockPaymentCoordinator.idl \ 1058 1059 $(WebCore)/testing/MockPaymentError.idl \ -
trunk/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h
r239427 r241105 1 1 /* 2 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 41 41 String currencyCode; 42 42 43 Optional<Vector<ApplePayContactField>> requiredShippingContactFields;44 45 43 ShippingType shippingType { ShippingType::Shipping }; 46 44 Optional<Vector<ApplePayShippingMethod>> shippingMethods; -
trunk/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.idl
r227140 r241105 1 1 /* 2 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 41 41 required DOMString currencyCode; 42 42 43 sequence<ApplePayContactField> requiredShippingContactFields;44 45 43 ApplePayShippingType shippingType = "shipping"; 46 44 sequence<ApplePayShippingMethod> shippingMethods; -
trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp
r235494 r241105 1 1 /* 2 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 79 79 if (request.billingContact) 80 80 result.setBillingContact(PaymentContact::fromApplePayPaymentContact(version, *request.billingContact)); 81 82 if (request.requiredShippingContactFields) { 83 auto requiredShippingContactFields = convertAndValidate(version, *request.requiredShippingContactFields); 84 if (requiredShippingContactFields.hasException()) 85 return requiredShippingContactFields.releaseException(); 86 result.setRequiredShippingContactFields(requiredShippingContactFields.releaseReturnValue()); 87 } 81 88 82 89 if (request.shippingContact) -
trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.h
r239427 r241105 1 1 /* 2 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 44 44 Optional<ApplePayPaymentContact> billingContact; 45 45 46 Optional<Vector<ApplePayContactField>> requiredShippingContactFields; 46 47 Optional<ApplePayPaymentContact> shippingContact; 47 48 -
trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.idl
r227140 r241105 1 1 /* 2 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 ApplePayPaymentContact billingContact; 35 35 36 sequence<ApplePayContactField> requiredShippingContactFields; 36 37 ApplePayPaymentContact shippingContact; 37 38 -
trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp
r240237 r241105 1 1 /* 2 * Copyright (C) 2015-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 228 228 result.setLineItems(lineItems.releaseReturnValue()); 229 229 230 if (paymentRequest.requiredShippingContactFields) {231 auto requiredShippingContactFields = convertAndValidate(version, WTFMove(*paymentRequest.requiredShippingContactFields));232 if (requiredShippingContactFields.hasException())233 return requiredShippingContactFields.releaseException();234 result.setRequiredShippingContactFields(requiredShippingContactFields.releaseReturnValue());235 }236 237 230 result.setShippingType(paymentRequest.shippingType); 238 231 -
trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp
r241104 r241105 1 1 /* 2 * Copyright (C) 201 6-2017Apple Inc. All rights reserved.2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 [ 27 Conditional=APPLE_PAY, 28 ] enum ApplePayShippingType { 29 "shipping", 30 "delivery", 31 "storePickup", 32 "servicePickup" 33 }; 26 #include "config.h" 27 #include "PaymentCoordinatorClient.h" 34 28 35 [ 36 Conditional=APPLE_PAY, 37 ] dictionary ApplePayPaymentRequest : ApplePayRequestBase { 38 required ApplePayLineItem total; 39 sequence<ApplePayLineItem> lineItems; 29 #if ENABLE(APPLE_PAY) 40 30 41 required DOMString currencyCode; 31 namespace WebCore { 42 32 43 sequence<ApplePayContactField> requiredShippingContactFields; 33 bool PaymentCoordinatorClient::supportsVersion(unsigned version) 34 { 35 ASSERT(version > 0); 44 36 45 ApplePayShippingType shippingType = "shipping"; 46 sequence<ApplePayShippingMethod> shippingMethods; 47 }; 37 #if !ENABLE(APPLE_PAY_SESSION_V3) 38 static const unsigned currentVersion = 2; 39 #elif !ENABLE(APPLE_PAY_SESSION_V4) 40 static const unsigned currentVersion = 3; 41 #else 42 static const unsigned currentVersion = 6; 43 #endif 44 45 return version <= currentVersion; 46 } 47 48 } // namespace WebCore 49 50 #endif // ENABLE(APPLE_PAY) -
trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h
r239427 r241105 1 1 /* 2 * Copyright (C) 2015-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 46 46 class PaymentCoordinatorClient { 47 47 public: 48 virtual bool supportsVersion(unsigned version) = 0; 48 bool supportsVersion(unsigned version); 49 49 50 virtual Optional<String> validatedPaymentNetwork(const String&) = 0; 50 51 virtual bool canMakePayments() = 0; -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
r239461 r241105 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 130 130 } 131 131 132 static ApplePaySessionPaymentRequest::ContactFields convert(const PaymentOptions& options)133 {134 ApplePaySessionPaymentRequest::ContactFields result;135 result.email = options.requestPayerEmail;136 result.name = options.requestPayerName;137 result.phone = options.requestPayerPhone;138 result.postalAddress = options.requestShipping;139 return result;140 }141 142 132 static ApplePaySessionPaymentRequest::ShippingType convert(PaymentShippingType type) 143 133 { … … 183 173 } 184 174 175 static void mergePaymentOptions(const PaymentOptions& options, ApplePaySessionPaymentRequest& request) 176 { 177 auto requiredShippingContactFields = request.requiredShippingContactFields(); 178 requiredShippingContactFields.email |= options.requestPayerEmail; 179 requiredShippingContactFields.name |= options.requestPayerName; 180 requiredShippingContactFields.phone |= options.requestPayerPhone; 181 requiredShippingContactFields.postalAddress |= options.requestShipping; 182 request.setRequiredShippingContactFields(requiredShippingContactFields); 183 184 if (options.requestShipping) 185 request.setShippingType(convert(options.shippingType)); 186 } 187 185 188 ExceptionOr<void> ApplePayPaymentHandler::show() 186 189 { … … 204 207 request.setLineItems(convertedLineItems.releaseReturnValue()); 205 208 206 request.setRequiredShippingContactFields(convert(m_paymentRequest->paymentOptions())); 207 if (m_paymentRequest->paymentOptions().requestShipping) 208 request.setShippingType(convert(m_paymentRequest->paymentOptions().shippingType)); 209 mergePaymentOptions(m_paymentRequest->paymentOptions(), request); 209 210 210 211 auto shippingMethods = computeShippingMethods(); -
trunk/Source/WebCore/SourcesCocoa.txt
r240963 r241105 1 // Copyright (C) 2017-201 8Apple Inc. All rights reserved.1 // Copyright (C) 2017-2019 Apple Inc. All rights reserved. 2 2 // 3 3 // Redistribution and use in source and binary forms, with or without … … 589 589 Modules/applepay/ApplePayValidateMerchantEvent.cpp 590 590 Modules/applepay/PaymentCoordinator.cpp 591 Modules/applepay/PaymentCoordinatorClient.cpp 591 592 Modules/applepay/PaymentRequestValidator.mm 592 593 Modules/applepay/PaymentSession.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r241048 r241105 2943 2943 A0EE0DF7144F825500F80B0D /* WebGLDebugShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */; }; 2944 2944 A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */; }; 2945 A104EC5A220A3DE000CBF67A /* MockPaymentContactFields.h in Headers */ = {isa = PBXBuildFile; fileRef = A104EC55220A39B400CBF67A /* MockPaymentContactFields.h */; }; 2946 A104EC5D220A3E4B00CBF67A /* JSMockPaymentContactFields.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A104EC5B220A3E4300CBF67A /* JSMockPaymentContactFields.cpp */; }; 2947 A104EC5E220A3E4E00CBF67A /* JSMockPaymentContactFields.h in Headers */ = {isa = PBXBuildFile; fileRef = A104EC5C220A3E4400CBF67A /* JSMockPaymentContactFields.h */; }; 2945 2948 A104F24414C71F7A009E2C23 /* CachedSVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2946 2949 A10BB5851484E3A700B2E87A /* RenderSVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5831484E3A700B2E87A /* RenderSVGRect.h */; }; … … 11140 11143 A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLDebugShaders.cpp; sourceTree = "<group>"; }; 11141 11144 A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLDebugShaders.h; sourceTree = "<group>"; }; 11145 A104EC53220A017400CBF67A /* PaymentCoordinatorClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentCoordinatorClient.cpp; sourceTree = "<group>"; }; 11146 A104EC55220A39B400CBF67A /* MockPaymentContactFields.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockPaymentContactFields.h; sourceTree = "<group>"; }; 11147 A104EC57220A39B400CBF67A /* MockPaymentContactFields.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockPaymentContactFields.idl; sourceTree = "<group>"; }; 11148 A104EC5B220A3E4300CBF67A /* JSMockPaymentContactFields.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockPaymentContactFields.cpp; sourceTree = "<group>"; }; 11149 A104EC5C220A3E4400CBF67A /* JSMockPaymentContactFields.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSMockPaymentContactFields.h; sourceTree = "<group>"; }; 11142 11150 A104F24114C71F7A009E2C23 /* CachedSVGDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedSVGDocument.cpp; sourceTree = "<group>"; }; 11143 11151 A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGDocument.h; sourceTree = "<group>"; }; … … 16755 16763 1A58E86B1D19E42D00C0EA73 /* PaymentCoordinator.cpp */, 16756 16764 1A58E86C1D19E42D00C0EA73 /* PaymentCoordinator.h */, 16765 A104EC53220A017400CBF67A /* PaymentCoordinatorClient.cpp */, 16757 16766 1A58E8621D19D3BF00C0EA73 /* PaymentCoordinatorClient.h */, 16758 16767 7CF930E61E01F9AD00BAFFBE /* PaymentHeaders.h */, … … 17861 17870 A146D31E1F99C9C200D29196 /* MockPaymentAddress.idl */, 17862 17871 A146D3241F99D69800D29196 /* MockPaymentContact.h */, 17872 A104EC55220A39B400CBF67A /* MockPaymentContactFields.h */, 17873 A104EC57220A39B400CBF67A /* MockPaymentContactFields.idl */, 17863 17874 A1AFEDE51F8BFF6D0087013F /* MockPaymentCoordinator.cpp */, 17864 17875 A1AFEDE41F8BFF6D0087013F /* MockPaymentCoordinator.h */, … … 17902 17913 A146D3201F99CA3E00D29196 /* JSMockPaymentAddress.cpp */, 17903 17914 A146D31F1F99CA3D00D29196 /* JSMockPaymentAddress.h */, 17915 A104EC5B220A3E4300CBF67A /* JSMockPaymentContactFields.cpp */, 17916 A104EC5C220A3E4400CBF67A /* JSMockPaymentContactFields.h */, 17904 17917 A146D3191F99BCBB00D29196 /* JSMockPaymentCoordinator.cpp */, 17905 17918 A146D3181F99BCBA00D29196 /* JSMockPaymentCoordinator.h */, … … 28264 28277 538EC9341F99B9F7004D22A8 /* JSMockPageOverlay.h in Headers */, 28265 28278 A146D3231F99D0EF00D29196 /* JSMockPaymentAddress.h in Headers */, 28279 A104EC5E220A3E4E00CBF67A /* JSMockPaymentContactFields.h in Headers */, 28266 28280 A146D31B1F99BCFB00D29196 /* JSMockPaymentCoordinator.h in Headers */, 28267 28281 A1BB85B92159B3AE0067E07D /* JSMockPaymentError.h in Headers */, … … 28279 28293 A146D3211F99CB1A00D29196 /* MockPaymentAddress.h in Headers */, 28280 28294 A146D3251F99D69800D29196 /* MockPaymentContact.h in Headers */, 28295 A104EC5A220A3DE000CBF67A /* MockPaymentContactFields.h in Headers */, 28281 28296 A1AFEDE61F8BFF6D0087013F /* MockPaymentCoordinator.h in Headers */, 28282 28297 A1CBEF641F9F11290028DE7C /* MockPaymentMethod.h in Headers */, … … 32838 32853 2D4150DE1C1F868C000A3BA2 /* JSMockPageOverlay.cpp in Sources */, 32839 32854 A146D3221F99D0EC00D29196 /* JSMockPaymentAddress.cpp in Sources */, 32855 A104EC5D220A3E4B00CBF67A /* JSMockPaymentContactFields.cpp in Sources */, 32840 32856 A146D31A1F99BCF800D29196 /* JSMockPaymentCoordinator.cpp in Sources */, 32841 32857 A1BB85B82159B3A40067E07D /* JSMockPaymentError.cpp in Sources */, -
trunk/Source/WebCore/loader/EmptyClients.cpp
r240909 r241105 1 1 /* 2 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2008-201 8Apple Inc. All rights reserved.3 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 4 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 5 * … … 313 313 314 314 class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient { 315 bool supportsVersion(unsigned) final { return false; }316 315 Optional<String> validatedPaymentNetwork(const String&) final { return WTF::nullopt; } 317 316 bool canMakePayments() final { return false; } -
trunk/Source/WebCore/testing/MockPaymentContactFields.h
r241104 r241105 1 1 /* 2 * Copyright (C) 201 6-2017Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 [ 27 Conditional=APPLE_PAY, 28 ] enum ApplePayShippingType { 29 "shipping", 30 "delivery", 31 "storePickup", 32 "servicePickup" 26 #pragma once 27 28 #if ENABLE(APPLE_PAY) 29 30 #include "ApplePaySessionPaymentRequest.h" 31 32 namespace WebCore { 33 34 struct MockPaymentContactFields : public ApplePaySessionPaymentRequest::ContactFields { 35 MockPaymentContactFields() = default; 36 MockPaymentContactFields(const ApplePaySessionPaymentRequest::ContactFields& contactFields) 37 : ApplePaySessionPaymentRequest::ContactFields { contactFields } 38 { 39 } 33 40 }; 34 41 35 [ 36 Conditional=APPLE_PAY, 37 ] dictionary ApplePayPaymentRequest : ApplePayRequestBase { 38 required ApplePayLineItem total; 39 sequence<ApplePayLineItem> lineItems; 42 } // namespace WebCore 40 43 41 required DOMString currencyCode; 42 43 sequence<ApplePayContactField> requiredShippingContactFields; 44 45 ApplePayShippingType shippingType = "shipping"; 46 sequence<ApplePayShippingMethod> shippingMethods; 47 }; 44 #endif // ENABLE(APPLE_PAY) -
trunk/Source/WebCore/testing/MockPaymentContactFields.idl
r241104 r241105 1 1 /* 2 * Copyright (C) 201 6-2017Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 [ 27 27 Conditional=APPLE_PAY, 28 ] enum ApplePayShippingType { 29 "shipping", 30 "delivery", 31 "storePickup", 32 "servicePickup" 28 JSGenerateToJSObject, 29 ] dictionary MockPaymentContactFields { 30 boolean postalAddress = false; 31 boolean phone = false; 32 boolean email = false; 33 boolean name = false; 34 boolean phoneticName = false; 33 35 }; 34 35 [36 Conditional=APPLE_PAY,37 ] dictionary ApplePayPaymentRequest : ApplePayRequestBase {38 required ApplePayLineItem total;39 sequence<ApplePayLineItem> lineItems;40 41 required DOMString currencyCode;42 43 sequence<ApplePayContactField> requiredShippingContactFields;44 45 ApplePayShippingType shippingType = "shipping";46 sequence<ApplePayShippingMethod> shippingMethods;47 }; -
trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp
r239427 r241105 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 54 54 } 55 55 56 bool MockPaymentCoordinator::supportsVersion(unsigned version)57 {58 ASSERT(version > 0);59 60 #if !ENABLE(APPLE_PAY_SESSION_V3)61 static const unsigned currentVersion = 2;62 #elif !ENABLE(APPLE_PAY_SESSION_V4)63 static const unsigned currentVersion = 3;64 #else65 static const unsigned currentVersion = 5;66 #endif67 68 return version <= currentVersion;69 }70 71 56 Optional<String> MockPaymentCoordinator::validatedPaymentNetwork(const String& paymentNetwork) 72 57 { … … 120 105 m_shippingAddress = request.shippingContact().toApplePayPaymentContact(request.version()); 121 106 m_shippingMethods = convert(request.shippingMethods()); 107 m_requiredBillingContactFields = request.requiredBillingContactFields(); 108 m_requiredShippingContactFields = request.requiredShippingContactFields(); 122 109 123 110 ASSERT(showCount == hideCount); -
trunk/Source/WebCore/testing/MockPaymentCoordinator.h
r239427 r241105 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 #include "ApplePayShippingMethod.h" 32 32 #include "MockPaymentAddress.h" 33 #include "MockPaymentContactFields.h" 33 34 #include "MockPaymentError.h" 34 35 #include "PaymentCoordinatorClient.h" … … 57 58 const Vector<MockPaymentError>& errors() const { return m_errors; } 58 59 const Vector<ApplePayShippingMethod>& shippingMethods() const { return m_shippingMethods; } 60 const MockPaymentContactFields& requiredBillingContactFields() const { return m_requiredBillingContactFields; } 61 const MockPaymentContactFields& requiredShippingContactFields() const { return m_requiredShippingContactFields; } 59 62 60 63 void ref() const { } … … 62 65 63 66 private: 64 bool supportsVersion(unsigned) final;65 67 Optional<String> validatedPaymentNetwork(const String&) final; 66 68 bool canMakePayments() final; … … 90 92 Vector<ApplePayShippingMethod> m_shippingMethods; 91 93 HashSet<String, ASCIICaseInsensitiveHash> m_availablePaymentNetworks; 94 MockPaymentContactFields m_requiredBillingContactFields; 95 MockPaymentContactFields m_requiredShippingContactFields; 92 96 }; 93 97 -
trunk/Source/WebCore/testing/MockPaymentCoordinator.idl
r237594 r241105 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 40 40 readonly attribute sequence<MockPaymentError> errors; 41 41 readonly attribute sequence<ApplePayShippingMethod> shippingMethods; 42 readonly attribute MockPaymentContactFields requiredBillingContactFields; 43 readonly attribute MockPaymentContactFields requiredShippingContactFields; 42 44 }; -
trunk/Source/WebKit/ChangeLog
r241103 r241105 1 2019-02-06 Andy Estes <aestes@apple.com> 2 3 [Payment Request] It should be possible to require a phonetic name for shipping contacts 4 https://bugs.webkit.org/show_bug.cgi?id=194311 5 <rdar://46733045> 6 7 Reviewed by Alex Christensen. 8 9 * WebProcess/ApplePay/WebPaymentCoordinator.cpp: 10 (WebKit::WebPaymentCoordinator::supportsVersion): Deleted. 11 * WebProcess/ApplePay/WebPaymentCoordinator.h: 12 1 13 2019-02-06 Keith Rollin <krollin@apple.com> 2 14 -
trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp
r239427 r241105 1 1 /* 2 * Copyright (C) 2015-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 52 52 } 53 53 54 bool WebPaymentCoordinator::supportsVersion(unsigned version)55 {56 ASSERT(version > 0);57 58 #if !ENABLE(APPLE_PAY_SESSION_V3)59 static const unsigned currentVersion = 2;60 #elif !ENABLE(APPLE_PAY_SESSION_V4)61 static const unsigned currentVersion = 3;62 #else63 static const unsigned currentVersion = 5;64 #endif65 66 return version <= currentVersion;67 }68 69 54 const WebPaymentCoordinator::AvailablePaymentNetworksSet& WebPaymentCoordinator::availablePaymentNetworks() 70 55 { -
trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h
r239427 r241105 1 1 /* 2 * Copyright (C) 2015-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 56 56 private: 57 57 // WebCore::PaymentCoordinatorClient. 58 bool supportsVersion(unsigned version) override;59 58 Optional<String> validatedPaymentNetwork(const String&) override; 60 59 bool canMakePayments() override; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r240949 r241105 1 2019-02-06 Andy Estes <aestes@apple.com> 2 3 [Payment Request] It should be possible to require a phonetic name for shipping contacts 4 https://bugs.webkit.org/show_bug.cgi?id=194311 5 <rdar://46733045> 6 7 Reviewed by Alex Christensen. 8 9 * WebCoreSupport/WebPaymentCoordinatorClient.h: 10 * WebCoreSupport/WebPaymentCoordinatorClient.mm: 11 (WebPaymentCoordinatorClient::supportsVersion): Deleted. 12 1 13 2019-02-04 Said Abou-Hallawa <said@apple.com> 2 14 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h
r239427 r241105 1 1 /* 2 * Copyright (C) 2015-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 ~WebPaymentCoordinatorClient(); 38 38 39 bool supportsVersion(unsigned) override;40 39 Optional<String> validatedPaymentNetwork(const String&) override; 41 40 bool canMakePayments() override; -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm
r239427 r241105 1 1 /* 2 * Copyright (C) 2015-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 WebPaymentCoordinatorClient::~WebPaymentCoordinatorClient() 38 38 { 39 }40 41 bool WebPaymentCoordinatorClient::supportsVersion(unsigned)42 {43 return false;44 39 } 45 40
Note: See TracChangeset
for help on using the changeset viewer.