recurly/recurly-client-dotnet

Error parsing error response from CreateSubscriptionChangeAsync

glennsdavis opened this issue · 1 comments

Describe the bug

Call CreateSubscriptionChangeAsync with a discount code for a free trial.

Recurly service responses with status 422 - Unprocessable Entity
{
"error": {
"type": "validation",
"message": "Coupon code ["Subscription uuid Free trials only redeemable on new subscriptions"]",
"params": [
{
"param": "coupon_code",
"message": [ "Subscription uuid Free trials only redeemable on new subscriptions" ]
}
]
}
}

SDK throws the following exception parsing the JSON response:

Unexpected character encountered while parsing value: [. Path 'error.params[0].message', line 1, position 171.

Recurly.dll!Recurly.JsonSerializer.Deserialize(RestSharp.IRestResponse response) Line 43
Recurly.dll!Recurly.BaseClient.HandleResponse(RestSharp.IRestResponse resp) Line 231
Recurly.dll!Recurly.BaseClient.MakeRequestAsync.AnonymousMethod__0(System.Threading.Tasks.Task<RestSharp.IRestResponse> t) Line 75

To Reproduce

Expected behavior

SDK is able to parse error response from Recurly service and return response from service to client of SDK.

Your Environment

  • Which version of this library are you using?

Recurly 4.21.4

  • Which version of the language are you using?

C# .NET 6.0

Can confirm this is a bug that is impacting our implementation of the dotnet SDK