Skip to content

Commit

Permalink
Merge pull request #1195 from Adyen/fix/shippingaddressparameters_ser…
Browse files Browse the repository at this point in the history
…ialization

Correctly serialize ShippingAddressParameters
  • Loading branch information
OscarSpruit authored May 2, 2023
2 parents dbbc213 + e51da09 commit 33e963f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ data class ShippingAddressParameters(
return try {
JSONObject().apply {
putOpt(ALLOWED_COUNTRY_CODES, serializeOptStringList(modelObject.allowedCountryCodes))
putOpt(ALLOWED_COUNTRY_CODES, modelObject.isPhoneNumberRequired)
putOpt(PHONE_NUMBER_REQUIRED, modelObject.isPhoneNumberRequired)
}
} catch (e: JSONException) {
throw ModelSerializationException(ShippingAddressParameters::class.java, e)
}
}

override fun deserialize(jsonObject: JSONObject) = ShippingAddressParameters(
allowedCountryCodes = parseOptStringList(jsonObject.optJSONArray(PHONE_NUMBER_REQUIRED)),
allowedCountryCodes = parseOptStringList(jsonObject.optJSONArray(ALLOWED_COUNTRY_CODES)),
isPhoneNumberRequired = jsonObject.optBoolean(PHONE_NUMBER_REQUIRED),
)
}
Expand Down

0 comments on commit 33e963f

Please sign in to comment.