| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ios/chrome/browser/payments/payment_request_test_util.h" | 5 #include "ios/chrome/browser/payments/payment_request_test_util.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "components/payments/core/payment_method_data.h" |
| 8 #include "ios/web/public/payments/payment_request.h" | 9 #include "ios/web/public/payments/payment_request.h" |
| 9 | 10 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." | 12 #error "This file requires ARC support." |
| 12 #endif | 13 #endif |
| 13 | 14 |
| 14 namespace payment_request_test_util { | 15 namespace payment_request_test_util { |
| 15 | 16 |
| 16 web::PaymentRequest CreateTestWebPaymentRequest() { | 17 web::PaymentRequest CreateTestWebPaymentRequest() { |
| 17 web::PaymentRequest web_payment_request; | 18 web::PaymentRequest web_payment_request; |
| 18 web::PaymentMethodData method_datum; | 19 payments::PaymentMethodData method_datum; |
| 19 method_datum.supported_methods.push_back(base::ASCIIToUTF16("visa")); | 20 method_datum.supported_methods.push_back(base::ASCIIToUTF16("visa")); |
| 20 method_datum.supported_methods.push_back(base::ASCIIToUTF16("amex")); | 21 method_datum.supported_methods.push_back(base::ASCIIToUTF16("amex")); |
| 21 web_payment_request.method_data.push_back(method_datum); | 22 web_payment_request.method_data.push_back(method_datum); |
| 22 web_payment_request.details.total.label = base::ASCIIToUTF16("Total"); | 23 web_payment_request.details.total.label = base::ASCIIToUTF16("Total"); |
| 23 web_payment_request.details.total.amount.value = base::ASCIIToUTF16("1.00"); | 24 web_payment_request.details.total.amount.value = base::ASCIIToUTF16("1.00"); |
| 24 web_payment_request.details.total.amount.currency = base::ASCIIToUTF16("USD"); | 25 web_payment_request.details.total.amount.currency = base::ASCIIToUTF16("USD"); |
| 25 web::PaymentItem display_item; | 26 web::PaymentItem display_item; |
| 26 display_item.label = base::ASCIIToUTF16("Subtotal"); | 27 display_item.label = base::ASCIIToUTF16("Subtotal"); |
| 27 display_item.amount.value = base::ASCIIToUTF16("1.00"); | 28 display_item.amount.value = base::ASCIIToUTF16("1.00"); |
| 28 display_item.amount.currency = base::ASCIIToUTF16("USD"); | 29 display_item.amount.currency = base::ASCIIToUTF16("USD"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 shipping_option2.label = base::ASCIIToUTF16("10-Days"); | 40 shipping_option2.label = base::ASCIIToUTF16("10-Days"); |
| 40 shipping_option2.amount.value = base::ASCIIToUTF16("0.01"); | 41 shipping_option2.amount.value = base::ASCIIToUTF16("0.01"); |
| 41 shipping_option2.amount.currency = base::ASCIIToUTF16("USD"); | 42 shipping_option2.amount.currency = base::ASCIIToUTF16("USD"); |
| 42 shipping_option2.selected = false; | 43 shipping_option2.selected = false; |
| 43 web_payment_request.details.shipping_options.push_back(shipping_option2); | 44 web_payment_request.details.shipping_options.push_back(shipping_option2); |
| 44 web_payment_request.options.request_shipping = true; | 45 web_payment_request.options.request_shipping = true; |
| 45 return web_payment_request; | 46 return web_payment_request; |
| 46 } | 47 } |
| 47 | 48 |
| 48 } // namespace payment_request_test_util | 49 } // namespace payment_request_test_util |
| OLD | NEW |