Skip to content

Commit 2ff5c17

Browse files
fix(internal): various smaller fixes
1 parent 6a36022 commit 2ff5c17

File tree

13 files changed

+240
-108
lines changed

13 files changed

+240
-108
lines changed

src/Orb.Tests/Services/Customers/Credits/Ledger/LedgerServiceTest.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Threading.Tasks;
4-
using Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties;
5-
using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties;
4+
using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties;
65

76
namespace Orb.Tests.Services.Customers.Credits.Ledger;
87

@@ -24,7 +23,7 @@ public async Task CreateEntry_Works()
2423
new()
2524
{
2625
CustomerID = "customer_id",
27-
Body = new Increment()
26+
Body = new BodyProperties::Increment()
2827
{
2928
Amount = 0,
3029
Currency = "currency",
@@ -55,25 +54,26 @@ public async Task CreateEntryByExternalID_Works()
5554
new()
5655
{
5756
ExternalCustomerID = "external_customer_id",
58-
Body = new BodyProperties::Increment()
59-
{
60-
Amount = 0,
61-
Currency = "currency",
62-
Description = "description",
63-
EffectiveDate = DateTime.Parse("2019-12-27T18:11:19.117Z"),
64-
ExpiryDate = DateTime.Parse("2019-12-27T18:11:19.117Z"),
65-
InvoiceSettings = new()
57+
Body =
58+
new global::Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.Increment()
6659
{
67-
AutoCollection = true,
68-
NetTerms = 0,
69-
CustomDueDate = DateOnly.Parse("2019-12-27"),
70-
InvoiceDate = DateOnly.Parse("2019-12-27"),
71-
Memo = "memo",
72-
RequireSuccessfulPayment = true,
60+
Amount = 0,
61+
Currency = "currency",
62+
Description = "description",
63+
EffectiveDate = DateTime.Parse("2019-12-27T18:11:19.117Z"),
64+
ExpiryDate = DateTime.Parse("2019-12-27T18:11:19.117Z"),
65+
InvoiceSettings = new()
66+
{
67+
AutoCollection = true,
68+
NetTerms = 0,
69+
CustomDueDate = DateOnly.Parse("2019-12-27"),
70+
InvoiceDate = DateOnly.Parse("2019-12-27"),
71+
Memo = "memo",
72+
RequireSuccessfulPayment = true,
73+
},
74+
Metadata = new Dictionary<string, string?>() { { "foo", "string" } },
75+
PerUnitCostBasis = "per_unit_cost_basis",
7376
},
74-
Metadata = new Dictionary<string, string?>() { { "foo", "string" } },
75-
PerUnitCostBasis = "per_unit_cost_basis",
76-
},
7777
}
7878
);
7979
response.Validate();

src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/Body.cs

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Diagnostics.CodeAnalysis;
44
using System.Text.Json;
55
using System.Text.Json.Serialization;
6-
using Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties;
6+
using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties;
77
using BodyVariants = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyVariants;
88

99
namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties;
@@ -13,42 +13,48 @@ public abstract record class Body
1313
{
1414
internal Body() { }
1515

16-
public static implicit operator Body(Increment value) => new BodyVariants::Increment(value);
16+
public static implicit operator Body(BodyProperties::Increment value) =>
17+
new BodyVariants::Increment(value);
1718

18-
public static implicit operator Body(Decrement value) => new BodyVariants::Decrement(value);
19+
public static implicit operator Body(BodyProperties::Decrement value) =>
20+
new BodyVariants::Decrement(value);
1921

20-
public static implicit operator Body(ExpirationChange value) =>
22+
public static implicit operator Body(BodyProperties::ExpirationChange value) =>
2123
new BodyVariants::ExpirationChange(value);
2224

23-
public static implicit operator Body(Void value) => new BodyVariants::Void(value);
25+
public static implicit operator Body(BodyProperties::Void value) =>
26+
new BodyVariants::Void(value);
2427

25-
public static implicit operator Body(Amendment value) => new BodyVariants::Amendment(value);
28+
public static implicit operator Body(BodyProperties::Amendment value) =>
29+
new BodyVariants::Amendment(value);
2630

27-
public bool TryPickIncrement([NotNullWhen(true)] out Increment? value)
31+
public bool TryPickIncrement([NotNullWhen(true)] out BodyProperties::Increment? value)
2832
{
2933
value = (this as BodyVariants::Increment)?.Value;
3034
return value != null;
3135
}
3236

33-
public bool TryPickDecrement([NotNullWhen(true)] out Decrement? value)
37+
public bool TryPickDecrement([NotNullWhen(true)] out BodyProperties::Decrement? value)
3438
{
3539
value = (this as BodyVariants::Decrement)?.Value;
3640
return value != null;
3741
}
3842

39-
public bool TryPickExpirationChange([NotNullWhen(true)] out ExpirationChange? value)
43+
public bool TryPickExpirationChange(
44+
[NotNullWhen(true)] out BodyProperties::ExpirationChange? value
45+
)
4046
{
4147
value = (this as BodyVariants::ExpirationChange)?.Value;
4248
return value != null;
4349
}
4450

45-
public bool TryPickVoid([NotNullWhen(true)] out Void? value)
51+
public bool TryPickVoid([NotNullWhen(true)] out BodyProperties::Void? value)
4652
{
4753
value = (this as BodyVariants::Void)?.Value;
4854
return value != null;
4955
}
5056

51-
public bool TryPickAmendment([NotNullWhen(true)] out Amendment? value)
57+
public bool TryPickAmendment([NotNullWhen(true)] out BodyProperties::Amendment? value)
5258
{
5359
value = (this as BodyVariants::Amendment)?.Value;
5460
return value != null;
@@ -133,7 +139,10 @@ JsonSerializerOptions options
133139

134140
try
135141
{
136-
var deserialized = JsonSerializer.Deserialize<Increment>(json, options);
142+
var deserialized = JsonSerializer.Deserialize<BodyProperties::Increment>(
143+
json,
144+
options
145+
);
137146
if (deserialized != null)
138147
{
139148
return new BodyVariants::Increment(deserialized);
@@ -152,7 +161,10 @@ JsonSerializerOptions options
152161

153162
try
154163
{
155-
var deserialized = JsonSerializer.Deserialize<Decrement>(json, options);
164+
var deserialized = JsonSerializer.Deserialize<BodyProperties::Decrement>(
165+
json,
166+
options
167+
);
156168
if (deserialized != null)
157169
{
158170
return new BodyVariants::Decrement(deserialized);
@@ -171,7 +183,10 @@ JsonSerializerOptions options
171183

172184
try
173185
{
174-
var deserialized = JsonSerializer.Deserialize<ExpirationChange>(json, options);
186+
var deserialized = JsonSerializer.Deserialize<BodyProperties::ExpirationChange>(
187+
json,
188+
options
189+
);
175190
if (deserialized != null)
176191
{
177192
return new BodyVariants::ExpirationChange(deserialized);
@@ -190,7 +205,10 @@ JsonSerializerOptions options
190205

191206
try
192207
{
193-
var deserialized = JsonSerializer.Deserialize<Void>(json, options);
208+
var deserialized = JsonSerializer.Deserialize<BodyProperties::Void>(
209+
json,
210+
options
211+
);
194212
if (deserialized != null)
195213
{
196214
return new BodyVariants::Void(deserialized);
@@ -209,7 +227,10 @@ JsonSerializerOptions options
209227

210228
try
211229
{
212-
var deserialized = JsonSerializer.Deserialize<Amendment>(json, options);
230+
var deserialized = JsonSerializer.Deserialize<BodyProperties::Amendment>(
231+
json,
232+
options
233+
);
213234
if (deserialized != null)
214235
{
215236
return new BodyVariants::Amendment(deserialized);

src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Amendment.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Diagnostics.CodeAnalysis;
43
using System.Text.Json;
54
using System.Text.Json.Serialization;
5+
using System = System;
66

77
namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties;
88

@@ -18,7 +18,10 @@ public required double Amount
1818
get
1919
{
2020
if (!this.Properties.TryGetValue("amount", out JsonElement element))
21-
throw new ArgumentOutOfRangeException("amount", "Missing required argument");
21+
throw new System::ArgumentOutOfRangeException(
22+
"amount",
23+
"Missing required argument"
24+
);
2225

2326
return JsonSerializer.Deserialize<double>(element, ModelBase.SerializerOptions);
2427
}
@@ -39,10 +42,13 @@ public required string BlockID
3942
get
4043
{
4144
if (!this.Properties.TryGetValue("block_id", out JsonElement element))
42-
throw new ArgumentOutOfRangeException("block_id", "Missing required argument");
45+
throw new System::ArgumentOutOfRangeException(
46+
"block_id",
47+
"Missing required argument"
48+
);
4349

4450
return JsonSerializer.Deserialize<string>(element, ModelBase.SerializerOptions)
45-
?? throw new ArgumentNullException("block_id");
51+
?? throw new System::ArgumentNullException("block_id");
4652
}
4753
set
4854
{
@@ -58,7 +64,10 @@ public JsonElement EntryType
5864
get
5965
{
6066
if (!this.Properties.TryGetValue("entry_type", out JsonElement element))
61-
throw new ArgumentOutOfRangeException("entry_type", "Missing required argument");
67+
throw new System::ArgumentOutOfRangeException(
68+
"entry_type",
69+
"Missing required argument"
70+
);
6271

6372
return JsonSerializer.Deserialize<JsonElement>(element, ModelBase.SerializerOptions);
6473
}

src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Decrement.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Diagnostics.CodeAnalysis;
43
using System.Text.Json;
54
using System.Text.Json.Serialization;
5+
using System = System;
66

77
namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties;
88

@@ -18,7 +18,10 @@ public required double Amount
1818
get
1919
{
2020
if (!this.Properties.TryGetValue("amount", out JsonElement element))
21-
throw new ArgumentOutOfRangeException("amount", "Missing required argument");
21+
throw new System::ArgumentOutOfRangeException(
22+
"amount",
23+
"Missing required argument"
24+
);
2225

2326
return JsonSerializer.Deserialize<double>(element, ModelBase.SerializerOptions);
2427
}
@@ -36,7 +39,10 @@ public JsonElement EntryType
3639
get
3740
{
3841
if (!this.Properties.TryGetValue("entry_type", out JsonElement element))
39-
throw new ArgumentOutOfRangeException("entry_type", "Missing required argument");
42+
throw new System::ArgumentOutOfRangeException(
43+
"entry_type",
44+
"Missing required argument"
45+
);
4046

4147
return JsonSerializer.Deserialize<JsonElement>(element, ModelBase.SerializerOptions);
4248
}

src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/ExpirationChange.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Diagnostics.CodeAnalysis;
43
using System.Text.Json;
54
using System.Text.Json.Serialization;
5+
using System = System;
66

77
namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties;
88

@@ -14,7 +14,10 @@ public JsonElement EntryType
1414
get
1515
{
1616
if (!this.Properties.TryGetValue("entry_type", out JsonElement element))
17-
throw new ArgumentOutOfRangeException("entry_type", "Missing required argument");
17+
throw new System::ArgumentOutOfRangeException(
18+
"entry_type",
19+
"Missing required argument"
20+
);
1821

1922
return JsonSerializer.Deserialize<JsonElement>(element, ModelBase.SerializerOptions);
2023
}
@@ -32,17 +35,20 @@ public JsonElement EntryType
3235
/// denoting when credits transferred (as part of a partial block expiration)
3336
/// should expire.
3437
/// </summary>
35-
public required DateOnly TargetExpiryDate
38+
public required System::DateOnly TargetExpiryDate
3639
{
3740
get
3841
{
3942
if (!this.Properties.TryGetValue("target_expiry_date", out JsonElement element))
40-
throw new ArgumentOutOfRangeException(
43+
throw new System::ArgumentOutOfRangeException(
4144
"target_expiry_date",
4245
"Missing required argument"
4346
);
4447

45-
return JsonSerializer.Deserialize<DateOnly>(element, ModelBase.SerializerOptions);
48+
return JsonSerializer.Deserialize<System::DateOnly>(
49+
element,
50+
ModelBase.SerializerOptions
51+
);
4652
}
4753
set
4854
{
@@ -145,14 +151,17 @@ public string? Description
145151
/// <summary>
146152
/// An ISO 8601 format date that identifies the origination credit block to expire
147153
/// </summary>
148-
public DateTime? ExpiryDate
154+
public System::DateTime? ExpiryDate
149155
{
150156
get
151157
{
152158
if (!this.Properties.TryGetValue("expiry_date", out JsonElement element))
153159
return null;
154160

155-
return JsonSerializer.Deserialize<DateTime?>(element, ModelBase.SerializerOptions);
161+
return JsonSerializer.Deserialize<System::DateTime?>(
162+
element,
163+
ModelBase.SerializerOptions
164+
);
156165
}
157166
set
158167
{
@@ -225,7 +234,7 @@ public static ExpirationChange FromRawUnchecked(Dictionary<string, JsonElement>
225234
}
226235

227236
[SetsRequiredMembers]
228-
public ExpirationChange(DateOnly targetExpiryDate)
237+
public ExpirationChange(System::DateOnly targetExpiryDate)
229238
: this()
230239
{
231240
this.TargetExpiryDate = targetExpiryDate;

0 commit comments

Comments
 (0)