From 9bae467d9ac87f056975ae0311e0f7a6b6d6b87c Mon Sep 17 00:00:00 2001
From: Finnian Jacobson-Schulte
<140328381+finnian0826@users.noreply.github.com>
Date: Wed, 27 Sep 2023 17:02:22 -0600
Subject: [PATCH] fix(fonbnk): Fix mobile carrier string (#4233)
### Description
The mobile carrier string was showing "{{carrier}} Required" rather than
using the carrier name, this fixes it.
### Test plan
Ran the wallet locally, works for both KE and NG
---
src/fiatExchanges/PaymentMethodSection.tsx | 6 +++++-
src/fiatExchanges/quotes/ExternalQuote.ts | 7 +++----
src/fiatExchanges/quotes/FiatConnectQuote.ts | 4 ++--
src/fiatExchanges/quotes/NormalizedQuote.ts | 2 +-
src/fiatExchanges/utils.test.ts | 2 +-
5 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/fiatExchanges/PaymentMethodSection.tsx b/src/fiatExchanges/PaymentMethodSection.tsx
index 265f68c428a..fd42c4681b3 100644
--- a/src/fiatExchanges/PaymentMethodSection.tsx
+++ b/src/fiatExchanges/PaymentMethodSection.tsx
@@ -197,7 +197,11 @@ export function PaymentMethodSection({
}
const renderInfoText = (quote: NormalizedQuote) => {
- const reqsSubtitleInfo = quote.getReqsSubtitle()
+ const mobileCarrier = quote.getMobileCarrier()
+ const mobileCarrierRequirement = t('selectProviderScreen.mobileCarrierRequirement', {
+ carrier: mobileCarrier,
+ })
+ const reqsSubtitleInfo = mobileCarrier ? mobileCarrierRequirement : quote.getKycInfo()
const reqsSubtitleString = reqsSubtitleInfo ? `${reqsSubtitleInfo} | ` : ''
return `${reqsSubtitleString}${getPaymentMethodSettlementTimeString(quote.getTimeEstimation())}`
}
diff --git a/src/fiatExchanges/quotes/ExternalQuote.ts b/src/fiatExchanges/quotes/ExternalQuote.ts
index 97299d8654b..589e22696b4 100644
--- a/src/fiatExchanges/quotes/ExternalQuote.ts
+++ b/src/fiatExchanges/quotes/ExternalQuote.ts
@@ -26,7 +26,6 @@ const strings = {
oneHour: i18n.t('selectProviderScreen.oneHour'),
numDays: i18n.t('selectProviderScreen.numDays'),
idRequired: i18n.t('selectProviderScreen.idRequired'),
- mobileCarrierRequirement: 'selectProviderScreen.mobileCarrierRequirement',
}
const paymentMethodToSettlementTime = {
@@ -104,12 +103,12 @@ export default class ExternalQuote extends NormalizedQuote {
return null
}
- getReqsSubtitle(): string | null {
+ getMobileCarrier(): string | undefined {
return !isSimplexQuote(this.quote) &&
this.getPaymentMethod() === PaymentMethod.Airtime &&
this.quote.extraReqs?.mobileCarrier
- ? i18n.t(strings.mobileCarrierRequirement, this.quote.extraReqs.mobileCarrier)
- : this.getKycInfo()
+ ? this.quote.extraReqs.mobileCarrier
+ : undefined
}
getKycInfo(): string | null {
diff --git a/src/fiatExchanges/quotes/FiatConnectQuote.ts b/src/fiatExchanges/quotes/FiatConnectQuote.ts
index 99222e45f78..e443c5ebdef 100644
--- a/src/fiatExchanges/quotes/FiatConnectQuote.ts
+++ b/src/fiatExchanges/quotes/FiatConnectQuote.ts
@@ -194,8 +194,8 @@ export default class FiatConnectQuote extends NormalizedQuote {
})
}
- getReqsSubtitle(): string | null {
- return this.getKycInfo()
+ getMobileCarrier(): string | undefined {
+ return undefined
}
getKycInfo(): string | null {
diff --git a/src/fiatExchanges/quotes/NormalizedQuote.ts b/src/fiatExchanges/quotes/NormalizedQuote.ts
index 037344b6b2e..8aa6b0f869a 100644
--- a/src/fiatExchanges/quotes/NormalizedQuote.ts
+++ b/src/fiatExchanges/quotes/NormalizedQuote.ts
@@ -13,7 +13,7 @@ export default abstract class NormalizedQuote {
abstract getFeeInFiat(usdToLocalRate: string | null, tokenInfo: TokenBalance): BigNumber | null
abstract getFeeInCrypto(usdToLocalRate: string | null, tokenInfo: TokenBalance): BigNumber | null
abstract getCryptoType(): CiCoCurrency
- abstract getReqsSubtitle(): string | null
+ abstract getMobileCarrier(): string | undefined
abstract getKycInfo(): string | null
abstract getTimeEstimation(): SettlementEstimation
abstract getProviderName(): string
diff --git a/src/fiatExchanges/utils.test.ts b/src/fiatExchanges/utils.test.ts
index cf6ddb85b51..44752a6b663 100644
--- a/src/fiatExchanges/utils.test.ts
+++ b/src/fiatExchanges/utils.test.ts
@@ -14,7 +14,7 @@ class MockNormalizedQuote extends NormalizedQuote {
getFeeInCrypto = jest.fn()
getFeeInFiat = jest.fn()
getKycInfo = jest.fn()
- getReqsSubtitle = jest.fn()
+ getMobileCarrier = jest.fn()
getPaymentMethod = jest.fn()
getProviderId = jest.fn()
getProviderLogo = jest.fn()