0

[BNPL] Update sync proto

Update AutofillWalletSpecifics to include protos for linked BNPL instruments and BNPL creation options.

Bug: 363320620
Change-Id: Ia1e96b4524131a5d56ebc758129da45ad30cd5a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5874740
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Slobodan Pejic <slobodan@chromium.org>
Commit-Queue: Alexander Tekle <alexandertekle@google.com>
Reviewed-by: Vinny Persky <vinnypersky@google.com>
Cr-Commit-Position: refs/heads/main@{#1372954}
This commit is contained in:
Alexander Tekle
2024-10-23 21:45:35 +00:00
committed by Chromium LUCI CQ
parent 6633f4443e
commit d08a8fdf02
6 changed files with 68 additions and 1 deletions

@@ -235,6 +235,10 @@ std::string AutofillWalletSpecificsAsDebugString(
case sync_pb::AutofillWalletSpecifics_WalletInfoType::
AutofillWalletSpecifics_WalletInfoType_MASKED_IBAN:
return WalletMaskedIbanSpecificsAsDebugString(specifics);
// TODO(crbug.com/374767814): Implement AutofillWalletSpecificsAsDebugString
// for Payment Instrument Creation Option.
case sync_pb::AutofillWalletSpecifics_WalletInfoType::
AutofillWalletSpecifics_WalletInfoType_PAYMENT_INSTRUMENT_CREATION_OPTION:
case sync_pb::AutofillWalletSpecifics_WalletInfoType::
AutofillWalletSpecifics_WalletInfoType_UNKNOWN:
return "Unknown";

@@ -982,6 +982,9 @@ void PopulateWalletTypesFromSyncData(
autofill_specifics.payment_instrument());
}
break;
// TODO(crbug.com/374767814): Implement PopulateWalletTypesFromSyncData
// for Payment Instrument Creation Option.
case sync_pb::AutofillWalletSpecifics::PAYMENT_INSTRUMENT_CREATION_OPTION:
// This entry is deprecated and not supported anymore.
case sync_pb::AutofillWalletSpecifics::MASKED_IBAN:
case sync_pb::AutofillWalletSpecifics::UNKNOWN:

@@ -31,6 +31,10 @@ std::string GetUnhashedClientTagFromAutofillWalletSpecifics(
{"payment_instrument:",
base::NumberToString(
specifics.payment_instrument().instrument_id())});
// TODO(crbug.com/374767814): Implement
// GetUnhashedClientTagFromAutofillWalletSpecifics for Payment Instrument
// Creation Option.
case sync_pb::AutofillWalletSpecifics::PAYMENT_INSTRUMENT_CREATION_OPTION:
case sync_pb::AutofillWalletSpecifics::MASKED_IBAN:
return std::string();
case sync_pb::AutofillWalletSpecifics::UNKNOWN:

@@ -569,11 +569,42 @@ message PaymentInstrument {
BankAccountDetails bank_account = 5;
WalletMaskedIban iban = 6;
EwalletDetails ewallet_details = 7;
BnplIssuerDetails bnpl_issuer_details = 9;
}
optional DeviceDetails device_details = 8;
}
// Details for user's linked and unlinked Buy Now Pay Later issuers.
message BnplIssuerDetails {
// Unique identifier for the BNPL partner. Example: 'affirm'.
optional string issuer_id = 1;
// Eligible price range that the BNPL issuer supports.
repeated EligiblePriceRange eligible_price_range = 2;
}
// Details for payment instruments that the user is eligible to create an
// instrument with.
message PaymentInstrumentCreationOption {
oneof creation_option {
BnplIssuerDetails buy_now_pay_later_option = 1;
}
}
// Details the eligible price range that a BNPL issuer supports. Server
// should set min and max price and ensure that they are both for the same
// currency.
message EligiblePriceRange {
// Currency of the price range. This field contains a three-letter currency
// code.
optional string currency = 1;
// Min and max eligible price in micros of currency, i.e. one millionths of
// the base unit (dollars, not cents for example). e.g. $1.05 == 1050000
// micros.
optional int64 min_price_in_micros = 2;
optional int64 max_price_in_micros = 3;
}
// Contains information of server IBAN (International Bank Account Number).
message WalletMaskedIban {
// Opaque identifier for the account stored in Payments Platform.
@@ -654,6 +685,7 @@ message AutofillWalletSpecifics {
CREDIT_CARD_CLOUD_TOKEN_DATA = 4;
PAYMENT_INSTRUMENT = 5;
MASKED_IBAN = 6 [deprecated = true];
PAYMENT_INSTRUMENT_CREATION_OPTION = 7;
}
optional WalletInfoType type = 1;
@@ -682,6 +714,11 @@ message AutofillWalletSpecifics {
// This field exists if and only if the `type` field equals to
// MASKED_IBAN.
optional WalletMaskedIban masked_iban = 7 [deprecated = true];
// This field exists if and only if the "type" field equals to
// PAYMENT_INSTRUMENT_CREATION_OPTION.
optional PaymentInstrumentCreationOption payment_instrument_creation_option =
8;
}
// Wallet card usage information that can be synced.

@@ -66,7 +66,7 @@ const char* ProtoEnumToString(
const char* ProtoEnumToString(
sync_pb::AutofillWalletSpecifics::WalletInfoType wallet_info_type) {
ASSERT_ENUM_BOUNDS(sync_pb::AutofillWalletSpecifics, WalletInfoType, UNKNOWN,
MASKED_IBAN);
PAYMENT_INSTRUMENT_CREATION_OPTION);
switch (wallet_info_type) {
ENUM_CASE(sync_pb::AutofillWalletSpecifics, UNKNOWN);
ENUM_CASE(sync_pb::AutofillWalletSpecifics, MASKED_CREDIT_CARD);
@@ -75,6 +75,8 @@ const char* ProtoEnumToString(
ENUM_CASE(sync_pb::AutofillWalletSpecifics, CREDIT_CARD_CLOUD_TOKEN_DATA);
ENUM_CASE(sync_pb::AutofillWalletSpecifics, PAYMENT_INSTRUMENT);
ENUM_CASE(sync_pb::AutofillWalletSpecifics, MASKED_IBAN);
ENUM_CASE(sync_pb::AutofillWalletSpecifics,
PAYMENT_INSTRUMENT_CREATION_OPTION);
}
NOTREACHED_IN_MIGRATION();
return "";

@@ -320,6 +320,12 @@ VISIT_PROTO_FIELDS(const sync_pb::AutofillWalletSpecifics& proto) {
VISIT(customer_data);
VISIT(cloud_token_data);
VISIT(payment_instrument);
VISIT(payment_instrument_creation_option);
}
VISIT_PROTO_FIELDS(const sync_pb::BnplIssuerDetails& proto) {
VISIT(issuer_id);
VISIT_REP(eligible_price_range);
}
VISIT_PROTO_FIELDS(const sync_pb::BookmarkSpecifics& proto) {
@@ -614,6 +620,12 @@ VISIT_PROTO_FIELDS(const sync_pb::DeviceInfoSpecifics& proto) {
VISIT_ENUM(device_form_factor);
}
VISIT_PROTO_FIELDS(const sync_pb::EligiblePriceRange& proto) {
VISIT(currency);
VISIT(min_price_in_micros);
VISIT(max_price_in_micros);
}
VISIT_PROTO_FIELDS(const sync_pb::FeatureSpecificFields& proto) {
VISIT(send_tab_to_self_receiving_enabled);
VISIT_ENUM(send_tab_to_self_receiving_type);
@@ -1690,6 +1702,11 @@ VISIT_PROTO_FIELDS(const sync_pb::PaymentInstrument& proto) {
VISIT(iban);
VISIT(ewallet_details);
VISIT(device_details);
VISIT(bnpl_issuer_details);
}
VISIT_PROTO_FIELDS(const sync_pb::PaymentInstrumentCreationOption& proto) {
VISIT(buy_now_pay_later_option);
}
VISIT_PROTO_FIELDS(const sync_pb::BankAccountDetails& proto) {