2022-06-29 19:46:41 -04:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2021-12-14 15:05:07 +00:00
|
|
|
|
using Enums = Bit.Core.Enums;
|
2019-09-19 08:46:26 -04:00
|
|
|
|
|
2021-12-14 15:05:07 +00:00
|
|
|
|
namespace Bit.Api.Models.Request;
|
2022-08-29 16:06:55 -04:00
|
|
|
|
|
2021-12-14 15:05:07 +00:00
|
|
|
|
public class IapCheckRequestModel : IValidatableObject
|
2019-09-19 08:46:26 -04:00
|
|
|
|
{
|
|
|
|
|
|
[Required]
|
2020-03-27 14:36:37 -04:00
|
|
|
|
public Enums.PaymentMethodType? PaymentMethodType { get; set; }
|
2022-08-29 15:53:48 -04:00
|
|
|
|
|
2020-03-27 14:36:37 -04:00
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
2022-08-29 16:06:55 -04:00
|
|
|
|
{
|
2021-12-14 15:05:07 +00:00
|
|
|
|
if (PaymentMethodType != Enums.PaymentMethodType.AppleInApp)
|
2019-09-19 08:46:26 -04:00
|
|
|
|
{
|
|
|
|
|
|
yield return new ValidationResult("Not a supported in-app purchase payment method.",
|
|
|
|
|
|
new string[] { nameof(PaymentMethodType) });
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|