Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: ios/chrome/browser/payments/payment_request_util.h

Issue 2956453003: [Payment Request] Makes sure only complete credit cards can be selected (Closed)
Patch Set: Fixed unit test Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector>
11
10 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
11 #include "components/payments/core/payment_options_provider.h" 13 #include "components/payments/core/payment_options_provider.h"
12 14
13 namespace autofill { 15 namespace autofill {
14 class AutofillProfile; 16 class AutofillProfile;
17 class CreditCard;
15 } // namespace autofill 18 } // namespace autofill
16 19
17 class PaymentRequest; 20 class PaymentRequest;
18 21
19 namespace payment_request_util { 22 namespace payment_request_util {
20 23
21 // Helper function to create a name label from an autofill profile. Returns nil 24 // Helper function to create a name label from an autofill profile. Returns nil
22 // if the resulting label is empty. 25 // if the resulting label is empty.
23 NSString* GetNameLabelFromAutofillProfile( 26 NSString* GetNameLabelFromAutofillProfile(
24 const autofill::AutofillProfile& profile); 27 const autofill::AutofillProfile& profile);
(...skipping 17 matching lines...) Expand all
42 // nil if the resulting label is empty. 45 // nil if the resulting label is empty.
43 NSString* GetEmailLabelFromAutofillProfile( 46 NSString* GetEmailLabelFromAutofillProfile(
44 const autofill::AutofillProfile& profile); 47 const autofill::AutofillProfile& profile);
45 48
46 // Helper function to create a notification label for an address cell from an 49 // Helper function to create a notification label for an address cell from an
47 // autofill profile. Returns nil if the resulting label is empty. 50 // autofill profile. Returns nil if the resulting label is empty.
48 NSString* GetAddressNotificationLabelFromAutofillProfile( 51 NSString* GetAddressNotificationLabelFromAutofillProfile(
49 PaymentRequest& payment_request, 52 PaymentRequest& payment_request,
50 const autofill::AutofillProfile& profile); 53 const autofill::AutofillProfile& profile);
51 54
55 // Returns whether the credit card is complete to be used as a payment method
56 // without further editing.
57 BOOL IsCreditCardCompleteForPayment(
58 const autofill::CreditCard& credit_card,
59 const std::vector<autofill::AutofillProfile*>& billing_profiles);
60
61 // Helper function to create a notification label for what's missing from a
62 // credit card. Returns nil if the resulting label is empty.
63 NSString* GetPaymentMethodNotificationLabelFromCreditCard(
64 const autofill::CreditCard& credit_card,
65 const std::vector<autofill::AutofillProfile*>& billing_profiles);
66
52 // Returns the title for the shipping section of the payment summary view given 67 // Returns the title for the shipping section of the payment summary view given
53 // the shipping type specified in |payment_request|. 68 // the shipping type specified in |payment_request|.
54 NSString* GetShippingSectionTitle(payments::PaymentShippingType shipping_type); 69 NSString* GetShippingSectionTitle(payments::PaymentShippingType shipping_type);
55 70
56 // Returns the error message to be displayed in the shipping address selection 71 // Returns the error message to be displayed in the shipping address selection
57 // view given the shipping type specified in |payment_request|. 72 // view given the shipping type specified in |payment_request|.
58 NSString* GetShippingAddressSelectorErrorMessage( 73 NSString* GetShippingAddressSelectorErrorMessage(
59 const PaymentRequest& payment_request); 74 const PaymentRequest& payment_request);
60 75
61 // Returns the error message to be displayed in the shipping option selection 76 // Returns the error message to be displayed in the shipping option selection
62 // view given the shipping type specified in |payment_request|. 77 // view given the shipping type specified in |payment_request|.
63 NSString* GetShippingOptionSelectorErrorMessage( 78 NSString* GetShippingOptionSelectorErrorMessage(
64 const PaymentRequest& payment_request); 79 const PaymentRequest& payment_request);
65 80
66 } // namespace payment_request_util 81 } // namespace payment_request_util
67 82
68 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ 83 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/payments/payment_request_unittest.mm ('k') | ios/chrome/browser/payments/payment_request_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698