| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ | 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ |
| 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ | 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 | 11 |
| 12 namespace autofill { | 12 namespace autofill { |
| 13 class AutofillProfile; | 13 class AutofillProfile; |
| 14 class CreditCard; | |
| 15 } // namespace autofill | 14 } // namespace autofill |
| 16 | 15 |
| 17 namespace web { | |
| 18 class BasicCardResponse; | |
| 19 class PaymentAddress; | |
| 20 } // namespace web | |
| 21 | |
| 22 class PaymentRequest; | 16 class PaymentRequest; |
| 23 | 17 |
| 24 namespace payment_request_util { | 18 namespace payment_request_util { |
| 25 | 19 |
| 26 // Helper function to get the name label from an autofill profile. Returns nil | 20 // Helper function to get the name label from an autofill profile. Returns nil |
| 27 // if the name field is empty. | 21 // if the name field is empty. |
| 28 NSString* GetNameLabelFromAutofillProfile( | 22 NSString* GetNameLabelFromAutofillProfile( |
| 29 const autofill::AutofillProfile& profile); | 23 const autofill::AutofillProfile& profile); |
| 30 | 24 |
| 31 // Helper function to get the address label from an autofill profile. Returns | 25 // Helper function to get the address label from an autofill profile. Returns |
| 32 // nil if the address field is empty. | 26 // nil if the address field is empty. |
| 33 NSString* GetAddressLabelFromAutofillProfile( | 27 NSString* GetAddressLabelFromAutofillProfile( |
| 34 const autofill::AutofillProfile& profile); | 28 const autofill::AutofillProfile& profile); |
| 35 | 29 |
| 36 // Helper function to get the phone number label from an autofill profile. | 30 // Helper function to get the phone number label from an autofill profile. |
| 37 // Returns nil if the phone number field is empty. | 31 // Returns nil if the phone number field is empty. |
| 38 NSString* GetPhoneNumberLabelFromAutofillProfile( | 32 NSString* GetPhoneNumberLabelFromAutofillProfile( |
| 39 const autofill::AutofillProfile& profile); | 33 const autofill::AutofillProfile& profile); |
| 40 | 34 |
| 41 // Helper function to get the email label from an autofill profile. Returns nil | 35 // Helper function to get the email label from an autofill profile. Returns nil |
| 42 // if the email field is empty. | 36 // if the email field is empty. |
| 43 NSString* GetEmailLabelFromAutofillProfile( | 37 NSString* GetEmailLabelFromAutofillProfile( |
| 44 const autofill::AutofillProfile& profile); | 38 const autofill::AutofillProfile& profile); |
| 45 | 39 |
| 46 // Helper function to get an instance of web::PaymentAddress from an autofill | |
| 47 // profile. | |
| 48 web::PaymentAddress GetPaymentAddressFromAutofillProfile( | |
| 49 const autofill::AutofillProfile& profile); | |
| 50 | |
| 51 // Helper function to get an instance of web::BasicCardResponse from an autofill | |
| 52 // credit card. | |
| 53 web::BasicCardResponse GetBasicCardResponseFromAutofillCreditCard( | |
| 54 const PaymentRequest& payment_request, | |
| 55 const autofill::CreditCard& card, | |
| 56 const base::string16& cvc); | |
| 57 | |
| 58 // Returns the title for the shipping section of the payment summary view given | 40 // Returns the title for the shipping section of the payment summary view given |
| 59 // the shipping type specified in |payment_request|. | 41 // the shipping type specified in |payment_request|. |
| 60 NSString* GetShippingSectionTitle(const PaymentRequest& payment_request); | 42 NSString* GetShippingSectionTitle(const PaymentRequest& payment_request); |
| 61 | 43 |
| 62 // Returns the title for the shipping address selection view given the shipping | 44 // Returns the title for the shipping address selection view given the shipping |
| 63 // type specified in |payment_request|. | 45 // type specified in |payment_request|. |
| 64 NSString* GetShippingAddressSelectorTitle( | 46 NSString* GetShippingAddressSelectorTitle( |
| 65 const PaymentRequest& payment_request); | 47 const PaymentRequest& payment_request); |
| 66 | 48 |
| 67 // Returns the informational message to be displayed in the shipping address | 49 // Returns the informational message to be displayed in the shipping address |
| (...skipping 11 matching lines...) Expand all Loading... |
| 79 NSString* GetShippingOptionSelectorTitle(const PaymentRequest& payment_request); | 61 NSString* GetShippingOptionSelectorTitle(const PaymentRequest& payment_request); |
| 80 | 62 |
| 81 // Returns the error message to be displayed in the shipping option selection | 63 // Returns the error message to be displayed in the shipping option selection |
| 82 // view given the shipping type specified in |payment_request|. | 64 // view given the shipping type specified in |payment_request|. |
| 83 NSString* GetShippingOptionSelectorErrorMessage( | 65 NSString* GetShippingOptionSelectorErrorMessage( |
| 84 const PaymentRequest& payment_request); | 66 const PaymentRequest& payment_request); |
| 85 | 67 |
| 86 } // namespace payment_request_util | 68 } // namespace payment_request_util |
| 87 | 69 |
| 88 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ | 70 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ |
| OLD | NEW |