aboutsummaryrefslogtreecommitdiff
path: root/cashier/src/main
diff options
context:
space:
mode:
authorMS <ms@taler.net>2022-06-07 21:24:26 +0200
committerMS <ms@taler.net>2022-06-07 21:24:26 +0200
commit1b4fba9ebded6e6babb6eb607aacf453ca474d22 (patch)
tree6125dc6c8b8aff7a63543071d647dcf1f27ce6d7 /cashier/src/main
parentcf5f9fa574c07fc3276874606b333f974c63fdc9 (diff)
downloadtaler-android-1b4fba9ebded6e6babb6eb607aacf453ca474d22.tar.gz
taler-android-1b4fba9ebded6e6babb6eb607aacf453ca474d22.tar.bz2
taler-android-1b4fba9ebded6e6babb6eb607aacf453ca474d22.zip
cashier: adapt URLs to euFin Sandbox
Diffstat (limited to 'cashier/src/main')
-rw-r--r--cashier/src/main/java/net/taler/cashier/MainViewModel.kt2
-rw-r--r--cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt6
-rw-r--r--cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt5
-rw-r--r--cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt8
4 files changed, 11 insertions, 10 deletions
diff --git a/cashier/src/main/java/net/taler/cashier/MainViewModel.kt b/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
index 2196e78..21d0209 100644
--- a/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
+++ b/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
@@ -64,7 +64,7 @@ class MainViewModel(private val app: Application) : AndroidViewModel(app) {
fun getBalance() = viewModelScope.launch(Dispatchers.IO) {
check(configManager.hasConfig()) { "No config to get balance" }
val config = configManager.config
- val url = "${config.bankUrl}/accounts/${config.username}"
+ val url = "${config.bankUrl}/access-api/accounts/${config.username}"
Log.d(TAG, "Checking balance at $url")
val result = when (val response = makeJsonGetRequest(url, config)) {
is HttpJsonResult.Success -> {
diff --git a/cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt b/cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt
index e6ac249..6bee259 100644
--- a/cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt
+++ b/cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt
@@ -38,7 +38,8 @@ import net.taler.cashier.R
import net.taler.cashier.databinding.FragmentConfigBinding
import net.taler.common.exhaustive
-private const val URL_BANK_TEST = "https://bank.test.taler.net"
+// NOTE: HTTP should eventually be disabled.
+private const val URL_BANK_TEST = "http://10.0.2.2:8080/sandbox/demobanks/default"
private const val URL_BANK_TEST_REGISTER = "$URL_BANK_TEST/accounts/register"
class ConfigFragment : Fragment() {
@@ -116,7 +117,8 @@ class ConfigFragment : Fragment() {
}
private fun checkConfig(config: Config): Boolean {
- if (!config.bankUrl.startsWith("https://")) {
+ if (!config.bankUrl.startsWith("https://") &&
+ !config.bankUrl.startsWith("http://")) {
ui.urlView.error = getString(R.string.config_bank_url_error)
ui.urlView.requestFocus()
return false
diff --git a/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt b/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
index 2fde37d..d850d27 100644
--- a/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
+++ b/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
@@ -112,9 +112,8 @@ class ConfigManager(
mConfigResult.postValue(result)
}
}
-
private suspend fun checkConfig(config: Config) = withContext(Dispatchers.IO) {
- val url = "${config.bankUrl}/config"
+ val url = "${config.bankUrl}/integration-api/config"
Log.d(TAG, "Checking config: $url")
val configResponse = response {
httpClient.get(url).body<ConfigResponse>()
@@ -125,7 +124,7 @@ class ConfigManager(
// we need to check an endpoint that requires authentication as well
// to see if the credentials are valid
val balanceResponse = response {
- val authUrl = "${config.bankUrl}/accounts/${config.username}"
+ val authUrl = "${config.bankUrl}/access-api/accounts/${config.username}"
Log.d(TAG, "Checking auth: $authUrl")
httpClient.get(authUrl) {
header(Authorization, config.basicAuth)
diff --git a/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt b/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
index 360bded..1b809bb 100644
--- a/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
+++ b/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
@@ -87,7 +87,7 @@ class WithdrawManager(
mWithdrawResult.value = null
mWithdrawAmount.value = amount
scope.launch(Dispatchers.IO) {
- val url = "${config.bankUrl}/accounts/${config.username}/withdrawals"
+ val url = "${config.bankUrl}/access-api/accounts/${config.username}/withdrawals"
Log.d(TAG, "Starting withdrawal at $url")
val map = mapOf("amount" to amount.toJSONString())
val body = JSONObject(map)
@@ -146,7 +146,7 @@ class WithdrawManager(
}
private fun checkWithdrawStatus(withdrawalId: String) = scope.launch(Dispatchers.IO) {
- val url = "${config.bankUrl}/accounts/${config.username}/withdrawals/${withdrawalId}"
+ val url = "${config.bankUrl}/access-api/accounts/${config.username}/withdrawals/${withdrawalId}"
Log.d(TAG, "Checking withdraw status at $url")
val response = makeJsonGetRequest(url, config)
if (response !is Success) return@launch // ignore errors and continue trying
@@ -197,7 +197,7 @@ class WithdrawManager(
}
private fun abort(withdrawalId: String) = scope.launch(Dispatchers.IO) {
- val url = "${config.bankUrl}/accounts/${config.username}/withdrawals/${withdrawalId}/abort"
+ val url = "${config.bankUrl}/access-api/accounts/${config.username}/withdrawals/${withdrawalId}/abort"
Log.d(TAG, "Aborting withdrawal at $url")
makeJsonPostRequest(url, JSONObject(), config)
}
@@ -207,7 +207,7 @@ class WithdrawManager(
mWithdrawStatus.value = WithdrawStatus.Confirming
scope.launch(Dispatchers.IO) {
val url =
- "${config.bankUrl}/accounts/${config.username}/withdrawals/${withdrawalId}/confirm"
+ "${config.bankUrl}/access-api/accounts/${config.username}/withdrawals/${withdrawalId}/confirm"
Log.d(TAG, "Confirming withdrawal at $url")
when (val response = makeJsonPostRequest(url, JSONObject(), config)) {
is Success -> {