File: payments_autofill_client.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (618 lines) | stat: -rw-r--r-- 26,381 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_AUTOFILL_CLIENT_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_AUTOFILL_CLIENT_H_

#include <optional>
#include <string>
#include <vector>

#include "base/functional/callback_forward.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/data_model/payments/credit_card.h"
#include "components/autofill/core/browser/foundations/autofill_client.h"
#include "components/autofill/core/browser/payments/legal_message_line.h"
#include "components/autofill/core/browser/payments/risk_data_loader.h"
#include "components/autofill/core/browser/suggestions/suggestion.h"
#include "components/signin/public/identity_manager/account_info.h"

#if !BUILDFLAG(IS_IOS)
namespace webauthn {
class InternalAuthenticator;
}
#endif

namespace autofill {

class AutofillDriver;
struct AutofillErrorDialogContext;
class AutofillOfferData;
class AutofillOfferManager;
enum class AutofillProgressDialogType;
class AutofillSaveCardBottomSheetBridge;
class BnplIssuer;
struct BnplTosModel;
struct CardUnmaskChallengeOption;
class CardUnmaskDelegate;
struct CardUnmaskPromptOptions;
class CreditCard;
class CreditCardCvcAuthenticator;
class CreditCardOtpAuthenticator;
class CreditCardRiskBasedAuthenticator;
class Iban;
class IbanAccessManager;
class IbanManager;
class MerchantPromoCodeManager;
struct OfferNotificationOptions;
class OtpUnmaskDelegate;
class PaymentsDataManager;
enum class OtpUnmaskResult;
class TouchToFillDelegate;
struct VirtualCardEnrollmentFields;
class VirtualCardEnrollmentManager;
struct FilledCardInformationBubbleOptions;
enum class WebauthnDialogCallbackType;

namespace payments {

struct BnplIssuerContext;
class MandatoryReauthManager;
class MultipleRequestPaymentsNetworkInterface;
class PaymentsNetworkInterface;
class PaymentsWindowManager;
class SaveAndFillManager;

// A payments-specific client interface that handles dependency injection, and
// its implementations serve as the integration for platform-specific code. One
// per WebContents, owned by the AutofillClient. Created lazily in the
// AutofillClient when it is needed.
class PaymentsAutofillClient : public RiskDataLoader {
 public:
  ~PaymentsAutofillClient() override;

  // The type of the credit card the Payments RPC fetches.
  enum class PaymentsRpcCardType {
    // Unknown type.
    kUnknown = 0,
    // Server card.
    kServerCard = 1,
    // Virtual card.
    kVirtualCard = 2,
  };

  enum class PaymentsRpcResult {
    // Empty result. Used for initializing variables and should generally
    // not be returned nor passed as arguments unless explicitly allowed by
    // the API.
    kNone,

    // Request succeeded.
    kSuccess,

    // Request failed; try again.
    kTryAgainFailure,

    // Request failed; don't try again.
    kPermanentFailure,

    // Unable to connect to Payments servers. Prompt user to check internet
    // connection.
    kNetworkError,

    // Request failed in retrieving virtual card information; try again.
    kVcnRetrievalTryAgainFailure,

    // Request failed in retrieving virtual card information; don't try again.
    kVcnRetrievalPermanentFailure,

    // Request took longer time to finish than the set client-side timeout.
    kClientSideTimeout,
  };

  enum class SaveIbanOfferUserDecision {
    // The user accepted IBAN save.
    kAccepted,

    // The user explicitly declined IBAN save.
    kDeclined,

    // The user ignored the IBAN save prompt.
    kIgnored,
  };

  enum class UnmaskCardReason {
    // The card is being unmasked for PaymentRequest.
    kPaymentRequest,

    // The card is being unmasked for Autofill.
    kAutofill,
  };

  // Authentication methods for card unmasking.
  enum class UnmaskAuthMethod {
    kUnknown = 0,
    // Require user to unmask via CVC.
    kCvc = 1,
    // Suggest use of FIDO authenticator for card unmasking.
    kFido = 2,
  };

  enum class CardSaveType {
    // Credit card is saved without the CVC.
    kCardSaveOnly = 0,
    // Credit card is saved with the CVC.
    kCardSaveWithCvc = 1,
    // Only CVC is saved.
    kCvcSaveOnly = 2,
  };

