Skip to content

Commit 98ecfa9

Browse files
authored
Merge pull request #16045 from woocommerce/remove-ipp-pos-support-from-fiscalization-countries
Remove fiscalization countries from IPP and POS support
2 parents 96f04a2 + a3be34c commit 98ecfa9

16 files changed

Lines changed: 60 additions & 315 deletions

File tree

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/cardreader/CardReaderCountryConfigProvider.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,12 @@ class CardReaderCountryConfigProvider @Inject constructor(
2828

2929
private companion object {
3030
val EXPANSION_COUNTRY_FEATURE_FLAGS = mapOf(
31-
"FR" to FeatureFlag.IPP_COUNTRY_EXPANSION,
32-
"DE" to FeatureFlag.IPP_COUNTRY_EXPANSION,
3331
"IE" to FeatureFlag.IPP_COUNTRY_EXPANSION,
3432
"NL" to FeatureFlag.IPP_COUNTRY_EXPANSION,
3533
"SG" to FeatureFlag.IPP_COUNTRY_EXPANSION,
3634
"NZ" to FeatureFlag.IPP_COUNTRY_EXPANSION,
37-
"AT" to FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED,
38-
"BE" to FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED,
3935
"FI" to FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED,
40-
"IT" to FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED,
4136
"LU" to FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED,
42-
"PT" to FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED,
43-
"ES" to FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED,
4437
"AU" to FeatureFlag.IPP_AUSTRALIA_WOOPAYMENTS,
4538
)
4639
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/tab/WooPosSupportedCountries.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,14 @@ class WooPosSupportedCountries @Inject constructor(
3030
private companion object {
3131
val BASE_PAIRS = listOf("us" to "usd", "pr" to "usd", "gb" to "gbp")
3232
val PRIMARY_EXPANSION_PAIRS = listOf(
33-
"fr" to "eur",
34-
"de" to "eur",
3533
"ie" to "eur",
3634
"nl" to "eur",
3735
"sg" to "sgd",
3836
"nz" to "nzd",
3937
)
4038
val EU_EXTENDED_PAIRS = listOf(
41-
"at" to "eur",
42-
"be" to "eur",
4339
"fi" to "eur",
44-
"it" to "eur",
4540
"lu" to "eur",
46-
"pt" to "eur",
47-
"es" to "eur",
4841
)
4942
val AUSTRALIA_PAIR = "au" to "aud"
5043
}

WooCommerce/src/test/kotlin/com/woocommerce/android/ui/payments/cardreader/CardReaderCountryConfigProviderTest.kt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
package com.woocommerce.android.ui.payments.cardreader
22

33
import com.woocommerce.android.cardreader.config.CardReaderConfigFactory
4-
import com.woocommerce.android.cardreader.config.CardReaderConfigForAT
54
import com.woocommerce.android.cardreader.config.CardReaderConfigForAustralia
6-
import com.woocommerce.android.cardreader.config.CardReaderConfigForBE
75
import com.woocommerce.android.cardreader.config.CardReaderConfigForCanada
8-
import com.woocommerce.android.cardreader.config.CardReaderConfigForDE
9-
import com.woocommerce.android.cardreader.config.CardReaderConfigForES
106
import com.woocommerce.android.cardreader.config.CardReaderConfigForFI
11-
import com.woocommerce.android.cardreader.config.CardReaderConfigForFR
127
import com.woocommerce.android.cardreader.config.CardReaderConfigForGB
138
import com.woocommerce.android.cardreader.config.CardReaderConfigForIE
14-
import com.woocommerce.android.cardreader.config.CardReaderConfigForIT
159
import com.woocommerce.android.cardreader.config.CardReaderConfigForLU
1610
import com.woocommerce.android.cardreader.config.CardReaderConfigForNL
1711
import com.woocommerce.android.cardreader.config.CardReaderConfigForNZ
18-
import com.woocommerce.android.cardreader.config.CardReaderConfigForPT
1912
import com.woocommerce.android.cardreader.config.CardReaderConfigForSG
2013
import com.woocommerce.android.cardreader.config.CardReaderConfigForUSA
2114
import com.woocommerce.android.cardreader.config.CardReaderConfigForUnsupportedCountry
@@ -90,8 +83,6 @@ class CardReaderCountryConfigProviderTest {
9083
fun `given primary expansion country and primary flag on, when config provide, then per-country config returned`() {
9184
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION)).thenReturn(true)
9285

93-
assertThat(sut.provideCountryConfigFor("FR")).isInstanceOf(CardReaderConfigForFR::class.java)
94-
assertThat(sut.provideCountryConfigFor("DE")).isInstanceOf(CardReaderConfigForDE::class.java)
9586
assertThat(sut.provideCountryConfigFor("IE")).isInstanceOf(CardReaderConfigForIE::class.java)
9687
assertThat(sut.provideCountryConfigFor("NL")).isInstanceOf(CardReaderConfigForNL::class.java)
9788
assertThat(sut.provideCountryConfigFor("SG")).isInstanceOf(CardReaderConfigForSG::class.java)
@@ -100,7 +91,7 @@ class CardReaderCountryConfigProviderTest {
10091

10192
@Test
10293
fun `given primary expansion country and primary flag off, when config provide, then unsupported returned`() {
103-
listOf("FR", "DE", "IE", "NL", "SG", "NZ").forEach { code ->
94+
listOf("IE", "NL", "SG", "NZ").forEach { code ->
10495
assertThat(sut.provideCountryConfigFor(code))
10596
.`as`("Expected $code to be unsupported when primary flag is off")
10697
.isInstanceOf(CardReaderConfigForUnsupportedCountry::class.java)
@@ -111,7 +102,7 @@ class CardReaderCountryConfigProviderTest {
111102
fun `given primary expansion country with only EU extended flag on, when config provide, then unsupported returned`() {
112103
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED)).thenReturn(true)
113104

114-
listOf("FR", "DE", "IE", "NL", "SG", "NZ").forEach { code ->
105+
listOf("IE", "NL", "SG", "NZ").forEach { code ->
115106
assertThat(sut.provideCountryConfigFor(code))
116107
.`as`("Expected $code to be unsupported when only EU extended flag is on")
117108
.isInstanceOf(CardReaderConfigForUnsupportedCountry::class.java)
@@ -124,18 +115,13 @@ class CardReaderCountryConfigProviderTest {
124115
fun `given EU extended country and EU extended flag on, when config provide, then per-country config returned`() {
125116
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED)).thenReturn(true)
126117

127-
assertThat(sut.provideCountryConfigFor("AT")).isInstanceOf(CardReaderConfigForAT::class.java)
128-
assertThat(sut.provideCountryConfigFor("BE")).isInstanceOf(CardReaderConfigForBE::class.java)
129118
assertThat(sut.provideCountryConfigFor("FI")).isInstanceOf(CardReaderConfigForFI::class.java)
130-
assertThat(sut.provideCountryConfigFor("IT")).isInstanceOf(CardReaderConfigForIT::class.java)
131119
assertThat(sut.provideCountryConfigFor("LU")).isInstanceOf(CardReaderConfigForLU::class.java)
132-
assertThat(sut.provideCountryConfigFor("PT")).isInstanceOf(CardReaderConfigForPT::class.java)
133-
assertThat(sut.provideCountryConfigFor("ES")).isInstanceOf(CardReaderConfigForES::class.java)
134120
}
135121

136122
@Test
137123
fun `given EU extended country and EU extended flag off, when config provide, then unsupported returned`() {
138-
listOf("AT", "BE", "FI", "IT", "LU", "PT", "ES").forEach { code ->
124+
listOf("FI", "LU").forEach { code ->
139125
assertThat(sut.provideCountryConfigFor(code))
140126
.`as`("Expected $code to be unsupported when EU extended flag is off")
141127
.isInstanceOf(CardReaderConfigForUnsupportedCountry::class.java)
@@ -146,10 +132,23 @@ class CardReaderCountryConfigProviderTest {
146132
fun `given EU extended country with only primary flag on, when config provide, then unsupported returned`() {
147133
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION)).thenReturn(true)
148134

149-
listOf("AT", "BE", "FI", "IT", "LU", "PT", "ES").forEach { code ->
135+
listOf("FI", "LU").forEach { code ->
150136
assertThat(sut.provideCountryConfigFor(code))
151137
.`as`("Expected $code to be unsupported when only primary flag is on")
152138
.isInstanceOf(CardReaderConfigForUnsupportedCountry::class.java)
153139
}
154140
}
141+
142+
@Test
143+
fun `given fiscalization country codes and all flags on, when config provide, then unsupported returned`() {
144+
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION)).thenReturn(true)
145+
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED)).thenReturn(true)
146+
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_AUSTRALIA_WOOPAYMENTS)).thenReturn(true)
147+
148+
listOf("AT", "BE", "FR", "IT", "DE", "PT", "ES").forEach { code ->
149+
assertThat(sut.provideCountryConfigFor(code))
150+
.`as`("Expected $code to be unsupported")
151+
.isInstanceOf(CardReaderConfigForUnsupportedCountry::class.java)
152+
}
153+
}
155154
}

WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/eligibility/WooPosEligibilityViewModelTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ class WooPosEligibilityViewModelTest {
241241
}
242242

243243
@Test
244-
fun `given DE store and primary expansion flag on, when ineligible due to unsupported currency, then message uses EUR`() = runTest {
244+
fun `given IE store and primary expansion flag on, when ineligible due to unsupported currency, then message uses EUR`() = runTest {
245245
// GIVEN
246246
whenever(supportedCountries.supportedCountryCurrencyPairs()).thenReturn(
247-
listOf("us" to "usd", "gb" to "gbp", "de" to "eur"),
247+
listOf("us" to "usd", "gb" to "gbp", "ie" to "eur"),
248248
)
249249
val sut = createSut()
250-
whenever(mockStoreCountryProvider()).thenReturn("Germany")
251-
whenever(mockStoreCountryCodeProvider()).thenReturn("de")
250+
whenever(mockStoreCountryProvider()).thenReturn("Ireland")
251+
whenever(mockStoreCountryCodeProvider()).thenReturn("ie")
252252

253253
// WHEN
254254
sut.initialize(WooPosLaunchability.NonLaunchabilityReason.UnsupportedCurrency)
@@ -257,20 +257,20 @@ class WooPosEligibilityViewModelTest {
257257
// THEN
258258
verify(mockResourceProvider).getString(
259259
eq(com.woocommerce.android.R.string.woopos_eligibility_reason_unsupported_currency_country_pair),
260-
eq("Germany"),
260+
eq("Ireland"),
261261
eq("EUR"),
262262
)
263263
}
264264

265265
@Test
266-
fun `given DE store and primary expansion flag off, when ineligible due to unsupported currency, then generic message used`() = runTest {
266+
fun `given IE store and primary expansion flag off, when ineligible due to unsupported currency, then generic message used`() = runTest {
267267
// GIVEN
268268
whenever(supportedCountries.supportedCountryCurrencyPairs()).thenReturn(
269269
listOf("us" to "usd", "gb" to "gbp"),
270270
)
271271
val sut = createSut()
272-
whenever(mockStoreCountryProvider()).thenReturn("Germany")
273-
whenever(mockStoreCountryCodeProvider()).thenReturn("de")
272+
whenever(mockStoreCountryProvider()).thenReturn("Ireland")
273+
whenever(mockStoreCountryCodeProvider()).thenReturn("ie")
274274

275275
// WHEN
276276
sut.initialize(WooPosLaunchability.NonLaunchabilityReason.UnsupportedCurrency)

WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/tab/WooPosCanBeLaunchedInTabTest.kt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -291,20 +291,20 @@ class WooPosCanBeLaunchedInTabTest : BaseUnitTest() {
291291
// --- Supported countries dynamic list ---
292292

293293
@Test
294-
fun `given DE country and EUR currency and primary flag on, when invoked, then return Launchable`() = testBlocking {
294+
fun `given IE country and EUR currency and primary flag on, when invoked, then return Launchable`() = testBlocking {
295295
whenever(supportedCountries.supportedCountryCurrencyPairs())
296-
.thenReturn(listOf("us" to "usd", "gb" to "gbp", "de" to "eur"))
297-
val siteSettings = buildSiteSettings(countryCode = "DE", currencyCode = "EUR")
296+
.thenReturn(listOf("us" to "usd", "gb" to "gbp", "ie" to "eur"))
297+
val siteSettings = buildSiteSettings(countryCode = "IE", currencyCode = "EUR")
298298
whenever(wooCommerceStore.getSiteSettings(any())).thenReturn(siteSettings)
299299

300300
assertEquals(Launchable, sut())
301301
}
302302

303303
@Test
304-
fun `given DE country and EUR currency and primary flag off, when invoked, then return UnsupportedCurrency`() = testBlocking {
304+
fun `given IE country and EUR currency and primary flag off, when invoked, then return UnsupportedCurrency`() = testBlocking {
305305
whenever(supportedCountries.supportedCountryCurrencyPairs())
306306
.thenReturn(listOf("us" to "usd", "gb" to "gbp"))
307-
val siteSettings = buildSiteSettings(countryCode = "DE", currencyCode = "EUR")
307+
val siteSettings = buildSiteSettings(countryCode = "IE", currencyCode = "EUR")
308308
whenever(wooCommerceStore.getSiteSettings(any())).thenReturn(siteSettings)
309309

310310
val result = sut()
@@ -318,19 +318,12 @@ class WooPosCanBeLaunchedInTabTest : BaseUnitTest() {
318318
listOf(
319319
"us" to "usd",
320320
"gb" to "gbp",
321-
"fr" to "eur",
322-
"de" to "eur",
323321
"ie" to "eur",
324322
"nl" to "eur",
325323
"sg" to "sgd",
326324
"nz" to "nzd",
327-
"at" to "eur",
328-
"be" to "eur",
329325
"fi" to "eur",
330-
"it" to "eur",
331326
"lu" to "eur",
332-
"pt" to "eur",
333-
"es" to "eur",
334327
"au" to "aud",
335328
)
336329
)

WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/tab/WooPosSupportedCountriesTest.kt

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class WooPosSupportedCountriesTest : BaseUnitTest() {
4646
"us" to "usd",
4747
"pr" to "usd",
4848
"gb" to "gbp",
49-
"fr" to "eur",
50-
"de" to "eur",
5149
"ie" to "eur",
5250
"nl" to "eur",
5351
"sg" to "sgd",
@@ -61,19 +59,21 @@ class WooPosSupportedCountriesTest : BaseUnitTest() {
6159

6260
assertThat(sut.supportedCountryCurrencyPairs())
6361
.containsExactlyInAnyOrder(
64-
"us" to "usd", "pr" to "usd", "gb" to "gbp",
65-
"at" to "eur", "be" to "eur", "fi" to "eur", "it" to "eur",
66-
"lu" to "eur", "pt" to "eur", "es" to "eur",
62+
"us" to "usd",
63+
"pr" to "usd",
64+
"gb" to "gbp",
65+
"fi" to "eur",
66+
"lu" to "eur",
6767
)
6868
}
6969

7070
@Test
71-
fun `given primary and EU extended flags on, when supportedCountryCurrencyPairs called, then all 16 pairs returned and AU absent`() = testBlocking {
71+
fun `given primary and EU extended flags on, when supportedCountryCurrencyPairs called, then all 9 pairs returned and AU absent`() = testBlocking {
7272
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION)).thenReturn(true)
7373
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED)).thenReturn(true)
7474

7575
val pairs = sut.supportedCountryCurrencyPairs()
76-
assertThat(pairs).hasSize(16)
76+
assertThat(pairs).hasSize(9)
7777
assertThat(pairs.map { it.first }).doesNotContain("au")
7878
}
7979

@@ -99,9 +99,19 @@ class WooPosSupportedCountriesTest : BaseUnitTest() {
9999
assertThat(sut.supportedCountries())
100100
.containsExactlyInAnyOrder(
101101
"us", "pr", "gb",
102-
"fr", "de", "ie", "nl", "sg", "nz",
103-
"at", "be", "fi", "it", "lu", "pt", "es",
102+
"ie", "nl", "sg", "nz",
103+
"fi", "lu",
104104
"au",
105105
)
106106
}
107+
108+
@Test
109+
fun `given all expansion flags on, when supportedCountries called, then fiscalization countries are absent`() = testBlocking {
110+
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION)).thenReturn(true)
111+
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_COUNTRY_EXPANSION_EU_EXTENDED)).thenReturn(true)
112+
whenever(featureFlagRepository.isEnabled(FeatureFlag.IPP_AUSTRALIA_WOOPAYMENTS)).thenReturn(true)
113+
114+
assertThat(sut.supportedCountries())
115+
.doesNotContain("at", "be", "fr", "it", "de", "pt", "es")
116+
}
107117
}

WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/tab/WooPosTabShouldBeVisibleTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ class WooPosTabShouldBeVisibleTest : BaseUnitTest() {
195195
}
196196

197197
@Test
198-
fun `given primary expansion country DE and primary flag on, when invoked, then return success true`() = testBlocking {
199-
whenever(supportedCountries.supportedCountries()).thenReturn(listOf("us", "gb", "de"))
200-
val siteSettings = buildSiteSettings(countryCode = "DE", currencyCode = "EUR")
198+
fun `given primary expansion country IE and primary flag on, when invoked, then return success true`() = testBlocking {
199+
whenever(supportedCountries.supportedCountries()).thenReturn(listOf("us", "gb", "ie"))
200+
val siteSettings = buildSiteSettings(countryCode = "IE", currencyCode = "EUR")
201201
whenever(wooCommerceStore.fetchSiteGeneralSettings(siteModel)).thenReturn(WooResult(siteSettings))
202202

203203
val r = sut(forceRefresh = true)
@@ -206,9 +206,9 @@ class WooPosTabShouldBeVisibleTest : BaseUnitTest() {
206206
}
207207

208208
@Test
209-
fun `given primary expansion country DE and primary flag off, when invoked, then return success false`() = testBlocking {
209+
fun `given primary expansion country IE and primary flag off, when invoked, then return success false`() = testBlocking {
210210
whenever(supportedCountries.supportedCountries()).thenReturn(listOf("us", "gb"))
211-
val siteSettings = buildSiteSettings(countryCode = "DE", currencyCode = "EUR")
211+
val siteSettings = buildSiteSettings(countryCode = "IE", currencyCode = "EUR")
212212
whenever(wooCommerceStore.fetchSiteGeneralSettings(siteModel)).thenReturn(WooResult(siteSettings))
213213

214214
val r = sut(forceRefresh = true)

libs/cardreader/src/main/java/com/woocommerce/android/cardreader/config/CardReaderConfigFactory.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,12 @@ class CardReaderConfigFactory {
1111
"PR" to CardReaderConfigForUSA,
1212
"CA" to CardReaderConfigForCanada,
1313
"GB" to CardReaderConfigForGB,
14-
"FR" to CardReaderConfigForFR,
15-
"DE" to CardReaderConfigForDE,
1614
"IE" to CardReaderConfigForIE,
1715
"NL" to CardReaderConfigForNL,
1816
"SG" to CardReaderConfigForSG,
1917
"NZ" to CardReaderConfigForNZ,
20-
"AT" to CardReaderConfigForAT,
21-
"BE" to CardReaderConfigForBE,
2218
"FI" to CardReaderConfigForFI,
23-
"IT" to CardReaderConfigForIT,
2419
"LU" to CardReaderConfigForLU,
25-
"PT" to CardReaderConfigForPT,
26-
"ES" to CardReaderConfigForES,
2720
"AU" to CardReaderConfigForAustralia,
2821
)
2922
}

libs/cardreader/src/main/java/com/woocommerce/android/cardreader/config/CardReaderConfigForAT.kt

Lines changed: 0 additions & 28 deletions
This file was deleted.

libs/cardreader/src/main/java/com/woocommerce/android/cardreader/config/CardReaderConfigForBE.kt

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)