Title: [262439] branches/safari-609-branch
Revision
262439
Author
[email protected]
Date
2020-06-02 14:19:51 -0700 (Tue, 02 Jun 2020)

Log Message

Apply patch. rdar://problem/63626670

    2020-05-22  Andy Estes  <[email protected]>

    [Apple Pay] Add new ApplePayInstallmentConfiguration members
    https://bugs.webkit.org/show_bug.cgi?id=212160
    <rdar://problem/60703650>

    Reviewed by Alex Christensen.

Source/WebCore:

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

    * DerivedSources-input.xcfilelist:
    * DerivedSources-output.xcfilelist:
    * DerivedSources.make:
    * SourcesCocoa.txt:
    * WebCore.xcodeproj/project.pbxproj: Added IDLs, headers, and derived sources for
    ApplePayInstallment{Item,ItemType,RetailChannel}.

    * Modules/applepay/ApplePayInstallmentConfiguration.idl:
    * Modules/applepay/ApplePayInstallmentConfigurationWebCore.h: Added items,
    applicationMetadata, and retailChannel members. Added missing conditionals to
    merchantIdentifier and referrerIdentifier.

    * Modules/applepay/ApplePayInstallmentItem.h:
    * Modules/applepay/ApplePayInstallmentItem.idl:
    * Modules/applepay/ApplePayInstallmentItemType.h:
    * Modules/applepay/ApplePayInstallmentItemType.idl:
    * Modules/applepay/ApplePayInstallmentRetailChannel.h:
    * Modules/applepay/ApplePayInstallmentRetailChannel.idl: Added.

    * Modules/applepay/ApplePayRequestBase.cpp:
    (WebCore::convertAndValidate): Changed to call PaymentInstallmentConfiguration::create,
    returning an exception if present.

    * Modules/applepay/PaymentInstallmentConfiguration.mm:
    (WebCore::fromDecimalNumber): Allowed for a large maximum number of fractional digits to
    support formatting high-precision currency and APRs (note that this formatter is only used
    for test support).

    (WebCore::applePayItemType):
    (WebCore::platformItemType): Added to convert between PKInstallmentItemType and
    ApplePayInstallmentItemType.

    (WebCore::applePayRetailChannel):
    (WebCore::platformRetailChannel): Added to convert between PKInstallmentRetailChannel and
    ApplePayInstallmentRetailChannel.

    (WebCore::makeNSArrayElement):
    (WebCore::makeVectorElement): Added to convert between NSArray<PKPaymentInstallmentItem *>
    and Vector<ApplePayInstallmentItem>.

    (WebCore::createPlatformConfiguration): Added a parameter for passing in applicationMetadata
    as an NSDictionary. Set properties on PKPaymentInstallmentConfiguration for new
    ApplePayInstallmentConfiguration members.
    (WebCore::PaymentInstallmentConfiguration::create): Added; converts the applicationMetadata
    JSON string (if present) to an NSDictionary, returning a TypeError if the JSON string does
    not deserialize to an NSDictionary (as PassKit requires).
    (WebCore::PaymentInstallmentConfiguration::PaymentInstallmentConfiguration): Added a
    parameter for passing in applicationMetadata as an NSDictionary. Made private.
    (WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const): Set
    members on ApplePayInstallmentConfiguration for new PKPaymentInstallmentConfiguration
    properties.

    * Modules/applepay/PaymentInstallmentConfigurationWebCore.h:

LayoutTests:

    * http/tests/ssl/applepay/ApplePayInstallmentItems.https-expected.txt:
    * http/tests/ssl/applepay/ApplePayInstallmentItems.https.html: Added.
    * platform/mac-wk2/TestExpectations: Skipped test on Mojave and Catalina.

Modified Paths

Added Paths

Diff

Modified: branches/safari-609-branch/LayoutTests/ChangeLog (262438 => 262439)


