47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Bit.Core.Models.Data;
|
|
using Bit.Core.Models.View;
|
|
|
|
namespace Bit.Core.Models.Domain
|
|
{
|
|
public class Card : Domain
|
|
{
|
|
private HashSet<string> _map = new HashSet<string>
|
|
{
|
|
"CardholderName",
|
|
"Brand",
|
|
"Number",
|
|
"ExpMonth",
|
|
"ExpYear",
|
|
"Code"
|
|
};
|
|
|
|
public Card() { }
|
|
|
|
public Card(CardData obj, bool alreadyEncrypted = false)
|
|
{
|
|
BuildDomainModel(this, obj, _map, alreadyEncrypted);
|
|
}
|
|
|
|
public EncString CardholderName { get; set; }
|
|
public EncString Brand { get; set; }
|
|
public EncString Number { get; set; }
|
|
public EncString ExpMonth { get; set; }
|
|
public EncString ExpYear { get; set; }
|
|
public EncString Code { get; set; }
|
|
|
|
public Task<CardView> DecryptAsync(string orgId, SymmetricCryptoKey key = null)
|
|
{
|
|
return DecryptObjAsync(new CardView(this), this, _map, orgId, key);
|
|
}
|
|
|
|
public CardData ToCardData()
|
|
{
|
|
var c = new CardData();
|
|
BuildDataModel(this, c, _map);
|
|
return c;
|
|
}
|
|
}
|
|
}
|