Skip to content

Commit

Permalink
Authentication template message fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldwight committed Oct 4, 2023
1 parent 272a7e7 commit 834dee0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ public class AuthenticationMessageComponent
[JsonProperty("type")]
public string Type { get; set; }

/// <summary>
/// Only to be used for template creation do not set this property when sending auth template messages
/// </summary>
[JsonProperty("add_security_recommendation", NullValueHandling = NullValueHandling.Ignore)]
public bool AddSecurityRecommendation { get; set; }

/// <summary>
/// Only to be used for template creation do not set this property when sending auth template messages
/// </summary>
[JsonProperty("code_expiration_minutes", NullValueHandling = NullValueHandling.Ignore)]
public int CodeExpirationMinutes { get; set; }

Expand All @@ -52,6 +58,21 @@ public class AuthenticationMessageComponent

[JsonProperty("index", NullValueHandling = NullValueHandling.Ignore)]
public long? Index { get; set; }

[JsonIgnore]
public bool IsTemplateCreation { get; set; }

public bool ShouldSerializeCodeExpirationMinutes()
{
// Only to be used for template creation do not set this property when sending auth template messages
return CodeExpirationMinutes > 0;
}

public bool ShouldSerializeAddSecurityRecommendation()
{
// Only to be used for template creation do not set this property when sending auth template messages
return (IsTemplateCreation) ? AddSecurityRecommendation : false;
}
}

public class AuthenticationMessageParameter
Expand Down
2 changes: 1 addition & 1 deletion WhatsappBusiness.CloudApi/WhatsappBusiness.CloudApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<RepositoryUrl>https://github.com/gabrieldwight/Whatsapp-Business-Cloud-Api-Net</RepositoryUrl>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>1.0.21</Version>
<Version>1.0.22</Version>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'netstandard2.0'">
Expand Down

0 comments on commit 834dee0

Please sign in to comment.