--- branches/safari-609-branch/LayoutTests/ChangeLog	2020-06-02 20:44:06 UTC (rev 262438)
+++ branches/safari-609-branch/LayoutTests/ChangeLog	2020-06-02 21:19:51 UTC (rev 262439)
@@ -1,3 +1,19 @@
+2020-06-02  Andy Estes  <[email protected]>
+
+        Apply patch. rdar://problem/63626670
+
+    2020-05-22  Andy Estes  <[email protected]>
+
+            [Apple Pay] Add new ApplePayInstallmentConfiguration members
+            https://bugs.webkit.org/show_bug.cgi?id=212160
+            <rdar://problem/60703650>
+
+            Reviewed by Alex Christensen.
+
+            * http/tests/ssl/applepay/ApplePayInstallmentItems.https-expected.txt:
+            * http/tests/ssl/applepay/ApplePayInstallmentItems.https.html: Added.
+            * platform/mac-wk2/TestExpectations: Skipped test on Mojave and Catalina.
+
 2020-05-20  Russell Epstein  <[email protected]>
 
         Apply patch. rdar://problem/63343507

Added: branches/safari-609-branch/LayoutTests/http/tests/ssl/applepay/ApplePayInstallmentItems.https-expected.txt (0 => 262439)


--- branches/safari-609-branch/LayoutTests/http/tests/ssl/applepay/ApplePayInstallmentItems.https-expected.txt	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/http/tests/ssl/applepay/ApplePayInstallmentItems.https-expected.txt	2020-06-02 21:19:51 UTC (rev 262439)
@@ -0,0 +1,61 @@
+Test ApplePayInstallmentItem and friends.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test installmentConfiguration.items
+PASS request = validRequest(); request.installmentConfiguration.items = 4; new ApplePaySession(apiVersion, request) threw exception TypeError: Value is not a sequence.
+PASS request = validRequest(); request.installmentConfiguration.items = ""; new ApplePaySession(apiVersion, request) threw exception TypeError: Value is not a sequence.
+PASS request = validRequest(); request.installmentConfiguration.items = null; new ApplePaySession(apiVersion, request) threw exception TypeError: Value is not a sequence.
+PASS request = validRequest(); request.installmentConfiguration.items = true; new ApplePaySession(apiVersion, request) threw exception TypeError: Value is not a sequence.
+PASS request = validRequest(); request.installmentConfiguration.items = new Date(); new ApplePaySession(apiVersion, request) threw exception TypeError: Type error.
+PASS request = validRequest(); request.installmentConfiguration.items = ["a", "b"]; new ApplePaySession(apiVersion, request) threw exception TypeError: Type error.
+PASS request = validRequest(); request.installmentConfiguration.items = [{type: 4}]; new ApplePaySession(apiVersion, request) threw exception TypeError: Type error.
+PASS request = validRequest(); request.installmentConfiguration.items = [{type: "invalid"}]; new ApplePaySession(apiVersion, request) threw exception TypeError: Type error.
+PASS request = validRequest(); request.installmentConfiguration.items = undefined; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.items = []; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.items = [{}]; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.items = [{type: undefined}]; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.items = [{type: "generic"}]; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.items = [{type: "phone"}]; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.items = [{type: "pad"}]; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.items = [{type: "watch"}]; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.items = [{type: "mac"}]; new ApplePaySession(apiVersion, request) did not throw exception.
+
+Test installmentConfiguration.applicationMetadata
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = 4; new ApplePaySession(apiVersion, request) threw exception TypeError: applicationMetadata must be a JSON object.
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = ""; new ApplePaySession(apiVersion, request) threw exception TypeError: applicationMetadata must be a JSON object.
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = null; new ApplePaySession(apiVersion, request) threw exception TypeError: applicationMetadata must be a JSON object.
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = true; new ApplePaySession(apiVersion, request) threw exception TypeError: applicationMetadata must be a JSON object.
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = new Date(); new ApplePaySession(apiVersion, request) threw exception TypeError: applicationMetadata must be a JSON object.
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = ["a", "b"]; new ApplePaySession(apiVersion, request) threw exception TypeError: applicationMetadata must be a JSON object.
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = undefined; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = {}; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.applicationMetadata = {"foo": "bar"}; new ApplePaySession(apiVersion, request) did not throw exception.
+
+Test installmentConfiguration.retailChannel
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = null; new ApplePaySession(apiVersion, request) threw exception TypeError: Type error.
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = 4; new ApplePaySession(apiVersion, request) threw exception TypeError: Type error.
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = ""; new ApplePaySession(apiVersion, request) threw exception TypeError: Type error.
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = "invalid"; new ApplePaySession(apiVersion, request) threw exception TypeError: Type error.
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = undefined; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = "unknown"; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = "app"; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = "web"; new ApplePaySession(apiVersion, request) did not throw exception.
+PASS request = validRequest(); request.installmentConfiguration.retailChannel = "inStore"; new ApplePaySession(apiVersion, request) did not throw exception.
+
+Test platform conversion
+PASS internals.mockPaymentCoordinator.installmentConfiguration.items.length is 2
+PASS internals.mockPaymentCoordinator.installmentConfiguration.items[0].type is expectedItemType
+PASS internals.mockPaymentCoordinator.installmentConfiguration.items[0].amount is expectedItemAmount
+PASS internals.mockPaymentCoordinator.installmentConfiguration.items[0].currencyCode is expectedCurrencyCode
+PASS internals.mockPaymentCoordinator.installmentConfiguration.items[0].programIdentifier is expectedProgramIdentifier
+PASS internals.mockPaymentCoordinator.installmentConfiguration.items[0].apr is expectedAPR
+PASS internals.mockPaymentCoordinator.installmentConfiguration.items[0].programTerms is expectedProgramTerms
+PASS internals.mockPaymentCoordinator.installmentConfiguration.items[1].type is "generic"
+PASS JSON.stringify(internals.mockPaymentCoordinator.installmentConfiguration.applicationMetadata) is JSON.stringify(expectedApplicationMetadata, Object.keys(expectedApplicationMetadata).sort())
+PASS internals.mockPaymentCoordinator.installmentConfiguration.retailChannel is expectedRetailChannel
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-609-branch/LayoutTests/http/tests/ssl/applepay/ApplePayInstallmentItems.https.html (0 => 262439)