  // Used for options of upload prompt.
  struct SaveCreditCardOptions {
    SaveCreditCardOptions& with_should_request_name_from_user(bool b) {
      should_request_name_from_user = b;
      return *this;
    }

    SaveCreditCardOptions& with_should_request_expiration_date_from_user(
        bool b) {
      should_request_expiration_date_from_user = b;
      return *this;
    }

    SaveCreditCardOptions& with_show_prompt(bool b = true) {
      show_prompt = b;
      return *this;
    }

    SaveCreditCardOptions& with_has_multiple_legal_lines(bool b = true) {
      has_multiple_legal_lines = b;
      return *this;
    }

    SaveCreditCardOptions&
    with_same_last_four_as_server_card_but_different_expiration_date(bool b) {
      has_same_last_four_as_server_card_but_different_expiration_date = b;
      return *this;
    }

    SaveCreditCardOptions& with_num_strikes(const int strikes) {
      num_strikes = strikes;
      return *this;
    }

    SaveCreditCardOptions& with_card_save_type(CardSaveType b) {
      card_save_type = b;
      return *this;
    }

    bool should_request_name_from_user = false;
    bool should_request_expiration_date_from_user = false;
    bool show_prompt = false;
    bool has_multiple_legal_lines = false;
    bool has_same_last_four_as_server_card_but_different_expiration_date =
        false;
    std::optional<int> num_strikes;
    CardSaveType card_save_type = CardSaveType::kCardSaveOnly;
  };

  enum class SaveCardOfferUserDecision {
    // The user accepted credit card save.
    kAccepted,

    // The user explicitly declined credit card save.
    kDeclined,

    // The user ignored the credit card save prompt.
    kIgnored,
  };

  // Used for explicitly requesting the user to enter/confirm cardholder name,
  // expiration date month and year.
  struct UserProvidedCardDetails {
    std::u16string cardholder_name;
    std::u16string expiration_date_month;
    std::u16string expiration_date_year;
  };

  // Callback to run after local/upload IBAN save is offered. The callback runs
  // with `user_decision` indicating whether the prompt was accepted, declined,
  // or ignored. `nickname` is optionally provided by the user when IBAN local
  // or upload save is offered, and can be an empty string.
  using SaveIbanPromptCallback =
      base::OnceCallback<void(SaveIbanOfferUserDecision user_decision,
                              std::u16string_view nickname)>;

  // Callback to run after credit card or IBAN upload confirmation prompt is
  // closed.
  using OnConfirmationClosedCallback = base::OnceClosure;

  // Callback to run if the OK button or the cancel button in a
  // Webauthn dialog is clicked.
  using WebauthnDialogCallback =
      base::RepeatingCallback<void(WebauthnDialogCallbackType)>;

  // Callback to run when the credit card has been scanned.
  using CreditCardScanCallback = base::OnceCallback<void(const CreditCard&)>;

  // Callback to run after local credit card save or local CVC save is offered.
  // Sends whether the prompt was accepted, declined, or ignored in
  // `user_decision`.
  using LocalSaveCardPromptCallback =
      base::OnceCallback<void(SaveCardOfferUserDecision user_decision)>;

  // Callback to run after upload credit card save or upload CVC save for
  // existing server card is offered. Sends whether the prompt was accepted,
  // declined, or ignored in `user_decision`, and additional
  // `user_provided_card_details` if applicable.
  using UploadSaveCardPromptCallback = base::OnceCallback<void(
      SaveCardOfferUserDecision user_decision,
      const UserProvidedCardDetails& user_provided_card_details)>;

#if BUILDFLAG(IS_ANDROID)
  // Gets the AutofillSaveCardBottomSheetBridge or creates one if it doesn't
  // exist.
  virtual AutofillSaveCardBottomSheetBridge*
  GetOrCreateAutofillSaveCardBottomSheetBridge();
#elif !BUILDFLAG(IS_IOS)
  // TODO(crbug.com/40639086): Find a way to merge these two functions.
  // Shouldn't use WebauthnDialogState as that state is a purely UI state
  // (should not be accessible for managers?), and some of the states
  // `KInactive` may be confusing here. Do we want to add another Enum?

