1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

iap pre-purchase check

This commit is contained in:
Kyle Spearrin
2019-09-19 08:46:26 -04:00
parent 9ddfe3e947
commit e9174ba9f4
4 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Bit.Core.Enums;
namespace Bit.Core.Models.Api
{
public class IapCheckRequestModel : IValidatableObject
{
[Required]
public PaymentMethodType? PaymentMethodType { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if(PaymentMethodType != Enums.PaymentMethodType.AppleInApp)
{
yield return new ValidationResult("Not a supported in-app purchase payment method.",
new string[] { nameof(PaymentMethodType) });
}
}
}
}

View File

@ -15,6 +15,8 @@ namespace Bit.Core.Models.Business
public class BillingSource
{
public BillingSource() { }
public BillingSource(PaymentMethod method)
{
if(method.Card != null)