omise-android icon indicating copy to clipboard operation
omise-android copied to clipboard

Crash on failed authorize_uri that has acs=true query parameter

Open nqtsparda opened this issue 1 year ago • 8 comments

Expected behavior

If there is anything go wrong in Authorizing Payment page, it should show error and guide user what to do next

Actual behavior

  • Using a failed authorize_uri that has query param acs=true makes the app crash on AuthorizingPaymentActivity
  • If there is no acs=true in query param, AuthorizingPaymentActivity still can render error page without problem

Steps to reproduce the issue

  • Setup intent to call to AuthorizingPaymentActivity with a failed authorize uri including acs=true in query param
val intent = Intent(fragment.requireActivity(), AuthorizingPaymentActivity::class.java)
        intent.putExtra(AuthorizingPaymentURLVerifier.EXTRA_AUTHORIZED_URLSTRING, "https://api.omise.co/payments/paym_test_no1t4tnemucod0e51mo/authorize?acs=true")
        intent.putExtra(
            AuthorizingPaymentActivity.EXTRA_THREE_DS_REQUESTOR_APP_URL,
            "deeplink://sample"
        )
        intent.putExtra(
            AuthorizingPaymentURLVerifier.EXTRA_EXPECTED_RETURN_URLSTRING_PATTERNS,
            "https://www.example.com"
        )
  • Crash happens right after landing to AuthorizingPaymentActivity

Logs

 java.lang.RuntimeException: Exception while trying to handle coroutine exception
at
kotlinx.coroutines.CoroutineExceptionHandlerKt.handlerException(CoroutineExceptionHandler.kt:37)
at 
kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:28)
at 
kotlinx.coroutines.StandaloneCoroutine.handleJobException(Builders.common.kt:194)
at 
kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:231)
at 
kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:910)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:867) at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:832) 
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: APIError(location=https://www.omise.co/api-errors#not-found, code=not_found, message=Resource was not found)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:119)
at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createUsingDefault(StdValueInstantiator.java:261)
at com.fasterxml.jackson.databind.deser.std.ThrowableDeserializer.deserializeFromObject(ThrowableDeserializer.java:145)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1608)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1185)
at co.omise.android.models.Serializer.deserialize(SourceFile:2)
at co.omise.android.api.Invocation.processCall(SourceFile:11)
at co.omise.android.api.Invocation.invoke(SourceFile:17)
at co.omise.android.api.Client.send$lambda-0(SourceFile:1)
at co.omise.android.api.Client.$r8$lambda$x9l_k9O6Ac4psrYtKDz-ULIf5VU(Unknown Source:0)
at co.omise.android.api.Client$$ExternalSyntheticLambda1.run(Unknown Source:6)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [co.omise.android.ui.AuthorizingPaymentViewModel$special$$inlined$CoroutineExceptionHandler$1@800ebe7, StandaloneCoroutine{Cancelling}@bef0394, Dispatchers.IO]
Caused by: kotlin.UninitializedPropertyAccessException: lateinit property transaction has not been initialized
at co.omise.android.ThreeDS2ServiceWrapper.getTransaction(SourceFile:1)
at co.omise.android.ui.AuthorizingPaymentViewModel$special$$inlined$CoroutineExceptionHandler$1.handleException(SourceFile:2)
at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:24)
... 14 more

Screenshots

No response

Name and version information

Omise SDK 5.3.0

nqtsparda avatar Oct 24 '24 04:10 nqtsparda

Hello @nqtsparda , Thank you for reaching out , We are aware of this issue and a release is expected to be released soon . Please wait till the new release is out.

AnasNaouchi avatar Oct 24 '24 04:10 AnasNaouchi

@nqtsparda Version v5.4.0 has been released, please help us confirm that the issue has been fixed on your end. Thank you.

AnasNaouchi avatar Oct 24 '24 09:10 AnasNaouchi

v5.4.0 still has problem

juckrit avatar Oct 25 '24 03:10 juckrit

The crash seems from this https://github.com/omise/omise-android/blob/31f7a8dc57f7799913ab59f10a825ba178a20642/sdk/src/main/java/co/omise/android/ui/AuthorizingPaymentViewModel.kt#L74

lateinit prop threeDS2Service.transaction does not get initialized before using

nqtsparda avatar Oct 25 '24 04:10 nqtsparda

The crash seems from this

https://github.com/omise/omise-android/blob/31f7a8dc57f7799913ab59f10a825ba178a20642/sdk/src/main/java/co/omise/android/ui/AuthorizingPaymentViewModel.kt#L74

lateinit prop threeDS2Service.transaction does not get initialized before using

Yes we have already identified the cause, so may i ask if you have modified the auth_uri yourself or you received this uri from the charge response ?

AnasNaouchi avatar Oct 25 '24 04:10 AnasNaouchi

To make it easier to reproduce the crash so I made up above 404 authorize uri In our system real use case, we received that authorize uri from charge response

nqtsparda avatar Oct 25 '24 06:10 nqtsparda

There is no problem on Prod env. I already tried

juckrit avatar Oct 28 '24 08:10 juckrit

Hello @juckrit @nqtsparda , Thank you for your patience, We have identified the root cause and the potential solution but no specific timeline has been decided. We hope to release a fix soon. If you still have any concerns please let us know.

AnasNaouchi avatar Nov 01 '24 03:11 AnasNaouchi