  // Will show a dialog offering the option to use device's platform
  // authenticator in the future instead of CVC to verify the card being
  // unmasked. Runs `offer_dialog_callback` if the OK button or the cancel
  // button in the dialog is clicked.
  virtual void ShowWebauthnOfferDialog(
      WebauthnDialogCallback offer_dialog_callback);

  // Will show a dialog indicating the card verification is in progress. It is
  // shown after verification starts only if the WebAuthn is enabled.
  virtual void ShowWebauthnVerifyPendingDialog(
      WebauthnDialogCallback verify_pending_dialog_callback);

  // Will update the WebAuthn dialog content when there is an error fetching the
  // challenge.
  virtual void UpdateWebauthnOfferDialogWithError();

  // Will close the current visible WebAuthn dialog. Returns true if dialog was
  // visible and has been closed.
  virtual bool CloseWebauthnDialog();

  // Hides the virtual card enroll bubble and icon if it is visible.
  virtual void HideVirtualCardEnrollBubbleAndIconIfVisible();
#endif  // BUILDFLAG(IS_ANDROID)

#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
  // Display the cardholder name fix flow prompt and run the `callback` if
  // the card should be uploaded to payments with updated name from the user.
  virtual void ConfirmAccountNameFixFlow(
      base::OnceCallback<void(const std::u16string&)> callback);

  // Display the expiration date fix flow prompt with the `card` details
  // and run the `callback` if the card should be uploaded to payments with
  // updated expiration date from the user.
  virtual void ConfirmExpirationDateFixFlow(
      const CreditCard& card,
      base::OnceCallback<void(const std::u16string&, const std::u16string&)>
          callback);
#endif  // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)

  // Returns true if both the platform and the device support scanning credit
  // cards. Should be called before ScanCreditCard().
  virtual bool HasCreditCardScanFeature() const;

  // Shows the user interface for scanning a credit card. Invokes the `callback`
  // when a credit card is scanned successfully. Should be called only if
  // HasCreditCardScanFeature() returns true.
  virtual void ScanCreditCard(CreditCardScanCallback callback);

  // Runs `callback` once the user makes a decision with respect to the
  // offer-to-save prompt. This includes both the save local card prompt and the
  // save CVC for a local card prompt. On desktop, shows the offer-to-save
  // bubble if `options.show_prompt` is true; otherwise only shows the omnibox
  // icon. On mobile, shows the offer-to-save infobar if `options.show_prompt`
  // is true; otherwise does not offer to save at all.
  virtual void ShowSaveCreditCardLocally(const CreditCard& card,
                                         SaveCreditCardOptions options,
                                         LocalSaveCardPromptCallback callback);

  // Runs `callback` once the user makes a decision with respect to the
  // offer-to-save prompt. This includes both the save server card prompt and
  // the save CVC for a server card prompt. Displays the contents of
  // `legal_message_lines` to the user. Displays a cardholder name textfield in
  // the bubble if `options.should_request_name_from_user` is true. Displays a
  // pair of expiration date dropdowns in the bubble if
  // `should_request_expiration_date_from_user` is true. On desktop, shows the
  // offer-to-save bubble if `options.show_prompt` is true;
  // otherwise only shows the omnibox icon. On mobile, shows the offer-to-save
  // infobar if `options.show_prompt` is true; otherwise does
  // not offer to save at all.
  // TODO (crbug.com/1462821): Make `legal_message_lines` optional, as CVC
  // upload has no legal message.
  virtual void ShowSaveCreditCardToCloud(
      const CreditCard& card,
      const LegalMessageLines& legal_message_lines,
      SaveCreditCardOptions options,
      UploadSaveCardPromptCallback callback);

  // Shows upload result to users. Called after credit card upload is finished.
  // `result` holds the outcome for credit card upload.
  // `on_confirmation_closed_callback` should run after confirmation prompt is
  // closed.
  // TODO(crbug.com/40614280): This function is overridden in iOS codebase and
  // in the desktop codebase. If iOS is not using it to do anything, please keep
  // this function for desktop.
  virtual void CreditCardUploadCompleted(
      PaymentsRpcResult result,
      std::optional<OnConfirmationClosedCallback>
          on_confirmation_closed_callback);

  // Hides save card offer or confirmation prompt.
  virtual void HideSaveCardPrompt();

