@yuno-payments/yuno-sdk-react-native 1.0.17-rc.5 → 1.0.17-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -853,20 +853,28 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
853
853
  try {
854
854
  Log.d(TAG, "generateToken called with checkoutSession: $checkoutSession")
855
855
 
856
+ val activity = currentActivity
857
+ if (activity == null) {
858
+ promise.reject("ACTIVITY_UNAVAILABLE", "Current activity is null. Cannot generate token.")
859
+ return
860
+ }
861
+
856
862
  // Convert ReadableMap to TokenCollectedData using Gson
857
863
  val gson = Gson()
858
864
  val jsonString = convertReadableMapToJson(tokenCollectedData)
865
+ Log.d(TAG, "JSON String: $jsonString")
859
866
  val collectedData = gson.fromJson(jsonString, TokenCollectedData::class.java)
867
+ Log.d(TAG, "Parsed TokenCollectedData: checkoutSession=${collectedData.checkoutSession}, paymentMethod=${collectedData.paymentMethod}")
860
868
 
861
869
  // Create API client
862
870
  val apiClient = Yuno.apiClientPayment(
863
871
  checkoutSession = checkoutSession,
864
872
  countryCode = countryCode,
865
- context = reactContext
873
+ context = activity.applicationContext
866
874
  )
867
875
 
868
- // Generate token
869
- apiClient.generateToken(collectedData, reactContext)
876
+ // Generate token - pass activity for WebView context
877
+ apiClient.generateToken(collectedData, activity)
870
878
  .asFlow()
871
879
  .onEach { result ->
872
880
  try {
@@ -919,15 +927,21 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
919
927
  try {
920
928
  Log.d(TAG, "getThreeDSecureChallenge called with checkoutSession: $checkoutSession")
921
929
 
930
+ val activity = currentActivity
931
+ if (activity == null) {
932
+ promise.reject("ACTIVITY_UNAVAILABLE", "Current activity is null. Cannot get 3DS challenge.")
933
+ return
934
+ }
935
+
922
936
  // Create API client
923
937
  val apiClient = Yuno.apiClientPayment(
924
938
  checkoutSession = checkoutSession,
925
939
  countryCode = countryCode,
926
- context = reactContext
940
+ context = activity.applicationContext
927
941
  )
928
942
 
929
- // Get 3DS challenge
930
- apiClient.getThreeDSecureChallenge(reactContext, checkoutSession)
943
+ // Get 3DS challenge - pass activity for WebView context
944
+ apiClient.getThreeDSecureChallenge(activity, checkoutSession)
931
945
  .asFlow()
932
946
  .onEach { result ->
933
947
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuno-payments/yuno-sdk-react-native",
3
- "version": "1.0.17-rc.5",
3
+ "version": "1.0.17-rc.7",
4
4
  "description": "Yuno React Native SDK empowers you to create seamless payment experiences in your native Android and iOS apps built with React Native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",