--- branches/safari-609-branch/LayoutTests/http/tests/ssl/applepay/ApplePayInstallmentItems.https.html	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/http/tests/ssl/applepay/ApplePayInstallmentItems.https.html	2020-06-02 21:19:51 UTC (rev 262439)
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8'>
+<script src=''></script>
+<script src=''></script>
+<script src=''></script>
+</head>
+<body>
+<script>
+
+description('Test ApplePayInstallmentItem and friends.');
+
+jsTestIsAsync = true;
+
+apiVersion = 9;
+
+expectedAPR = '3.875';
+expectedApplicationMetadata = { integer: 1, float: 2.1, string: 'string', date: new Date(), bool: true, array: ['a', 'b'], null: null };
+expectedBindingTotalAmount = '1.00';
+expectedCurrencyCode = 'USD';
+expectedFeatureType = 'appleCard';
+expectedIsInStorePurchase = false;
+expectedItemAmount = '31.45';
+expectedItemType = "mac";
+expectedMerchandisingImageData = 'dGVzdA==';
+expectedMerchantIdentifier = 'merchant';
+expectedOpenToBuyThresholdAmount = '2.50';
+expectedProgramIdentifier = 'programIdentifier';
+expectedProgramTerms = 'programTerms';
+expectedReferrerIdentifier = 'referrer';
+expectedRetailChannel = 'web';
+
+let validRequest = () => {
+    return {
+        countryCode: 'US',
+        currencyCode: 'USD',
+        supportedNetworks: ['visa', 'masterCard'],
+        merchantCapabilities: ['supports3DS'],
+        total: { label: 'Your Label', amount: '10.00' },
+        installmentConfiguration: {
+            bindingTotalAmount: expectedBindingTotalAmount,
+            currencyCode: expectedCurrencyCode,
+            merchandisingImageData: expectedMerchandisingImageData,
+            merchantIdentifier: expectedMerchantIdentifier,
+            openToBuyThresholdAmount: expectedOpenToBuyThresholdAmount,
+            referrerIdentifier: expectedReferrerIdentifier,
+            items: [{
+                type: expectedItemType,
+                amount: expectedItemAmount,
+                currencyCode: expectedCurrencyCode,
+                programIdentifier: expectedProgramIdentifier,
+                apr: expectedAPR,
+                programTerms: expectedProgramTerms,
+            }, {
+            }],
+            applicationMetadata: expectedApplicationMetadata,
+            retailChannel: expectedRetailChannel,
+        },
+    };
+};
+
+activateThen(() => {
+
+    debug('Test installmentConfiguration.items');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.items = 4; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.items = ""; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.items = null; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.items = true; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.items = new Date(); new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.items = ["a", "b"]; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.items = [{type: 4}]; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.items = [{type: "invalid"}]; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = undefined; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = []; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = [{}]; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = [{type: undefined}]; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = [{type: "generic"}]; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = [{type: "phone"}]; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = [{type: "pad"}]; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = [{type: "watch"}]; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.items = [{type: "mac"}]; new ApplePaySession(apiVersion, request)');
+    debug('');
+
+    debug('Test installmentConfiguration.applicationMetadata');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = 4; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = ""; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = null; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = true; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = new Date(); new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = ["a", "b"]; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = undefined; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = {}; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.applicationMetadata = {"foo": "bar"}; new ApplePaySession(apiVersion, request)');
+    debug('');
+
+    debug('Test installmentConfiguration.retailChannel');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.retailChannel = null; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.retailChannel = 4; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.retailChannel = ""; new ApplePaySession(apiVersion, request)');
+    shouldThrow('request = validRequest(); request.installmentConfiguration.retailChannel = "invalid"; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.retailChannel = undefined; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.retailChannel = "unknown"; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.retailChannel = "app"; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.retailChannel = "web"; new ApplePaySession(apiVersion, request)');
+    shouldNotThrow('request = validRequest(); request.installmentConfiguration.retailChannel = "inStore"; new ApplePaySession(apiVersion, request)');
+    debug('');
+
+    debug('Test platform conversion');
+    let session = new ApplePaySession(apiVersion, validRequest());
+    session.begin();
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.items.length', '2');
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.items[0].type', 'expectedItemType');
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.items[0].amount', 'expectedItemAmount');
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.items[0].currencyCode', 'expectedCurrencyCode');
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.items[0].programIdentifier', 'expectedProgramIdentifier');
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.items[0].apr', 'expectedAPR');
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.items[0].programTerms', 'expectedProgramTerms');
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.items[1].type', '"generic"');
+    shouldBe('JSON.stringify(internals.mockPaymentCoordinator.installmentConfiguration.applicationMetadata)', 'JSON.stringify(expectedApplicationMetadata, Object.keys(expectedApplicationMetadata).sort())');
+    shouldBe('internals.mockPaymentCoordinator.installmentConfiguration.retailChannel', 'expectedRetailChannel');
+
+    finishJSTest();
+});
+
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/safari-609-branch/LayoutTests/platform/mac-wk2/TestExpectations (262438 => 262439)


