| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Free Shipping Test</title> | 4 <title>Free Shipping Test</title> |
| 5 <meta charset="utf-8"> | 5 <meta charset="utf-8"> |
| 6 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scal
e=1"> | 6 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scal
e=1"> |
| 7 <style> | 7 <style> |
| 8 button { | 8 button { |
| 9 width: 100%; | 9 width: 100%; |
| 10 height: 5em; | 10 height: 5em; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 dict.recipient = addr.recipient; | 35 dict.recipient = addr.recipient; |
| 36 } | 36 } |
| 37 return dict; | 37 return dict; |
| 38 } | 38 } |
| 39 function buy() { | 39 function buy() { |
| 40 try { | 40 try { |
| 41 var request = new PaymentRequest(['visa'], { | 41 var request = new PaymentRequest(['visa'], { |
| 42 'items' : [ { | 42 'items' : [ { |
| 43 'id' : 'total', | 43 'id' : 'total', |
| 44 'label' : 'Total', | 44 'label' : 'Total', |
| 45 'amount' : {'currencyCode' : 'USD', 'value' : '5.00'} | 45 'amount' : {'currency' : 'USD', 'value' : '5.00'} |
| 46 } ], | 46 } ], |
| 47 'shippingOptions' : [ { | 47 'shippingOptions' : [ { |
| 48 'id' : 'freeShippingOption', | 48 'id' : 'freeShippingOption', |
| 49 'label' : 'Free global shipping', | 49 'label' : 'Free global shipping', |
| 50 'amount' : {'currencyCode' : 'USD', 'value' : '0'} | 50 'amount' : {'currency' : 'USD', 'value' : '0'} |
| 51 } ] | 51 } ] |
| 52 }, { | 52 }, { |
| 53 'requestShipping' : true | 53 'requestShipping' : true |
| 54 }); | 54 }); |
| 55 request.show() | 55 request.show() |
| 56 .then(function(resp) { | 56 .then(function(resp) { |
| 57 resp.complete(true) | 57 resp.complete(true) |
| 58 .then(function() { | 58 .then(function() { |
| 59 print(request.shippingOption + '<br>' + | 59 print(request.shippingOption + '<br>' + |
| 60 JSON.stringify(toDictionary(request.shippingAddress), | 60 JSON.stringify(toDictionary(request.shippingAddress), |
| 61 undefined, 2) + | 61 undefined, 2) + |
| 62 '<br>' + resp.methodName + '<br>' + | 62 '<br>' + resp.methodName + '<br>' + |
| 63 JSON.stringify(resp.details, undefined, 2)); | 63 JSON.stringify(resp.details, undefined, 2)); |
| 64 }) | 64 }) |
| 65 .catch(function(error) { print(error.message); }); | 65 .catch(function(error) { print(error.message); }); |
| 66 }) | 66 }) |
| 67 .catch(function(error) { print(error.message); }); | 67 .catch(function(error) { print(error.message); }); |
| 68 } catch (error) { | 68 } catch (error) { |
| 69 print(error.message); | 69 print(error.message); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 </script> | 72 </script> |
| 73 </body> | 73 </body> |
| 74 </html> | 74 </html> |
| OLD | NEW |