diff options
Diffstat (limited to 'wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/client/c2ec/C2ECClient.kt')
-rw-r--r-- | wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/client/c2ec/C2ECClient.kt | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/client/c2ec/C2ECClient.kt b/wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/client/c2ec/C2ECClient.kt deleted file mode 100644 index 71cbc16..0000000 --- a/wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/client/c2ec/C2ECClient.kt +++ /dev/null @@ -1,48 +0,0 @@ -package ch.bfh.habej2.wallee_c2ec.client.c2ec - -import ch.bfh.habej2.wallee_c2ec.config.CURRENT_EXCHANGE -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import okhttp3.Response - -class C2ECClient { - - companion object { - const val WITHDRAWAL_OP = "/c2ec/withdrawal-operation" - const val WITHDRAWAL_STATUS = "$WITHDRAWAL_OP/:wopid" - const val WITHDRAWAL_PAYMENT = "$WITHDRAWAL_OP/:wopid/payment" - } - - init { - var client = OkHttpClient.Builder() - .addInterceptor(C2ECBasicAuthInterceptor()) - .build(); - } - - fun retrieveWithdrawalStatus(wopid: String, longPollMs: Int): C2ECWithdrawalOperationStatus { - - println("retrieving withdrawal operation status...") - return C2ECWithdrawalOperationStatus() - } - - fun sendPaymentNotification(payment: C2ECPaymentNotification) { - println("sending payment notification...") - } - - private class C2ECBasicAuthInterceptor : Interceptor { - - override fun intercept(chain: Interceptor.Chain): Response { - - val base64EncodedCredentials = java.util.Base64 - .getUrlEncoder() - .encode("${CURRENT_EXCHANGE!!.terminalId}:${CURRENT_EXCHANGE!!.accessToken}".toByteArray()) - .toString() - - return chain.proceed( - chain.request().newBuilder() - .header("Authorization", base64EncodedCredentials) - .build() - ) - } - } -}
\ No newline at end of file |