Skip to content
Closed
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: de4578cd6e5125791bb32e1a25c9c5ac
openapi_spec_hash: f1c7476a335d68846b87af6f12bb88e2
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 @@ -19,6 +19,7 @@ public void FieldRoundtrip_Works()
{
Action = CardDisputes::Action.AcceptUserSubmission,
AcceptChargeback = new(),
AcceptUserPrearbitration = new(),
AcceptUserSubmission = new(),
DeclineUserPrearbitration = new(),
ReceiveMerchantPrearbitration = new(),
Expand All @@ -38,6 +39,7 @@ public void FieldRoundtrip_Works()
{
Action = CardDisputes::Action.AcceptUserSubmission,
AcceptChargeback = new(),
AcceptUserPrearbitration = new(),
AcceptUserSubmission = new(),
DeclineUserPrearbitration = new(),
ReceiveMerchantPrearbitration = new(),
Expand Down Expand Up @@ -116,6 +118,7 @@ public void CopyConstructor_Works()
{
Action = CardDisputes::Action.AcceptUserSubmission,
AcceptChargeback = new(),
AcceptUserPrearbitration = new(),
AcceptUserSubmission = new(),
DeclineUserPrearbitration = new(),
ReceiveMerchantPrearbitration = new(),
Expand Down Expand Up @@ -200,6 +203,7 @@ public void FieldRoundtrip_Works()
{
Action = CardDisputes::Action.AcceptChargeback,
AcceptChargeback = new(),
AcceptUserPrearbitration = new(),
AcceptUserSubmission = new(),
DeclineUserPrearbitration = new(),
ReceiveMerchantPrearbitration = new(),
Expand All @@ -215,6 +219,7 @@ public void FieldRoundtrip_Works()
ApiEnum<string, CardDisputes::Action> expectedAction =
CardDisputes::Action.AcceptChargeback;
CardDisputes::AcceptChargeback expectedAcceptChargeback = new();
CardDisputes::AcceptUserPrearbitration expectedAcceptUserPrearbitration = new();
CardDisputes::AcceptUserSubmission expectedAcceptUserSubmission = new();
CardDisputes::DeclineUserPrearbitration expectedDeclineUserPrearbitration = new();
CardDisputes::ReceiveMerchantPrearbitration expectedReceiveMerchantPrearbitration = new();
Expand All @@ -228,6 +233,7 @@ public void FieldRoundtrip_Works()

Assert.Equal(expectedAction, model.Action);
Assert.Equal(expectedAcceptChargeback, model.AcceptChargeback);
Assert.Equal(expectedAcceptUserPrearbitration, model.AcceptUserPrearbitration);
Assert.Equal(expectedAcceptUserSubmission, model.AcceptUserSubmission);
Assert.Equal(expectedDeclineUserPrearbitration, model.DeclineUserPrearbitration);
Assert.Equal(expectedReceiveMerchantPrearbitration, model.ReceiveMerchantPrearbitration);
Expand All @@ -247,6 +253,7 @@ public void SerializationRoundtrip_Works()
{
Action = CardDisputes::Action.AcceptChargeback,
AcceptChargeback = new(),
AcceptUserPrearbitration = new(),
AcceptUserSubmission = new(),
DeclineUserPrearbitration = new(),
ReceiveMerchantPrearbitration = new(),
Expand Down Expand Up @@ -275,6 +282,7 @@ public void FieldRoundtripThroughSerialization_Works()
{
Action = CardDisputes::Action.AcceptChargeback,
AcceptChargeback = new(),
AcceptUserPrearbitration = new(),
AcceptUserSubmission = new(),
DeclineUserPrearbitration = new(),
ReceiveMerchantPrearbitration = new(),
Expand All @@ -297,6 +305,7 @@ public void FieldRoundtripThroughSerialization_Works()
ApiEnum<string, CardDisputes::Action> expectedAction =
CardDisputes::Action.AcceptChargeback;
CardDisputes::AcceptChargeback expectedAcceptChargeback = new();
CardDisputes::AcceptUserPrearbitration expectedAcceptUserPrearbitration = new();
CardDisputes::AcceptUserSubmission expectedAcceptUserSubmission = new();
CardDisputes::DeclineUserPrearbitration expectedDeclineUserPrearbitration = new();
CardDisputes::ReceiveMerchantPrearbitration expectedReceiveMerchantPrearbitration = new();
Expand All @@ -310,6 +319,7 @@ public void FieldRoundtripThroughSerialization_Works()

Assert.Equal(expectedAction, deserialized.Action);
Assert.Equal(expectedAcceptChargeback, deserialized.AcceptChargeback);
Assert.Equal(expectedAcceptUserPrearbitration, deserialized.AcceptUserPrearbitration);
Assert.Equal(expectedAcceptUserSubmission, deserialized.AcceptUserSubmission);
Assert.Equal(expectedDeclineUserPrearbitration, deserialized.DeclineUserPrearbitration);
Assert.Equal(
Expand All @@ -335,6 +345,7 @@ public void Validation_Works()
{
Action = CardDisputes::Action.AcceptChargeback,
AcceptChargeback = new(),
AcceptUserPrearbitration = new(),
AcceptUserSubmission = new(),
DeclineUserPrearbitration = new(),
ReceiveMerchantPrearbitration = new(),
Expand All @@ -357,6 +368,8 @@ public void OptionalNonNullablePropertiesUnsetAreNotSet_Works()

Assert.Null(model.AcceptChargeback);
Assert.False(model.RawData.ContainsKey("accept_chargeback"));
Assert.Null(model.AcceptUserPrearbitration);
Assert.False(model.RawData.ContainsKey("accept_user_prearbitration"));
Assert.Null(model.AcceptUserSubmission);
Assert.False(model.RawData.ContainsKey("accept_user_submission"));
Assert.Null(model.DeclineUserPrearbitration);
Expand Down Expand Up @@ -396,6 +409,7 @@ public void OptionalNonNullablePropertiesSetToNullAreNotSet_Works()

// Null should be interpreted as omitted for these properties
AcceptChargeback = null,
AcceptUserPrearbitration = null,
AcceptUserSubmission = null,
DeclineUserPrearbitration = null,
ReceiveMerchantPrearbitration = null,
Expand All @@ -410,6 +424,8 @@ public void OptionalNonNullablePropertiesSetToNullAreNotSet_Works()

Assert.Null(model.AcceptChargeback);
Assert.False(model.RawData.ContainsKey("accept_chargeback"));
Assert.Null(model.AcceptUserPrearbitration);
Assert.False(model.RawData.ContainsKey("accept_user_prearbitration"));
Assert.Null(model.AcceptUserSubmission);
Assert.False(model.RawData.ContainsKey("accept_user_submission"));
Assert.Null(model.DeclineUserPrearbitration);
Expand Down Expand Up @@ -441,6 +457,7 @@ public void OptionalNonNullablePropertiesSetToNullValidation_Works()

// Null should be interpreted as omitted for these properties
AcceptChargeback = null,
AcceptUserPrearbitration = null,
AcceptUserSubmission = null,
DeclineUserPrearbitration = null,
ReceiveMerchantPrearbitration = null,
Expand All @@ -463,6 +480,7 @@ public void CopyConstructor_Works()
{
Action = CardDisputes::Action.AcceptChargeback,
AcceptChargeback = new(),
AcceptUserPrearbitration = new(),
AcceptUserSubmission = new(),
DeclineUserPrearbitration = new(),
ReceiveMerchantPrearbitration = new(),
Expand All @@ -485,6 +503,7 @@ public class ActionTest : TestBase
{
[Theory]
[InlineData(CardDisputes::Action.AcceptChargeback)]
[InlineData(CardDisputes::Action.AcceptUserPrearbitration)]
[InlineData(CardDisputes::Action.AcceptUserSubmission)]
[InlineData(CardDisputes::Action.DeclineUserPrearbitration)]
[InlineData(CardDisputes::Action.ReceiveMerchantPrearbitration)]
Expand Down Expand Up @@ -516,6 +535,7 @@ public void InvalidEnumValidationThrows_Works()

[Theory]
[InlineData(CardDisputes::Action.AcceptChargeback)]
[InlineData(CardDisputes::Action.AcceptUserPrearbitration)]
[InlineData(CardDisputes::Action.AcceptUserSubmission)]
[InlineData(CardDisputes::Action.DeclineUserPrearbitration)]
[InlineData(CardDisputes::Action.ReceiveMerchantPrearbitration)]
Expand Down Expand Up @@ -611,6 +631,60 @@ public void CopyConstructor_Works()
}
}

public class AcceptUserPrearbitrationTest : TestBase
{
[Fact]
public void FieldRoundtrip_Works()
{
var model = new CardDisputes::AcceptUserPrearbitration { };
}

[Fact]
public void SerializationRoundtrip_Works()
{
var model = new CardDisputes::AcceptUserPrearbitration { };

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

Assert.Equal(model, deserialized);
}

[Fact]
public void FieldRoundtripThroughSerialization_Works()
{
var model = new CardDisputes::AcceptUserPrearbitration { };

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

[Fact]
public void Validation_Works()
{
var model = new CardDisputes::AcceptUserPrearbitration { };

model.Validate();
}

[Fact]
public void CopyConstructor_Works()
{
var model = new CardDisputes::AcceptUserPrearbitration { };

CardDisputes::AcceptUserPrearbitration copied = new(model);

Assert.Equal(model, copied);
}
}

public class AcceptUserSubmissionTest : TestBase
{
[Fact]
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>
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,30 @@ public AcceptChargeback? AcceptChargeback
}
}

/// <summary>
/// The parameters for accepting the user prearbitration. Required if and only
/// if `action` is `accept_user_prearbitration`.
/// </summary>
public AcceptUserPrearbitration? AcceptUserPrearbitration
{
get
{
this._rawData.Freeze();
return this._rawData.GetNullableClass<AcceptUserPrearbitration>(
"accept_user_prearbitration"
);
}
init
{
if (value == null)
{
return;
}

this._rawData.Set("accept_user_prearbitration", value);
}
}

/// <summary>
/// The parameters for accepting the user submission. Required if and only if
/// `action` is `accept_user_submission`.
Expand Down Expand Up @@ -515,6 +539,7 @@ public override void Validate()
{
this.Action.Validate();
this.AcceptChargeback?.Validate();
this.AcceptUserPrearbitration?.Validate();
this.AcceptUserSubmission?.Validate();
this.DeclineUserPrearbitration?.Validate();
this.ReceiveMerchantPrearbitration?.Validate();
Expand Down Expand Up @@ -582,6 +607,12 @@ public enum Action
/// </summary>
AcceptChargeback,

/// <summary>
/// Simulate the merchant accepting the user's pre-arbitration. This will move
/// the dispute to a `won` state.
/// </summary>
AcceptUserPrearbitration,

/// <summary>
/// Accept the user's submission and transmit it to the network. This will move
/// the dispute to a `pending_response` state.
Expand All @@ -595,8 +626,8 @@ public enum Action
DeclineUserPrearbitration,

/// <summary>
/// Simulate the merchant issuing pre-arbitration. This will move the dispute
/// to a `user_submission_required` state.
/// Simulate the merchant issuing pre-arbitration. Only available for disputes
/// in the fraud or authorization category. This will move the dispute to a `user_submission_required` state.
/// </summary>
ReceiveMerchantPrearbitration,

Expand All @@ -607,8 +638,9 @@ public enum Action
Reject,

/// <summary>
/// Simulate the merchant re-presenting the dispute. This will move the dispute
/// to a `user_submission_required` state.
/// Simulate the merchant re-presenting the dispute. Only available for disputes
/// in a consumer or processing error category. This will move the dispute to
/// a `user_submission_required` state.
/// </summary>
Represent,

Expand Down Expand Up @@ -638,7 +670,7 @@ public enum Action

/// <summary>
/// Simulate the merchant timing out responding to a user pre-arbitration. This
/// will move the dispute to a `win` state.
/// will move the dispute to a `won` state.
/// </summary>
TimeOutUserPrearbitration,
}
Expand All @@ -661,6 +693,13 @@ JsonSerializerOptions options
.CardDisputes
.Action
.AcceptChargeback,
"accept_user_prearbitration" => global::Increase
.Api
.Models
.Simulations
.CardDisputes
.Action
.AcceptUserPrearbitration,
"accept_user_submission" => global::Increase
.Api
.Models
Expand Down Expand Up @@ -735,6 +774,13 @@ JsonSerializerOptions options
{
global::Increase.Api.Models.Simulations.CardDisputes.Action.AcceptChargeback =>
"accept_chargeback",
global::Increase
.Api
.Models
.Simulations
.CardDisputes
.Action
.AcceptUserPrearbitration => "accept_user_prearbitration",
global::Increase.Api.Models.Simulations.CardDisputes.Action.AcceptUserSubmission =>
"accept_user_submission",
global::Increase
Expand Down Expand Up @@ -835,6 +881,56 @@ public AcceptChargeback FromRawUnchecked(IReadOnlyDictionary<string, JsonElement
AcceptChargeback.FromRawUnchecked(rawData);
}

/// <summary>
/// The parameters for accepting the user prearbitration. Required if and only if
/// `action` is `accept_user_prearbitration`.
/// </summary>
[JsonConverter(
typeof(JsonModelConverter<AcceptUserPrearbitration, AcceptUserPrearbitrationFromRaw>)
)]
public sealed record class AcceptUserPrearbitration : JsonModel
{
/// <inheritdoc/>
public override void Validate() { }

public AcceptUserPrearbitration() { }

#pragma warning disable CS8618
[SetsRequiredMembers]
public AcceptUserPrearbitration(AcceptUserPrearbitration acceptUserPrearbitration)
: base(acceptUserPrearbitration) { }
#pragma warning restore CS8618

public AcceptUserPrearbitration(IReadOnlyDictionary<string, JsonElement> rawData)
{
this._rawData = new(rawData);
}

#pragma warning disable CS8618
[SetsRequiredMembers]
AcceptUserPrearbitration(FrozenDictionary<string, JsonElement> rawData)
{
this._rawData = new(rawData);
}
#pragma warning restore CS8618

/// <inheritdoc cref="AcceptUserPrearbitrationFromRaw.FromRawUnchecked"/>
public static AcceptUserPrearbitration FromRawUnchecked(
IReadOnlyDictionary<string, JsonElement> rawData
)
{
return new(FrozenDictionary.ToFrozenDictionary(rawData));
}
}

class AcceptUserPrearbitrationFromRaw : IFromRawJson<AcceptUserPrearbitration>
{
/// <inheritdoc/>
public AcceptUserPrearbitration FromRawUnchecked(
IReadOnlyDictionary<string, JsonElement> rawData
) => AcceptUserPrearbitration.FromRawUnchecked(rawData);
}

/// <summary>
/// The parameters for accepting the user submission. Required if and only if `action`
/// is `accept_user_submission`.
Expand Down
Loading