[HttpPost]
public JsonResult DocumentList(DocumentQueryRequest request)
{
var result = PayProvider.DocumentService.DocumentList(request);
Regex regexCard = new Regex(@"\d{15,25}");
Regex regexMobile = new Regex(@"[1][3-8]\d{9}");
foreach (var r in result.DataList)
{
r.DocumentIdStr = r.DocumentId.ToString();
foreach (var d in r.Entries)
{
d.AccountDocumentEntryIdStr = d.AccountDocumentEntryId.ToString();
string EntryRemark = d.EntryRemark;
if (!string.IsNullOrWhiteSpace(EntryRemark))
{
if (regexMobile.IsMatch(EntryRemark))
{
MatchCollection matchMobile = regexMobile.Matches(EntryRemark);
foreach (Match m in matchMobile)
{
string _mobile = m.Groups[0].Value;
_mobile = _mobile.Substring(0, 3) + "****" + _mobile.Substring(7, 4);
EntryRemark = regexMobile.Replace(EntryRemark, _mobile);
}
}
if (regexCard.IsMatch(EntryRemark))
{
MatchCollection matchCard = regexCard.Matches(EntryRemark);
foreach (Match m in matchCard)
{
string _card = m.Groups[0].Value;
_card = _card.Substring(0, 5) + "****" + _card.Substring(_card.Length - 5, 5);
EntryRemark = regexCard.Replace(EntryRemark, _card);
}
}
d.EntryRemark = EntryRemark;
}
}
}
return Json(result);
}