From 5c66dade4ad803eae04e2557e37f26aca32903e6 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Sun, 2 Jan 2022 14:18:17 +0100 Subject: [PATCH] Move card brand fieldnames to CC constants --- src/services/autofill.service.ts | 2 +- src/services/autofillConstants.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 1b2869b907..92163308e2 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -415,7 +415,7 @@ export default class AutofillService implements AutofillServiceInterface { fillFields.code = f; break; } else if (!fillFields.brand && this.isFieldMatch(f[attr], - ['cc-type', 'card-type', 'card-brand', 'cc-brand', 'cb-type'])) { + CreditCardAutoFillConstants.CardBrandFieldNames)) { fillFields.brand = f; break; } diff --git a/src/services/autofillConstants.ts b/src/services/autofillConstants.ts index 57dffded81..891ce79b36 100644 --- a/src/services/autofillConstants.ts +++ b/src/services/autofillConstants.ts @@ -162,6 +162,14 @@ export class CreditCardAutoFillConstants { "ccv", ]; + static readonly CardBrandFieldNames: string[] = [ + "cc-type", + "card-type", + "card-brand", + "cc-brand", + "cb-type", + ]; + // Each index represents a language. These three arrays should all be the same length. // 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"];