Skip to content

Commit

Permalink
Add PolySharp so we can use required and init keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed Mar 23, 2024
1 parent b510e5b commit d20e223
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Mollie.Api/Models/Customer/CustomerRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ public class CustomerRequest {
/// Allows you to preset the language to be used in the payment screens shown to the consumer. When this parameter is not
/// provided, the browser language will be used instead in the payment flow (which is usually more accurate).
/// </summary>
public string Locale { get; set; }
public string? Locale { get; set; }

/// <summary>
/// Optional - Provide any data you like in JSON notation, and we will save the data alongside the customer. Whenever
/// you fetch the customer with our API, we'll also include the metadata. You can use up to 1kB of JSON.
/// </summary>
[JsonConverter(typeof(RawJsonConverter))]
public string Metadata { get; set; }
public string? Metadata { get; set; }

/// <summary>
/// Oauth only - Optional – Set this to true to make this customer a test customer.
/// </summary>
public bool? Testmode { get; set; }

public void SetMetadata(object metadataObj, JsonSerializerSettings jsonSerializerSettings = null) {
public void SetMetadata(object metadataObj, JsonSerializerSettings? jsonSerializerSettings = null) {
this.Metadata = JsonConvert.SerializeObject(metadataObj, jsonSerializerSettings);
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Mollie.Api/Mollie.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
</ItemGroup>

Expand Down
8 changes: 4 additions & 4 deletions src/Mollie.Api/Options/MollieOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ public record MollieOptions {
/// <summary>
/// Your API-key or OAuth token
/// </summary>
public string ApiKey { get; set; } = null!;
public string ApiKey { get; set; } = string.Empty;

/// <summary>
/// (Optional) ClientId used by Connect API
/// </summary>
public string ClientId { get; set; }
public string ClientId { get; set; } = string.Empty;

/// <summary>
/// (Optional) ClientSecret used by Connect API
/// </summary>
/// <returns></returns>
public string ClientSecret { get; set; }
public string ClientSecret { get; set; } = string.Empty;

/// <summary>
/// (Optional) Polly retry policy for failed requests
/// </summary>
public IAsyncPolicy<HttpResponseMessage> RetryPolicy { get; set; }
public IAsyncPolicy<HttpResponseMessage>? RetryPolicy { get; set; }
}
}

0 comments on commit d20e223

Please sign in to comment.