I need to serialize a result of this class (Assembly Adyen, Version=6.0.0.0):
<Runtime.Serialization.DataContractAttribute>
Public Class PaymentResponse
Implements IEquatable(Of PaymentResponse), IValidatableObject
Public Sub New(...)
...
<Runtime.Serialization.DataMemberAttribute(Name:="action", EmitDefaultValue:=False)>
Public Property Action As IPaymentResponseAction
...
End Class
Looking at the result, I have Action.PaymentData, Action.PaymentMethodType, Action.Token, Action.[Type] and Action.Url as expected: Screenshot of Autos
But when I serialize the result,
Dim tmp As String = Newtonsoft.Json.JsonConvert.SerializeObject(ret, GetType(PaymentResponse), New
Newtonsoft.Json.JsonSerializerSettings() With {.[Error] = AddressOf jsonerror})
I only get:
{
"resultCode": "IdentifyShopper",
"action": {
"paymentData": "XXX",
"paymentMethodType": "scheme",
"token": "YYY"
},
"authentication": {
"threeds2.fingerprintToken": "ZZZ"
},
"details": [
{
"key": "threeds2.fingerprint",
"type": "text"
}
],
"paymentData": "QQQ"
}
I'm not getting Action.[Type] and "Action.Url" in my Json string.
jsonerror()
is never hit.
EDIT: I added a tracewriter:
Dim tracewriter As Newtonsoft.Json.Serialization.ITraceWriter = New
Newtonsoft.Json.Serialization.MemoryTraceWriter
Dim tmp As String = Newtonsoft.Json.JsonConvert.SerializeObject(ret,
GetType(PaymentResponse), New
Newtonsoft.Json.JsonSerializerSettings() With
{.TraceWriter = tracewriter, .[Error] = AddressOf
jsonerror})
And everything looks fine, except I'm not getting the action.[type] serialized:
2021-01-19T14:25:11.852 Info Started serializing Adyen.Model.Checkout.PaymentResponse. Path ''. 2021-01-19T14:25:11.854 Info Started serializing Adyen.Model.Checkout.PaymentResponse+ResultCodeEnum with converter Newtonsoft.Json.Converters.StringEnumConverter. Path 'resultCode'. 2021-01-19T14:25:11.854 Info Finished serializing Adyen.Model.Checkout.PaymentResponse+ResultCodeEnum with converter Newtonsoft.Json.Converters.StringEnumConverter. Path 'resultCode'. 2021-01-19T14:25:11.856 Info Started serializing Adyen.Model.Checkout.Action.CheckoutThreeDS2FingerPrintAction. Path 'action'. 2021-01-19T14:25:11.857 Info Finished serializing Adyen.Model.Checkout.Action.CheckoutThreeDS2FingerPrintAction. Path 'action'. 2021-01-19T14:25:11.857 Info Started serializing System.Collections.Generic.Dictionary
2[System.String,System.String]. Path 'authentication'. 2021-01-19T14:25:11.857 Info Finished serializing System.Collections.Generic.Dictionary
2[System.String,System.String]. Path 'authentication'. 2021-01-19T14:25:11.857 Info Started serializing System.Collections.Generic.List1[Adyen.Model.Checkout.InputDetail]. Path 'details'. 2021-01-19T14:25:11.857 Info Started serializing Adyen.Model.Checkout.InputDetail. Path 'details'. 2021-01-19T14:25:11.857 Info Finished serializing Adyen.Model.Checkout.InputDetail. Path 'details[0]'. 2021-01-19T14:25:11.857 Info Finished serializing System.Collections.Generic.List
1[Adyen.Model.Checkout.InputDetail]. Path 'details'. 2021-01-19T14:25:11.860 Info Finished serializing Adyen.Model.Checkout.PaymentResponse. Path ''. 2021-01-19T14:25:11.860 Verbose Serialized JSON: { "resultCode": "IdentifyShopper",
"action": { "paymentData": "XXX", "paymentMethodType": "scheme", "token": "YYY" }, "authentication": { "threeds2.fingerprintToken": "ZZZ" }, "details": [ { "key": "threeds2.fingerprint", "type": "text" } ], "paymentData": "QQQ" }
This is a bug in the Adyen .NET library. The implementation classes for IPaymentResponseAction
is missing DataMember
annotations. There is a fix ready to be merged and will be available in the next patch release soon. I suggest you update to the patch version when released.
For the URL field, it will be available only for certain actions like redirect, like for ideal payment method. FOr scheme, as in your case, URL is not applicable.