Skip to content

Commit

Permalink
Merge pull request #58 from network-international/device_info
Browse files Browse the repository at this point in the history
Added device info in request header
  • Loading branch information
gautam-ni committed Feb 12, 2024
2 parents 49bc36a + ca94623 commit 5f2620d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package payment.sdk.android.core.api

import android.os.Build
import androidx.annotation.UiThread
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
Expand Down Expand Up @@ -176,8 +177,10 @@ class CoroutinesGatewayHttpClient : HttpClient {
connectTimeout = 30000
doOutput = isDoOutput
useCaches = false
val device = "${Build.MANUFACTURER}-${Build.MODEL}"
val os = "OS-${Build.VERSION.SDK_INT}"
setRequestProperty("Accept-Language", "UTF-8")
setRequestProperty("User-Agent", "Android Pay Page")
setRequestProperty("User-Agent", "Android Pay Page $device $os")

headers.forEach { (key, value) ->
setRequestProperty(key, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ open class ThreeDSecureWebViewActivity : AppCompatActivity() {
private fun finishWithError(message: String) {
val intent = Intent().apply {
putExtra(CardPaymentData.INTENT_DATA_KEY, CardPaymentData(CardPaymentData.STATUS_GENERIC_ERROR, message))
putExtra(KEY_3DS_STATE, STATUS_PAYMENT_FAILED)
}
setResult(Activity.RESULT_OK, intent)
finish()
Expand Down Expand Up @@ -160,6 +161,7 @@ open class ThreeDSecureWebViewActivity : AppCompatActivity() {

companion object {
const val KEY_3DS_STATE = "3ds-state"
const val STATUS_PAYMENT_FAILED = "FAILED"

fun getIntent(context: Context, acsUrl: String?, acsPaReq: String?, acsMd: String?, gatewayUrl: String?) =
Intent(context, ThreeDSecureWebViewActivity::class.java).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ open class ThreeDSecureTwoWebViewActivity : AppCompatActivity() {
private fun finishWithError(message: String) {
val intent = Intent().apply {
putExtra(CardPaymentData.INTENT_DATA_KEY, CardPaymentData(CardPaymentData.STATUS_GENERIC_ERROR, message))
putExtra(KEY_3DS_STATE, STATUS_PAYMENT_FAILED)
}
setResult(Activity.RESULT_OK, intent)
finish()
Expand Down

0 comments on commit 5f2620d

Please sign in to comment.