Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate payment type and serialise as string #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Riskified.SDK/Model/OrderElements/CreditCardPaymentDetails.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Riskified.SDK.Exceptions;
using Riskified.SDK.Model.OrderCheckoutElements;
using Riskified.SDK.Utils;
Expand All @@ -7,10 +8,6 @@ namespace Riskified.SDK.Model.OrderElements
{
public class CreditCardPaymentDetails : IPaymentDetails
{
public enum _type
{
credit_card, paypal
}

/// <summary>
/// The payment information for the order
Expand Down Expand Up @@ -96,7 +93,11 @@ public void Validate(Validations validationType = Validations.Weak)
public string Mid { get; set; }

[JsonProperty(PropertyName = "_type")]
public _type Type { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
public PaymentDetailsType Type
{
get { return PaymentDetailsType.credit_card; }
}

[JsonProperty(PropertyName = "authentication_result")]
public AuthenticationResult AuthenticationResult { get; set; }
Expand Down
7 changes: 7 additions & 0 deletions Riskified.SDK/Model/OrderElements/PaymentDetailsType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Riskified.SDK.Model.OrderElements
{
public enum PaymentDetailsType
{
credit_card, paypal
}
}
7 changes: 7 additions & 0 deletions Riskified.SDK/Model/OrderElements/PaypalPaymentDetails.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Riskified.SDK.Exceptions;
using Riskified.SDK.Model.OrderCheckoutElements;
using Riskified.SDK.Utils;
Expand Down Expand Up @@ -69,5 +70,11 @@ public void Validate(Validations validationType = Validations.Weak)
[JsonProperty(PropertyName = "authentication_result")]
public AuthenticationResult AuthenticationResult { get; set; }

[JsonProperty(PropertyName = "_type")]
[JsonConverter(typeof(StringEnumConverter))]
public PaymentDetailsType Type
{
get { return PaymentDetailsType.paypal; }
}
}
}
7 changes: 3 additions & 4 deletions Riskified.SDK/Riskified.SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<Compile Include="Model\OrderElements\IPaymentDetails.cs" />
<Compile Include="Model\OrderElements\NoChargeDetails.cs" />
<Compile Include="Model\OrderElements\Passenger.cs" />
<Compile Include="Model\OrderElements\PaymentDetailsType.cs" />
<Compile Include="Model\OrderElements\PaypalPaymentDetails.cs" />
<Compile Include="Model\OrderElements\ProductType.cs" />
<Compile Include="Model\OrderElements\Recipient.cs" />
Expand Down Expand Up @@ -143,9 +144,7 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Model\AccountActionElements\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand All @@ -154,4 +153,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>