  // Shows a dialog for the user to enroll in a virtual card.
  virtual void ShowVirtualCardEnrollDialog(
      const VirtualCardEnrollmentFields& virtual_card_enrollment_fields,
      base::OnceClosure accept_virtual_card_callback,
      base::OnceClosure decline_virtual_card_callback);

  // Called after virtual card enrollment is finished. Shows enrollment
  // result to users. `result` holds the outcome of virtual card enrollment.
  virtual void VirtualCardEnrollCompleted(PaymentsRpcResult result);

  // Called when the card has been fetched successfully. Uses the necessary
  // information in `options` to show the FilledCardInformationBubble.
  virtual void OnCardDataAvailable(
      const FilledCardInformationBubbleOptions& options);

  // Runs `callback` once the user makes a decision with respect to the
  // offer-to-save prompt. On desktop, shows the offer-to-save bubble if
  // `should_show_prompt` is true; otherwise only shows the omnibox icon.
  virtual void ConfirmSaveIbanLocally(const Iban& iban,
                                      bool should_show_prompt,
                                      SaveIbanPromptCallback callback);

  // Runs `callback` once the user makes a decision with respect to the
  // offer-to-upload prompt. On desktop, shows the offer-to-upload bubble if
  // `should_show_prompt` is true; otherwise only shows the omnibox icon.
  virtual void ConfirmUploadIbanToCloud(const Iban& iban,
                                        LegalMessageLines legal_message_lines,
                                        bool should_show_prompt,
                                        SaveIbanPromptCallback callback);

  // Shows upload result to users. Called after IBAN upload is finished.
  // `iban_saved` indicates if the IBAN was successfully saved.
  // `hit_max_strikes` indicates whether the maximum number of strikes has been
  // reached when the offer to upload IBAN request fails.
  virtual void IbanUploadCompleted(bool iban_saved, bool hit_max_strikes);

  // Show/dismiss the progress dialog which contains a throbber and a text
  // message indicating that something is in progress.
  virtual void ShowAutofillProgressDialog(
      AutofillProgressDialogType autofill_progress_dialog_type,
      base::OnceClosure cancel_callback);
  virtual void CloseAutofillProgressDialog(
      bool show_confirmation_before_closing,
      base::OnceClosure no_interactive_authentication_callback);

  // Show the OTP unmask dialog to accept user-input OTP value.
  virtual void ShowCardUnmaskOtpInputDialog(
      CreditCard::RecordType card_type,
      const CardUnmaskChallengeOption& challenge_option,
      base::WeakPtr<OtpUnmaskDelegate> delegate);

  // Shows a dialog for the user to choose/confirm the authentication
  // to use in card unmasking.
  virtual void ShowUnmaskAuthenticatorSelectionDialog(
      const std::vector<CardUnmaskChallengeOption>& challenge_options,
      base::OnceCallback<void(const std::string&)>
          confirm_unmask_challenge_option_callback,
      base::OnceClosure cancel_unmasking_closure);

  // Dismisses the selection dialog to open the authentication dialog.
  // `server_success` dictates whether we received a success response
  // from the server, with true representing success and false representing
  // failure. A successful server response means that the issuer has sent an OTP
  // and we can move on to the next portion of this flow.
  // This should be invoked upon server accepting the authentication method, in
  // which case, we dismiss the selection dialog to open the authentication
  // dialog.
  virtual void DismissUnmaskAuthenticatorSelectionDialog(bool server_success);

  // Invoked when we receive the server response of the OTP unmask request.
  virtual void OnUnmaskOtpVerificationResult(OtpUnmaskResult unmask_result);

  // Gets the payments::PaymentsNetworkInterface instance owned by the client.
  virtual PaymentsNetworkInterface* GetPaymentsNetworkInterface();

  // Same as above. However this network interface can support multiple active
  // requests at a time. Sending a request will not affect other ongoing
  // requests. This is a complete upgrade of the
  // `PaymentsNetworkInterface` so all new flows should use this
  // function. All existing flows should be migrated to this. Note that since
  // each flow should migrate in its own effort, we would need to keep these
  // functions separate, instead of updating the logic inside
  // GetPaymentsNetworkInterface. When all migrations are finished, above
  // function and the PaymentsNetworkInterface class should be cleaned up.
  virtual MultipleRequestPaymentsNetworkInterface*
  GetMultipleRequestPaymentsNetworkInterface();

