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

Side by Side Diff: ios/chrome/browser/ui/payments/full_card_requester.h

Issue 2959133002: [Payment Request] unit tests for the FullCardRequester (Closed)
Patch Set: 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 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 #ifndef IOS_CHROME_BROWSER_UI_PAYMENTS_FULL_CARD_REQUESTER_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_PAYMENTS_FULL_CARD_REQUESTER_H_
6 #define IOS_CHROME_BROWSER_UI_PAYMENTS_FULL_CARD_REQUESTER_H_ 6 #define IOS_CHROME_BROWSER_UI_PAYMENTS_FULL_CARD_REQUESTER_H_
7 7
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "components/autofill/core/browser/autofill_client.h" 13 #include "components/autofill/core/browser/autofill_client.h"
14 #include "components/autofill/core/browser/payments/full_card_request.h" 14 #include "components/autofill/core/browser/payments/full_card_request.h"
15 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller_impl .h" 15 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller_impl .h"
16 16
17 namespace autofill { 17 namespace autofill {
18 class AutofillManager; 18 class AutofillManager;
19 class CreditCard; 19 class CreditCard;
20 } // namespace autofill 20 } // namespace autofill
21 21
22 namespace ios { 22 namespace ios {
23 class ChromeBrowserState; 23 class ChromeBrowserState;
24 } // namespace ios 24 } // namespace ios
25 25
26 @class PaymentRequestCoordinator; 26 @protocol FullCardRequesterConsumer
27
28 // Called when a credit card has been successfully unmasked. Note that |card|
29 // may be different from what passed to GetFullCard method of FullCardRequester,
30 // because CVC unmasking process may update the credit card number and
31 // expiration date.
32 - (void)fullCardRequestDidSucceedWithCard:(const autofill::CreditCard&)card
33 verificationCode:
34 (const base::string16&)verificationCode;
35
36 @end
27 37
28 // Receives the full credit card details. Also displays the unmask prompt UI. 38 // Receives the full credit card details. Also displays the unmask prompt UI.
29 class FullCardRequester 39 class FullCardRequester
30 : public autofill::payments::FullCardRequest::ResultDelegate, 40 : public autofill::payments::FullCardRequest::ResultDelegate,
31 public autofill::payments::FullCardRequest::UIDelegate, 41 public autofill::payments::FullCardRequest::UIDelegate,
32 public base::SupportsWeakPtr<FullCardRequester> { 42 public base::SupportsWeakPtr<FullCardRequester> {
33 public: 43 public:
34 FullCardRequester(PaymentRequestCoordinator* owner, 44 FullCardRequester(id<FullCardRequesterConsumer> consumer,
35 UIViewController* base_view_controller, 45 UIViewController* base_view_controller,
36 ios::ChromeBrowserState* browser_state); 46 ios::ChromeBrowserState* browser_state);
37 47
38 void GetFullCard(autofill::CreditCard* card, 48 void GetFullCard(autofill::CreditCard* card,
39 autofill::AutofillManager* autofill_manager); 49 autofill::AutofillManager* autofill_manager);
40 50
41 // payments::FullCardRequest::ResultDelegate: 51 // payments::FullCardRequest::ResultDelegate:
42 void OnFullCardRequestSucceeded( 52 void OnFullCardRequestSucceeded(
43 const autofill::CreditCard& card, 53 const autofill::CreditCard& card,
44 const base::string16& verificationCode) override; 54 const base::string16& verificationCode) override;
45 void OnFullCardRequestFailed() override; 55 void OnFullCardRequestFailed() override;
46 56
47 // payments::FullCardRequest::UIDelegate: 57 // payments::FullCardRequest::UIDelegate:
48 void ShowUnmaskPrompt( 58 void ShowUnmaskPrompt(
49 const autofill::CreditCard& card, 59 const autofill::CreditCard& card,
50 autofill::AutofillClient::UnmaskCardReason reason, 60 autofill::AutofillClient::UnmaskCardReason reason,
51 base::WeakPtr<autofill::CardUnmaskDelegate> delegate) override; 61 base::WeakPtr<autofill::CardUnmaskDelegate> delegate) override;
52 void OnUnmaskVerificationResult( 62 void OnUnmaskVerificationResult(
53 autofill::AutofillClient::PaymentsRpcResult result) override; 63 autofill::AutofillClient::PaymentsRpcResult result) override;
54 64
55 private: 65 private:
56 __weak PaymentRequestCoordinator* owner_; 66 __weak id<FullCardRequesterConsumer> consumer_;
57 __weak UIViewController* base_view_controller_; 67 __weak UIViewController* base_view_controller_;
58 autofill::CardUnmaskPromptControllerImpl unmask_controller_; 68 autofill::CardUnmaskPromptControllerImpl unmask_controller_;
59 69
60 DISALLOW_COPY_AND_ASSIGN(FullCardRequester); 70 DISALLOW_COPY_AND_ASSIGN(FullCardRequester);
61 }; 71 };
62 72
63 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_FULL_CARD_REQUESTER_H_ 73 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_FULL_CARD_REQUESTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698