--- branches/safari-609-branch/LayoutTests/platform/mac-wk2/TestExpectations	2020-06-02 20:44:06 UTC (rev 262438)
+++ branches/safari-609-branch/LayoutTests/platform/mac-wk2/TestExpectations	2020-06-02 21:19:51 UTC (rev 262439)
@@ -46,6 +46,9 @@
 [ HighSierra ] http/tests/ssl/applepay/ApplePaySessionV5.html [ Skip ]
 [ HighSierra ] accessibility/mac/apple-pay-session-v4.html [ Skip ]
 
+# ApplePayInstallmentItem is not available in Mojave.
+[ Mojave ] http/tests/ssl/applepay/ApplePayInstallmentItems.https.html [ Skip ]
+
 fast/visual-viewport/rubberbanding-viewport-rects.html [ Pass ]
 fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html  [ Pass ]
 

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (262438 => 262439)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-06-02 20:44:06 UTC (rev 262438)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-06-02 21:19:51 UTC (rev 262439)
@@ -1,3 +1,71 @@
+2020-06-02  Andy Estes  <[email protected]>
+
+        Apply patch. rdar://problem/63626670
+
+    2020-05-22  Andy Estes  <[email protected]>
+
+            [Apple Pay] Add new ApplePayInstallmentConfiguration members
+            https://bugs.webkit.org/show_bug.cgi?id=212160
+            <rdar://problem/60703650>
+
+            Reviewed by Alex Christensen.
+
+            Test: http/tests/ssl/applepay/ApplePayInstallmentItems.https.html
+
+            * DerivedSources-input.xcfilelist:
+            * DerivedSources-output.xcfilelist:
+            * DerivedSources.make:
+            * SourcesCocoa.txt:
+            * WebCore.xcodeproj/project.pbxproj: Added IDLs, headers, and derived sources for
+            ApplePayInstallment{Item,ItemType,RetailChannel}.
+
+            * Modules/applepay/ApplePayInstallmentConfiguration.idl:
+            * Modules/applepay/ApplePayInstallmentConfigurationWebCore.h: Added items,
+            applicationMetadata, and retailChannel members. Added missing conditionals to
+            merchantIdentifier and referrerIdentifier.
+
+            * Modules/applepay/ApplePayInstallmentItem.h:
+            * Modules/applepay/ApplePayInstallmentItem.idl:
+            * Modules/applepay/ApplePayInstallmentItemType.h:
+            * Modules/applepay/ApplePayInstallmentItemType.idl:
+            * Modules/applepay/ApplePayInstallmentRetailChannel.h:
+            * Modules/applepay/ApplePayInstallmentRetailChannel.idl: Added.
+
+            * Modules/applepay/ApplePayRequestBase.cpp:
+            (WebCore::convertAndValidate): Changed to call PaymentInstallmentConfiguration::create,
+            returning an exception if present.
+
+            * Modules/applepay/PaymentInstallmentConfiguration.mm:
+            (WebCore::fromDecimalNumber): Allowed for a large maximum number of fractional digits to
+            support formatting high-precision currency and APRs (note that this formatter is only used
+            for test support).
+
+            (WebCore::applePayItemType):
+            (WebCore::platformItemType): Added to convert between PKInstallmentItemType and
+            ApplePayInstallmentItemType.
+
+            (WebCore::applePayRetailChannel):
+            (WebCore::platformRetailChannel): Added to convert between PKInstallmentRetailChannel and
+            ApplePayInstallmentRetailChannel.
+
+            (WebCore::makeNSArrayElement):
+            (WebCore::makeVectorElement): Added to convert between NSArray<PKPaymentInstallmentItem *>
+            and Vector<ApplePayInstallmentItem>.
+
+            (WebCore::createPlatformConfiguration): Added a parameter for passing in applicationMetadata
+            as an NSDictionary. Set properties on PKPaymentInstallmentConfiguration for new
+            ApplePayInstallmentConfiguration members.
+            (WebCore::PaymentInstallmentConfiguration::create): Added; converts the applicationMetadata
+            JSON string (if present) to an NSDictionary, returning a TypeError if the JSON string does
+            not deserialize to an NSDictionary (as PassKit requires).
+            (WebCore::PaymentInstallmentConfiguration::PaymentInstallmentConfiguration): Added a
+            parameter for passing in applicationMetadata as an NSDictionary. Made private.
+            (WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const): Set
+            members on ApplePayInstallmentConfiguration for new PKPaymentInstallmentConfiguration
+            properties.
+
+            * Modules/applepay/PaymentInstallmentConfigurationWebCore.h:
+
 2020-05-20  Russell Epstein  <[email protected]>
 
         Apply patch. rdar://problem/63343507

