-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed2ed1d
commit ca9404f
Showing
14 changed files
with
165 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,9 +289,9 @@ class FragmentSelectPaymentMethod : Fragment() { | |
shippingDetails = provideShippingDetails(), | ||
customUrlScheme = "customScheme", | ||
venmoRequest = VenmoRequest( | ||
consumerId = "ala-bala-portocalaaaa", | ||
merchantAccountId = "", | ||
profileId = "" | ||
consumerId = "[email protected]", | ||
merchantAccountId = "merch-acc-id", | ||
profileId = "profile-di" | ||
) | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
paysafe-core/src/main/java/com/paysafe/android/currencyConverter/CurrencyConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.paysafe.android.currencyConverter | ||
|
||
import kotlin.math.pow | ||
|
||
final class CurrencyConverter( | ||
private val multiplierMap: Map<PSCurrency, Int> | ||
) { | ||
|
||
// Method to convert minor amount based on the currency. | ||
fun convert(amount: Int, forCurrency: String): Double { | ||
val psCurrency = PSCurrency.values().find { it.name == forCurrency } | ||
val power = psCurrency?.let { multiplierMap[it] } ?: 2 | ||
if (psCurrency == null) { | ||
println("Currency doesn't need conversion: $forCurrency") | ||
} | ||
return amount.toDouble() / 10.0.pow(power.toDouble()) | ||
} | ||
|
||
companion object { | ||
// Default multiplier map | ||
fun defaultCurrenciesMap(): Map<PSCurrency, Int> { | ||
return mapOf( | ||
PSCurrency.BHD to 3, | ||
PSCurrency.BYR to 0, | ||
PSCurrency.JPY to 0, | ||
PSCurrency.JOD to 3, | ||
PSCurrency.KRW to 0, | ||
PSCurrency.KWD to 3, | ||
PSCurrency.LYD to 3, | ||
PSCurrency.OMR to 3, | ||
PSCurrency.PYG to 0, | ||
PSCurrency.TND to 3, | ||
PSCurrency.VND to 0 | ||
) | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
paysafe-core/src/main/java/com/paysafe/android/currencyConverter/PSCurrency.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.paysafe.android.currencyConverter | ||
|
||
enum class PSCurrency(val value: String) { | ||
// Bahraini Dinar | ||
BHD("BHD"), | ||
// Belarusian Ruble (Note: The BYR was replaced by BYN in 2016) | ||
BYR("BYR"), | ||
// Japanese Yen | ||
JPY("JPY"), | ||
// Jordanian Dinar | ||
JOD("JOD"), | ||
// South Korean Won | ||
KRW("KRW"), | ||
// Kuwaiti Dinar | ||
KWD("KWD"), | ||
// Libyan Dinar | ||
LYD("LYD"), | ||
// Omani Rial | ||
OMR("OMR"), | ||
// Paraguayan Guaraní | ||
PYG("PYG"), | ||
// Tunisian Dinar | ||
TND("TND"), | ||
// Vietnamese Đồng | ||
VND("VND") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.