Skip to content

Commit

Permalink
fix(fonbnk): Fix mobile carrier string (#4233)
Browse files Browse the repository at this point in the history
### 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
<img width="331" alt="Screenshot 2023-09-27 at 10 43 12 AM"
src="https://github.com/valora-inc/wallet/assets/140328381/5126e082-0883-4e3c-8e82-2ccd308c0d53">
<img width="331" alt="Screenshot 2023-09-27 at 10 43 46 AM"
src="https://github.com/valora-inc/wallet/assets/140328381/dcc28223-2f9a-4f55-9ba7-f10667bc26ea">
  • Loading branch information
finnian0826 authored Sep 27, 2023
1 parent 7c9597a commit 9bae467
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/fiatExchanges/PaymentMethodSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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())}`
}
Expand Down
7 changes: 3 additions & 4 deletions src/fiatExchanges/quotes/ExternalQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/fiatExchanges/quotes/FiatConnectQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export default class FiatConnectQuote extends NormalizedQuote {
})
}

getReqsSubtitle(): string | null {
return this.getKycInfo()
getMobileCarrier(): string | undefined {
return undefined
}

getKycInfo(): string | null {
Expand Down
2 changes: 1 addition & 1 deletion src/fiatExchanges/quotes/NormalizedQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/fiatExchanges/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9bae467

Please sign in to comment.