Modified: branches/safari-609-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp (262438 => 262439)


--- branches/safari-609-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp	2020-06-02 20:44:06 UTC (rev 262438)
+++ branches/safari-609-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp	2020-06-02 21:19:51 UTC (rev 262439)
@@ -35,7 +35,7 @@
 #include <WebKitAdditions/ApplePayRequestBaseAdditions.cpp>
 #else
 namespace WebCore {
-static void finishConverting(ApplePaySessionPaymentRequest&, ApplePayRequestBase&) { }
+static ExceptionOr<void> finishConverting(ApplePaySessionPaymentRequest&, ApplePayRequestBase&) { return { }; }
 static bool requiresSupportedNetworks(unsigned, const ApplePayRequestBase&) { return true; }
 }
 #endif
@@ -103,7 +103,9 @@
     if (version >= 3)
         result.setSupportedCountries(WTFMove(request.supportedCountries));
 
-    finishConverting(result, request);
+    auto exception = finishConverting(result, request);
+    if (exception.hasException())
+        return exception.releaseException();
 
     return WTFMove(result);
 }

Modified: branches/safari-609-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp (262438 => 262439)


--- branches/safari-609-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp	2020-06-02 20:44:06 UTC (rev 262438)
+++ branches/safari-609-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp	2020-06-02 21:19:51 UTC (rev 262439)
@@ -42,8 +42,10 @@
     static const unsigned currentVersion = 6;
 #elif !ENABLE(APPLE_PAY_SESSION_V8)
     static const unsigned currentVersion = 7;
