Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
configured_endpoints: 255
openapi_spec_hash: 6076b04cad61f32c031d7cd65d3cae66
openapi_spec_hash: 4458c613643910026be17923a699563f
config_hash: de151ebd21a0bd391662389b310a8f49
2 changes: 1 addition & 1 deletion scripts/mock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public class ReasonTest : TestBase
[InlineData(DigitalWalletTokenRequests::Reason.GroupLocked)]
[InlineData(DigitalWalletTokenRequests::Reason.AccountClosed)]
[InlineData(DigitalWalletTokenRequests::Reason.EntityNotActive)]
[InlineData(DigitalWalletTokenRequests::Reason.CardExpirationMismatch)]
public void Validation_Works(DigitalWalletTokenRequests::Reason rawValue)
{
// force implicit conversion because Theory can't do that for us
Expand Down Expand Up @@ -342,6 +343,7 @@ public void InvalidEnumValidationThrows_Works()
[InlineData(DigitalWalletTokenRequests::Reason.GroupLocked)]
[InlineData(DigitalWalletTokenRequests::Reason.AccountClosed)]
[InlineData(DigitalWalletTokenRequests::Reason.EntityNotActive)]
[InlineData(DigitalWalletTokenRequests::Reason.CardExpirationMismatch)]
public void SerializationRoundtrip_Works(DigitalWalletTokenRequests::Reason rawValue)
{
// force implicit conversion because Theory can't do that for us
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public void FieldRoundtrip_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -58,7 +57,6 @@ public void FieldRoundtrip_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -106,7 +104,6 @@ public void SerializationRoundtrip_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -157,7 +154,6 @@ public void FieldRoundtripThroughSerialization_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -201,7 +197,6 @@ public void FieldRoundtripThroughSerialization_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -249,7 +244,6 @@ public void Validation_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -293,7 +287,6 @@ public void CopyConstructor_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public void FieldRoundtrip_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -48,9 +47,6 @@ public void FieldRoundtrip_Works()
string expectedCardID = "card_oubs0hwk5rn6knuecxg2";
DigitalWalletTokens::Cardholder expectedCardholder = new("John Smith");
DateTimeOffset expectedCreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z");
DigitalWalletTokens::Decline expectedDecline = new(
DigitalWalletTokens::Reason.CardNotActive
);
DigitalWalletTokens::Device expectedDevice = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -85,7 +81,6 @@ public void FieldRoundtrip_Works()
Assert.Equal(expectedCardID, model.CardID);
Assert.Equal(expectedCardholder, model.Cardholder);
Assert.Equal(expectedCreatedAt, model.CreatedAt);
Assert.Equal(expectedDecline, model.Decline);
Assert.Equal(expectedDevice, model.Device);
Assert.Equal(expectedDynamicPrimaryAccountNumber, model.DynamicPrimaryAccountNumber);
Assert.Equal(
Expand Down Expand Up @@ -113,7 +108,6 @@ public void SerializationRoundtrip_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -156,7 +150,6 @@ public void FieldRoundtripThroughSerialization_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -192,9 +185,6 @@ public void FieldRoundtripThroughSerialization_Works()
string expectedCardID = "card_oubs0hwk5rn6knuecxg2";
DigitalWalletTokens::Cardholder expectedCardholder = new("John Smith");
DateTimeOffset expectedCreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z");
DigitalWalletTokens::Decline expectedDecline = new(
DigitalWalletTokens::Reason.CardNotActive
);
DigitalWalletTokens::Device expectedDevice = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -229,7 +219,6 @@ public void FieldRoundtripThroughSerialization_Works()
Assert.Equal(expectedCardID, deserialized.CardID);
Assert.Equal(expectedCardholder, deserialized.Cardholder);
Assert.Equal(expectedCreatedAt, deserialized.CreatedAt);
Assert.Equal(expectedDecline, deserialized.Decline);
Assert.Equal(expectedDevice, deserialized.Device);
Assert.Equal(expectedDynamicPrimaryAccountNumber, deserialized.DynamicPrimaryAccountNumber);
Assert.Equal(
Expand Down Expand Up @@ -257,7 +246,6 @@ public void Validation_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -294,7 +282,6 @@ public void CopyConstructor_Works()
CardID = "card_oubs0hwk5rn6knuecxg2",
Cardholder = new("John Smith"),
CreatedAt = DateTimeOffset.Parse("2020-01-31T23:59:59Z"),
Decline = new(DigitalWalletTokens::Reason.CardNotActive),
Device = new()
{
DeviceType = DigitalWalletTokens::DeviceType.MobilePhone,
Expand Down Expand Up @@ -386,157 +373,6 @@ public void CopyConstructor_Works()
}
}

public class DeclineTest : TestBase
{
[Fact]
public void FieldRoundtrip_Works()
{
var model = new DigitalWalletTokens::Decline
{
Reason = DigitalWalletTokens::Reason.CardNotActive,
};

ApiEnum<string, DigitalWalletTokens::Reason> expectedReason =
DigitalWalletTokens::Reason.CardNotActive;

Assert.Equal(expectedReason, model.Reason);
}

[Fact]
public void SerializationRoundtrip_Works()
{
var model = new DigitalWalletTokens::Decline
{
Reason = DigitalWalletTokens::Reason.CardNotActive,
};

string json = JsonSerializer.Serialize(model, ModelBase.SerializerOptions);
var deserialized = JsonSerializer.Deserialize<DigitalWalletTokens::Decline>(
json,
ModelBase.SerializerOptions
);

Assert.Equal(model, deserialized);
}

[Fact]
public void FieldRoundtripThroughSerialization_Works()
{
var model = new DigitalWalletTokens::Decline
{
Reason = DigitalWalletTokens::Reason.CardNotActive,
};

string element = JsonSerializer.Serialize(model, ModelBase.SerializerOptions);
var deserialized = JsonSerializer.Deserialize<DigitalWalletTokens::Decline>(
element,
ModelBase.SerializerOptions
);
Assert.NotNull(deserialized);

ApiEnum<string, DigitalWalletTokens::Reason> expectedReason =
DigitalWalletTokens::Reason.CardNotActive;

Assert.Equal(expectedReason, deserialized.Reason);
}

[Fact]
public void Validation_Works()
{
var model = new DigitalWalletTokens::Decline
{
Reason = DigitalWalletTokens::Reason.CardNotActive,
};

model.Validate();
}

[Fact]
public void CopyConstructor_Works()
{
var model = new DigitalWalletTokens::Decline
{
Reason = DigitalWalletTokens::Reason.CardNotActive,
};

DigitalWalletTokens::Decline copied = new(model);

Assert.Equal(model, copied);
}
}

public class ReasonTest : TestBase
{
[Theory]
[InlineData(DigitalWalletTokens::Reason.CardNotActive)]
[InlineData(DigitalWalletTokens::Reason.NoVerificationMethod)]
[InlineData(DigitalWalletTokens::Reason.WebhookTimedOut)]
[InlineData(DigitalWalletTokens::Reason.WebhookDeclined)]
[InlineData(DigitalWalletTokens::Reason.IncorrectCardVerificationCode)]
[InlineData(DigitalWalletTokens::Reason.DeclinedByTokenRequestor)]
[InlineData(DigitalWalletTokens::Reason.GroupLocked)]
[InlineData(DigitalWalletTokens::Reason.AccountClosed)]
[InlineData(DigitalWalletTokens::Reason.EntityNotActive)]
public void Validation_Works(DigitalWalletTokens::Reason rawValue)
{
// force implicit conversion because Theory can't do that for us
ApiEnum<string, DigitalWalletTokens::Reason> value = rawValue;
value.Validate();
}

[Fact]
public void InvalidEnumValidationThrows_Works()
{
var value = JsonSerializer.Deserialize<ApiEnum<string, DigitalWalletTokens::Reason>>(
JsonSerializer.SerializeToElement("invalid value"),
ModelBase.SerializerOptions
);

Assert.NotNull(value);
Assert.Throws<IncreaseInvalidDataException>(() => value.Validate());
}

[Theory]
[InlineData(DigitalWalletTokens::Reason.CardNotActive)]
[InlineData(DigitalWalletTokens::Reason.NoVerificationMethod)]
[InlineData(DigitalWalletTokens::Reason.WebhookTimedOut)]
[InlineData(DigitalWalletTokens::Reason.WebhookDeclined)]
[InlineData(DigitalWalletTokens::Reason.IncorrectCardVerificationCode)]
[InlineData(DigitalWalletTokens::Reason.DeclinedByTokenRequestor)]
[InlineData(DigitalWalletTokens::Reason.GroupLocked)]
[InlineData(DigitalWalletTokens::Reason.AccountClosed)]
[InlineData(DigitalWalletTokens::Reason.EntityNotActive)]
public void SerializationRoundtrip_Works(DigitalWalletTokens::Reason rawValue)
{
// force implicit conversion because Theory can't do that for us
ApiEnum<string, DigitalWalletTokens::Reason> value = rawValue;

string json = JsonSerializer.Serialize(value, ModelBase.SerializerOptions);
var deserialized = JsonSerializer.Deserialize<ApiEnum<string, DigitalWalletTokens::Reason>>(
json,
ModelBase.SerializerOptions
);

Assert.Equal(value, deserialized);
}

[Fact]
public void InvalidEnumSerializationRoundtrip_Works()
{
var value = JsonSerializer.Deserialize<ApiEnum<string, DigitalWalletTokens::Reason>>(
JsonSerializer.SerializeToElement("invalid value"),
ModelBase.SerializerOptions
);
string json = JsonSerializer.Serialize(value, ModelBase.SerializerOptions);
var deserialized = JsonSerializer.Deserialize<ApiEnum<string, DigitalWalletTokens::Reason>>(
json,
ModelBase.SerializerOptions
);

Assert.Equal(value, deserialized);
}
}

public class DeviceTest : TestBase
{
[Fact]
Expand Down Expand Up @@ -808,7 +644,6 @@ public class DigitalWalletTokenStatusTest : TestBase
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.Inactive)]
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.Suspended)]
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.Deactivated)]
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.Declined)]
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.PendingTransitioning)]
public void Validation_Works(DigitalWalletTokens::DigitalWalletTokenStatus rawValue)
{
Expand All @@ -833,7 +668,6 @@ public void InvalidEnumValidationThrows_Works()
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.Inactive)]
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.Suspended)]
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.Deactivated)]
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.Declined)]
[InlineData(DigitalWalletTokens::DigitalWalletTokenStatus.PendingTransitioning)]
public void SerializationRoundtrip_Works(DigitalWalletTokens::DigitalWalletTokenStatus rawValue)
{
Expand Down Expand Up @@ -1074,7 +908,6 @@ public class UpdateStatusTest : TestBase
[InlineData(DigitalWalletTokens::UpdateStatus.Inactive)]
[InlineData(DigitalWalletTokens::UpdateStatus.Suspended)]
[InlineData(DigitalWalletTokens::UpdateStatus.Deactivated)]
[InlineData(DigitalWalletTokens::UpdateStatus.Declined)]
[InlineData(DigitalWalletTokens::UpdateStatus.PendingTransitioning)]
public void Validation_Works(DigitalWalletTokens::UpdateStatus rawValue)
{
Expand All @@ -1100,7 +933,6 @@ public void InvalidEnumValidationThrows_Works()
[InlineData(DigitalWalletTokens::UpdateStatus.Inactive)]
[InlineData(DigitalWalletTokens::UpdateStatus.Suspended)]
[InlineData(DigitalWalletTokens::UpdateStatus.Deactivated)]
[InlineData(DigitalWalletTokens::UpdateStatus.Declined)]
[InlineData(DigitalWalletTokens::UpdateStatus.PendingTransitioning)]
public void SerializationRoundtrip_Works(DigitalWalletTokens::UpdateStatus rawValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public class DeclineReasonTest : TestBase
[InlineData(DeclineReason.GroupLocked)]
[InlineData(DeclineReason.AccountClosed)]
[InlineData(DeclineReason.EntityNotActive)]
[InlineData(DeclineReason.CardExpirationMismatch)]
public void Validation_Works(DeclineReason rawValue)
{
// force implicit conversion because Theory can't do that for us
Expand Down Expand Up @@ -139,6 +140,7 @@ public void InvalidEnumValidationThrows_Works()
[InlineData(DeclineReason.GroupLocked)]
[InlineData(DeclineReason.AccountClosed)]
[InlineData(DeclineReason.EntityNotActive)]
[InlineData(DeclineReason.CardExpirationMismatch)]
public void SerializationRoundtrip_Works(DeclineReason rawValue)
{
// force implicit conversion because Theory can't do that for us
Expand Down
1 change: 0 additions & 1 deletion src/Increase.Api/Core/ModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,6 @@ protected ModelBase(ModelBase modelBase)
new ApiEnumConverter<string, PhysicalCardProfiles::PhysicalCardProfileStatus>(),
new ApiEnumConverter<string, PhysicalCardProfiles::Type>(),
new ApiEnumConverter<string, PhysicalCardProfiles::In>(),
new ApiEnumConverter<string, DigitalWalletTokens::Reason>(),
new ApiEnumConverter<string, DigitalWalletTokens::DeviceType>(),
new ApiEnumConverter<string, DigitalWalletTokens::DigitalWalletTokenStatus>(),
new ApiEnumConverter<string, DigitalWalletTokens::TokenRequestor>(),
Expand Down
10 changes: 5 additions & 5 deletions src/Increase.Api/Increase.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="Increase.Api.Tests"/>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
<PackageReference Include="System.Text.Json" Version="9.0.9"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<InternalsVisibleTo Include="Increase.Api.Tests" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<PackageReference Include="System.Text.Json" Version="9.0.9" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Collections.Immutable" Version="8.0.0"/>
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
</ItemGroup>
</Project>
Loading
Loading