Пример #1
0
        public async Task <CieloResponse> PostSaleTransactionAsync(CieloRequest request, CieloMerchantCredential credential)
        {
            return(await Task.Run(() =>
            {
                var response = new CieloResponse
                {
                    ProofOfSale = "123",
                    Tid = "123456",
                    AuthorizationCode = "123456",
                    PaymentId = Guid.NewGuid()
                };

                if (request.Payment.CreditCard.Holder.Equals("Cielo Error"))
                {
                    response.Status = CieloStatus.Aborted;
                    response.ReturnCode = "70";
                    response.ReturnMessage = "Problemas com o Cartão de Crédito";
                    return response;
                }

                response.Status = CieloStatus.PaymentConfirmed;
                response.ReturnCode = "4";
                response.ReturnMessage = "Operação realizada com sucesso";
                return response;
            }));
        }
Пример #2
0
 private void FillTransactionDtoWithResponseData(TransactionDto transactionDto, CieloResponse cieloResponse)
 {
     transactionDto.ProofOfSale            = cieloResponse.ProofOfSale;
     transactionDto.AcquirerTransactionKey = cieloResponse.Tid;
     transactionDto.AuthorizationCode      = cieloResponse.AuthorizationCode;
     transactionDto.AcquirerTransactionId  = cieloResponse.PaymentId;
     transactionDto.ReturnCode             = cieloResponse.ReturnCode;
     transactionDto.ReturnMessage          = cieloResponse.ReturnMessage;
     transactionDto.Status = MapCieloStatusToTransactionStatus(cieloResponse.Status);
 }