Skip to content

Commit

Permalink
"Remove redundant code from different files"
Browse files Browse the repository at this point in the history
Several parts of the code have been removed from different files including Sample.AspNetCore/PaymentHelper.cs, PaymentOrderRequestBuilder.cs, PaymentOrderTests.cs, HttpClientExtensionsTests.cs, DictionaryLinkRelationTValueConverter.cs, Order.cs, and PaymentOrderCaptureRequest.cs. This refactoring aims to trim down the codebase to just the parts that are necessary and increase its maintainability.
  • Loading branch information
lounge committed Jan 18, 2024
1 parent 21e4158 commit 91a94e2
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 503 deletions.
2 changes: 0 additions & 2 deletions src/Samples/Sample.AspNetCore/Models/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ public class Order
public Uri PaymentLink { get; set; }

public Uri PaymentOrderLink { get; set; }

// public PaymentInstrument Instrument { get; set; }
}
109 changes: 0 additions & 109 deletions src/Samples/Sample.AspNetCore/PaymentHelper.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ public override bool CanConvert(Type typeToConvert)

public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)
{
Type keyType = typeToConvert.GetGenericArguments()[0];
Type valueType = typeToConvert.GetGenericArguments()[1];
var keyType = typeToConvert.GetGenericArguments()[0];
var valueType = typeToConvert.GetGenericArguments()[1];

JsonConverter converter = (JsonConverter)Activator.CreateInstance(
typeof(CustomPaymentOrderOperationsConverter).MakeGenericType(
new Type[] { keyType, valueType }),
var converter = (JsonConverter)Activator.CreateInstance(
typeof(CustomPaymentOrderOperationsConverter).MakeGenericType(keyType, valueType),
BindingFlags.Instance | BindingFlags.Public,
binder: null,
args: new object[] { options },
Expand Down
10 changes: 4 additions & 6 deletions src/SwedbankPay.Sdk.Tests/Json/LinkRelationTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Text.Json;

using SwedbankPay.Sdk.Infrastructure;
using SwedbankPay.Sdk.Infrastructure.JsonSerialization;
using SwedbankPay.Sdk.Infrastructure.PaymentOrder;
using SwedbankPay.Sdk.PaymentOrder;

namespace SwedbankPay.Sdk.Tests.Json;

Expand All @@ -14,14 +12,14 @@ public class LinkRelationTests
public void A()
{
var linkRelation = new LinkRelation("name", "value");
var serialize = JsonSerializer.Serialize(linkRelation);
JsonSerializer.Serialize(linkRelation);
}

[Fact]
public void B()
{
var httpOperation = new HttpOperation(new Uri("https://www.google.com", UriKind.RelativeOrAbsolute), new LinkRelation("name", "value"), "GET", "text/html");
var serialize = JsonSerializer.Serialize(httpOperation);
JsonSerializer.Serialize(httpOperation);
}

[Fact]
Expand All @@ -33,7 +31,7 @@ public void C()
httpOperation
};

var serialize = JsonSerializer.Serialize(operationList);
JsonSerializer.Serialize(operationList);
}

[Fact]
Expand All @@ -45,6 +43,6 @@ public void D()
httpOperation
};
var paymentOrderOperations = new PaymentOrderOperations(operationList, new HttpClient());
var serialize = JsonSerializer.Serialize(paymentOrderOperations, Infrastructure.JsonSerialization.JsonSerialization.Settings);
JsonSerializer.Serialize(paymentOrderOperations, Infrastructure.JsonSerialization.JsonSerialization.Settings);
}
}
Loading

0 comments on commit 91a94e2

Please sign in to comment.