  // Shows an error dialog when card retrieval errors happen. The type of error
  // dialog that is shown will match the `type` in `context`. If the
  // `server_returned_title` and `server_returned_description` in `context` are
  // both set, the error dialog that is displayed will have these fields
  // displayed for the title and description, respectively.
  virtual void ShowAutofillErrorDialog(AutofillErrorDialogContext context);

  // Gets the PaymentsWindowManager owned by the client.
  virtual PaymentsWindowManager* GetPaymentsWindowManager();

  // A user has attempted to use a masked card. Prompt them for further
  // information to proceed.
  virtual void ShowUnmaskPrompt(
      const CreditCard& card,
      const CardUnmaskPromptOptions& card_unmask_prompt_options,
      base::WeakPtr<CardUnmaskDelegate> delegate);
  virtual void OnUnmaskVerificationResult(PaymentsRpcResult result);

  // Shows a view that presents the Buy-Now-Pay-Later Terms of Service to the
  // user to accept or decline.
  virtual void ShowBnplTos(BnplTosModel bnpl_tos_model,
                           base::OnceClosure accept_callback,
                           base::OnceClosure cancel_callback);

  // Closes the Buy-Now-Pay-Later Terms of Service dialog that was displayed in
  // `ShowBnplTos()`.
  virtual void CloseBnplTos();

  // Returns a pointer to a VirtualCardEnrollmentManager that is owned by
  // PaymentsAutofillClient. VirtualCardEnrollmentManager is used for virtual
  // card enroll and unenroll related flows. This function will return a nullptr
  // on iOS WebView.
  virtual VirtualCardEnrollmentManager* GetVirtualCardEnrollmentManager();

  // Gets the CreditCardCvcAuthenticator owned by the client.
  virtual CreditCardCvcAuthenticator& GetCvcAuthenticator() = 0;

  // Gets the CreditCardOtpAuthenticator owned by the client. This function will
  // return a nullptr on iOS WebView.
  virtual CreditCardOtpAuthenticator* GetOtpAuthenticator();

  // Gets the RiskBasedAuthenticator owned by the client. This function will
  // return a nullptr on iOS WebView.
  virtual CreditCardRiskBasedAuthenticator* GetRiskBasedAuthenticator();

  // Returns true if Hagrid (risk based authentication) is supported on this
  // platform. Override in subclasses, return true in supported platform,
  // defaults to false.
  virtual bool IsRiskBasedAuthEffectivelyAvailable() const;

  // Prompt the user to enable mandatory reauthentication for payment method
  // autofill. When enabled, the user will be asked to authenticate using
  // biometrics or device unlock before filling in payment method information.
  virtual void ShowMandatoryReauthOptInPrompt(
      base::OnceClosure accept_mandatory_reauth_callback,
      base::OnceClosure cancel_mandatory_reauth_callback,
      base::RepeatingClosure close_mandatory_reauth_callback);

  // Gets the IbanManager instance associated with the client.
  virtual IbanManager* GetIbanManager();

  // Gets the IbanAccessManager instance associated with the client.
  virtual IbanAccessManager* GetIbanAccessManager();

  // Gets the MerchantPromoCodeManager instance associated with the
  // client (can be null for unsupported platforms).
  virtual MerchantPromoCodeManager* GetMerchantPromoCodeManager();

  // Should only be called when we are sure re-showing the bubble will display a
  // confirmation bubble. If the most recent bubble was an opt-in bubble and it
  // was accepted, this will display the re-auth opt-in confirmation bubble.
  virtual void ShowMandatoryReauthOptInConfirmation();

  // TODO(crbug.com/40134864): Rename all the "domain" in this flow to origin.
  //                          The server is passing down full origin of the
  //                          urls. "Domain" is no longer accurate.
  // Notifies the client to update the offer notification when the `offer` is
  // available. `options` carries extra configuration options for the offer
  // notification.
  virtual void UpdateOfferNotification(const AutofillOfferData& offer,
                                       const OfferNotificationOptions& options);

  // Dismiss any visible offer notification on the current tab.
  virtual void DismissOfferNotification();

