Ejemplo n.º 1
0
        public async Task <IActionResult> Create(TokenViewModel tokenModel)
        {
            var service = await _serviceRepository.Get(tokenModel.ServiceId);

            var serviceMerchant = await _merchantRepository.Get(tokenModel.MerchantId);

            var paymentInstrument = await _paymentInstrumentRepository.Select(tokenModel.PaymentInstrumentId);

            if (service != null && serviceMerchant != null && paymentInstrument != null)
            {
                Token token = new Token()
                {
                    ServiceId           = service.Id,
                    MerchantId          = serviceMerchant.Id,
                    VProvisionedTokenID = tokenModel.VProvisionedTokenID,
                    TokenStatus         = tokenModel.TokenStatus,
                    TokenRequestorID    = tokenModel.TokenRequestorID,
                    TokenReferenceID    = tokenModel.TokenReferenceID,
                    Last4               = tokenModel.Last4,
                    ExpirationMonth     = tokenModel.ExpirationMonth,
                    ExpirationYear      = tokenModel.ExpirationYear,
                    AppPrgrmID          = tokenModel.AppPrgrmID,
                    TokenAccountNumber  = tokenModel.TokenAccountNumber,
                    PaymentInstrumentId = paymentInstrument.Id,
                    Status              = tokenModel.Status,
                    Created             = DateTime.UtcNow,
                    Updated             = null
                };

                await _tokenRepository.Insert(token);
            }

            return(RedirectToAction("List"));
        }
Ejemplo n.º 2
0
 public async Task <JsonResult> GetList()
 {
     return(Json(new { data = await _paymentInstrumentRepository.Select() }));
 }