+#elif !ENABLE(APPLE_PAY_SESSION_V9)
+    static const unsigned currentVersion = 8;
 #else
-    static const unsigned currentVersion = 8;
+    static const unsigned currentVersion = 9;
 #endif
 
     return version <= currentVersion;

Modified: branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp (262438 => 262439)


--- branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp	2020-06-02 20:44:06 UTC (rev 262438)
+++ branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp	2020-06-02 21:19:51 UTC (rev 262439)
@@ -109,6 +109,9 @@
     m_shippingMethods = convert(request.shippingMethods());
     m_requiredBillingContactFields = request.requiredBillingContactFields();
     m_requiredShippingContactFields = request.requiredShippingContactFields();
+#if ENABLE(APPLE_PAY_INSTALLMENTS)
+    m_installmentConfiguration = request.installmentConfiguration().applePayInstallmentConfiguration();
+#endif
 
     ASSERT(showCount == hideCount);
     ++showCount;

Modified: branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.h (262438 => 262439)


--- branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.h	2020-06-02 20:44:06 UTC (rev 262438)
+++ branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.h	2020-06-02 21:19:51 UTC (rev 262439)
@@ -27,6 +27,7 @@
 
 #if ENABLE(APPLE_PAY)
 
+#include "ApplePayInstallmentConfiguration.h"
 #include "ApplePayLineItem.h"
 #include "ApplePayShippingMethod.h"
 #include "MockPaymentAddress.h"
@@ -62,6 +63,10 @@
 
     bool supportsUnrestrictedApplePay() const final { return m_supportsUnrestrictedApplePay; }
     void setSupportsUnrestrictedApplePay(bool supports) { m_supportsUnrestrictedApplePay = supports; }
+    
+#if ENABLE(APPLE_PAY_INSTALLMENTS)
+    ApplePayInstallmentConfiguration installmentConfiguration() const { return m_installmentConfiguration; }
+#endif
 
     void ref() const { }
     void deref() const { }
@@ -99,6 +104,9 @@
     MockPaymentContactFields m_requiredBillingContactFields;
     MockPaymentContactFields m_requiredShippingContactFields;
     bool m_supportsUnrestrictedApplePay { true };
+#if ENABLE(APPLE_PAY_INSTALLMENTS)
+    ApplePayInstallmentConfiguration m_installmentConfiguration;
+#endif
 };
 
 } // namespace WebCore

Modified: branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.idl (262438 => 262439)


--- branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.idl	2020-06-02 20:44:06 UTC (rev 262438)
+++ branches/safari-609-branch/Source/WebCore/testing/MockPaymentCoordinator.idl	2020-06-02 21:19:51 UTC (rev 262439)
@@ -43,4 +43,6 @@
     readonly attribute MockPaymentContactFields requiredShippingContactFields;
 
     attribute boolean supportsUnrestrictedApplePay;
+
+    [Conditional=APPLE_PAY_INSTALLMENTS] readonly attribute ApplePayInstallmentConfiguration installmentConfiguration;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to