  // Navigates to `url` in a new tab. `url` links to the promo code offer
  // details page for the offers in a promo code suggestions popup. Every offer
  // in a promo code suggestions popup links to the same offer details page.
  virtual void OpenPromoCodeOfferDetailsURL(const GURL& url);

  // Gets an AutofillOfferManager instance (can be null for unsupported
  // platforms).
  virtual AutofillOfferManager* GetAutofillOfferManager();
  const AutofillOfferManager* GetAutofillOfferManager() const;

  // Shows the Touch To Fill surface for filling credit card information, if
  // possible, and returns `true` on success. `delegate` will be notified of
  // events. `suggestions` are generated using the `cards_to_suggest` data and
  // include fields such as `main_text`, `minor_text`, and
  // `HasDeactivatedStyle` member function. Should be called only if the feature
  // is supported by the platform. This function is implemented on all
  // platforms so this should be a pure virtual function to enforce the override
  // implementation.
  virtual bool ShowTouchToFillCreditCard(
      base::WeakPtr<TouchToFillDelegate> delegate,
      base::span<const Suggestion> suggestions);

  // Shows the Touch To Fill surface for filling IBAN information, if
  // possible, returning `true` on success. `delegate` will be notified of
  // events. This function is not implemented on iOS and iOS WebView, and
  // should not be used on those platforms.
  virtual bool ShowTouchToFillIban(base::WeakPtr<TouchToFillDelegate> delegate,
                                   base::span<const Iban> ibans_to_suggest);

  // Shows the Touch To Fill surface for filling Wallet loyalty card
  // information, if possible, returning `true` on success. `delegate` will be
  // notified of events. This function is not implemented on iOS and iOS
  // WebView, and should not be used on those platforms.
  virtual bool ShowTouchToFillLoyaltyCard(
      base::WeakPtr<TouchToFillDelegate> delegate,
      base::span<const LoyaltyCard> loyalty_cards_to_suggest);

  // Hides the Touch To Fill surface for filling payment information if one is
  // currently shown. Should be called only if the feature is supported by the
  // platform.
  virtual void HideTouchToFillPaymentMethod();

  // Return the `PaymentsDataManager` which is payments-specific version of
  // PersonalDataManager. It has two main responsibilities:
  // - Caching the payments related data stored in `AutofillTable` for
  // synchronous retrieval.
  // - Posting changes to `AutofillTable` via the `AutofillWebDataService`
  //   and updating its state accordingly.
  virtual PaymentsDataManager& GetPaymentsDataManager() = 0;
  const PaymentsDataManager& GetPaymentsDataManager() const;

#if !BUILDFLAG(IS_IOS)
  // Creates the appropriate implementation of InternalAuthenticator. May be
  // null for platforms that don't support this, in which case standard CVC
  // authentication will be used instead.
  virtual std::unique_ptr<webauthn::InternalAuthenticator>
  CreateCreditCardInternalAuthenticator(AutofillDriver* driver);
#endif

  // Gets or creates a payments autofill mandatory re-auth manager. This will be
  // used to handle payments mandatory re-auth related flows.
  virtual payments::MandatoryReauthManager*
  GetOrCreatePaymentsMandatoryReauthManager();

  // Shows the `Save and Fill` modal dialog.
  virtual void ShowCreditCardSaveAndFillDialog();

  // Gets the payments Save and Fill manager owned by the client. This will be
  // used to handle the Save and Fill dialog.
  virtual payments::SaveAndFillManager* GetSaveAndFillManager();

  // Shows the issuer selection dialog for BNPL when the BNPL suggestion is
  // selected to let users choose a BNPL issuer.
  virtual void ShowSelectBnplIssuerDialog(
      std::vector<BnplIssuerContext> bnpl_issuer_context,
      std::string app_locale,
      base::OnceCallback<void(BnplIssuer)> selected_issuer_callback,
      base::OnceClosure cancel_callback);

  // Dismiss the issuer selection dialog for BNPL.
  virtual void DismissSelectBnplIssuerDialog();

  // Checks if the browser popup is a tab modal popup.
  virtual bool IsTabModalPopupDeprecated() const;
};

}  // namespace payments

}  // namespace autofill

#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_AUTOFILL_CLIENT_H_