Skip to content

Commit

Permalink
Merge pull request #1485 from wordpress-mobile/fix/nullable-gateway-p…
Browse files Browse the repository at this point in the history
…arams

Add defences for bad APIs
  • Loading branch information
nbradbury authored Jan 23, 2020
2 parents 370e6d8 + 73fb317 commit 41c392f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ val GATEWAYS_RESPONSE = listOf(
"cod",
"Cash on Delivery",
"Pay cash",
0,
"",
false,
"COD: Method title",
"COD: Method description",
Expand All @@ -17,7 +17,7 @@ val GATEWAYS_RESPONSE = listOf(
"stripe",
"Credit card",
"Pay with CC",
1,
"1",
true,
"Stripe: Method title",
"Stripe: Method description",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class GatewayMapper
response.gatewayId,
response.title ?: "",
response.description ?: "",
response.order,
response.enabled,
response.order?.toIntOrNull() ?: 0,
response.enabled ?: false,
response.methodTitle ?: "",
response.methodDescription ?: "",
response.features
response.features ?: emptyList()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ constructor(
@SerializedName("id") val gatewayId: String,
@SerializedName("title") val title: String?,
@SerializedName("description") val description: String?,
@SerializedName("order") val order: Int,
@SerializedName("enabled") val enabled: Boolean,
@SerializedName("order") val order: String?,
@SerializedName("enabled") val enabled: Boolean?,
@SerializedName("method_title") val methodTitle: String?,
@SerializedName("method_description") val methodDescription: String?,
@SerializedName("method_supports") val features: List<String>
@SerializedName("method_supports") val features: List<String>?
)
}

0 comments on commit 41c392f

Please sign in to comment.