Skip to content

Commit

Permalink
additionalData in response is not necessarily present, causes crash #…
Browse files Browse the repository at this point in the history
…10 - bugFix
  • Loading branch information
mkharibalaji committed Feb 18, 2020
1 parent 3baf108 commit be8467f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion android/src/main/java/com/rnlib/adyen/AdyenPaymentModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,11 @@ class AdyenPaymentModule(private var reactContext : ReactApplicationContext) : R
val rsCode : String = detailsResponse.getString("resultCode")
if(rsCode == "Authorised" || rsCode == "Received" || rsCode == "Pending"){
val message : JSONObject = JSONObject()
val addt_data_obj : JSONObject = if(detailsResponse.has("additionalData")) detailsResponse.getJSONObject("additionalData") else JSONObject()
message.put("resultCode", detailsResponse.getString("resultCode"))
message.put("merchantReference", detailsResponse.getString("merchantReference"))
message.put("pspReference", detailsResponse.getString("pspReference"))
message.put("additionalData", detailsResponse.getJSONObject("additionalData"))
message.put("additionalData", addt_data_obj)

sendSuccess(message)

Expand Down

0 comments on commit be8467f

Please sign in to comment.