payment-request-event-manual.https.html (2455B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Tests for PaymentRequestEvent</title> 4 <link rel="help" href="https://w3c.github.io/payment-handler/#the-paymentrequestevent"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <p>When the payment sheet is shown, please authorize the mock payment.</p> 10 <script> 11 promise_test(async t => { 12 const methodName = window.location.origin + '/payment-handler/' 13 + 'payment-request-event-manual-manifest.json'; 14 await test_driver.bless('invoking a payment app'); 15 const response = await new PaymentRequest( 16 [ 17 {supportedMethods: methodName, data: {}}, 18 {supportedMethods: 'interledger', data: {supportedNetworks: ['mir']}}, 19 ], 20 { 21 id: 'test-payment-request-identifier', 22 total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}}, 23 displayItems: [ 24 {label: 'Item 1', amount: {currency: 'CAD', value: '0.005'}}, 25 {label: 'Item 2', amount: {currency: 'EUR', value: '0.005'}}, 26 ], 27 modifiers: [ 28 { 29 supportedMethods: methodName, 30 data: {supportedNetworks: ['mir']}, 31 total: { 32 label: 'MIR total', 33 amount: {currency: 'USD', value: '0.0099'}, 34 }, 35 additionalDisplayItems: [ 36 {label: 'Item 3', amount: {currency: 'GBP', value: '-0.0001'}}, 37 ], 38 }, 39 { 40 supportedMethods: methodName, 41 data: {supportedNetworks: ['visa']}, 42 total: { 43 label: 'VISA total', 44 amount: {currency: 'USD', value: '0.0098'}, 45 }, 46 additionalDisplayItems: [ 47 {label: 'Item 4', amount: {currency: 'CNY', value: '-0.0002'}}, 48 ], 49 }, 50 { 51 supportedMethods: 'interledger', 52 data: {}, 53 total: { 54 label: 'Prepaid total', 55 amount: {currency: 'USD', value: '0.0097'}, 56 }, 57 additionalDisplayItems: [ 58 {label: 'Item 5', amount: {currency: 'JPY', value: '-0.0003'}}, 59 ], 60 }, 61 ], 62 }, 63 ).show(); 64 const promise = response.complete('success'); 65 assert_equals(response.requestId, 'test-payment-request-identifier'); 66 assert_equals(response.methodName, methodName); 67 return promise; 68 }, 'Can perform payment'); 69 </script>