示例#1
0
 public NotificationTransactionDto(IDictionary <string, string> getDataFromRequest)
 {
     if (getDataFromRequest.ContainsKey("trx_id"))
     {
         TransactionId = Convert.ToUInt64(getDataFromRequest["trx_id"]);
     }
     if (getDataFromRequest.ContainsKey("token"))
     {
         Token = getDataFromRequest["token"];
     }
     if (getDataFromRequest.ContainsKey("monto"))
     {
         Currency = new CurrencyDto(getDataFromRequest["monto"]);
     }
     if (getDataFromRequest.ContainsKey("medio_pago"))
     {
         PaymentMethod = getDataFromRequest["medio_pago"] == "999"
                             ? null
                             : (PaymentMethod?)
                         Enum.Parse(typeof(PaymentMethod),
                                    int.Parse(getDataFromRequest["medio_pago"]).ToString(
                                        CultureInfo.InvariantCulture));
     }
     if (getDataFromRequest.ContainsKey("fecha_aprobacion"))
     {
         DateTimeAcceptance = DateTime.Parse(getDataFromRequest["fecha_aprobacion"]);
     }
     if (getDataFromRequest.ContainsKey("CardNumber"))
     {
         CardNumber = getDataFromRequest["CardNumber"];
     }
     if (getDataFromRequest.ContainsKey("num_cuotas"))
     {
         InstalmentNumber = getDataFromRequest["num_cuotas"];
     }
     if (getDataFromRequest.ContainsKey("tipo_cuotas"))
     {
         InstalmentType = getDataFromRequest["tipo_cuotas"];
     }
     if (getDataFromRequest.ContainsKey("valor_cuota"))
     {
         InstalmentAmount = new CurrencyDto(getDataFromRequest["valor_cuota"]);
     }
     if (getDataFromRequest.ContainsKey("primer_vencimiento"))
     {
         FirtsExpiration = DateTime.Parse(getDataFromRequest["primer_vencimiento"]);
     }
     if (getDataFromRequest.ContainsKey("numero_operacion"))
     {
         OperationNumber = getDataFromRequest["numero_operacion"];
     }
     if (getDataFromRequest.ContainsKey("codigo_autorizacion"))
     {
         AuthorizationCode = getDataFromRequest["codigo_autorizacion"];
     }
     if (getDataFromRequest.ContainsKey("respuesta"))
     {
         WithError = getDataFromRequest["respuesta"] != "00";
     }
 }
示例#2
0
 public CreateTransactionResponseDto(IDictionary <string, string> values, IConfiguration configuration)
 {
     if (values.ContainsKey("trx_id"))
     {
         TransactionId = Convert.ToUInt64(values["trx_id"]);
     }
     if (values.ContainsKey("token"))
     {
         Token = values["token"];
     }
     if (values.ContainsKey("respuesta"))
     {
         WithError = values["respuesta"] != "00";
     }
     if (values.ContainsKey("monto"))
     {
         Currency = new CurrencyDto(values["monto"]);
     }
     if (values.ContainsKey("error"))
     {
         ErrorMessage = values["error"];
     }
     if (values.ContainsKey("medio_pago"))
     {
         PaymentMethod = values["medio_pago"] == "999"
                             ? null
                             : (PaymentMethod?)Enum.Parse(typeof(PaymentMethod), int.Parse(values["medio_pago"]).ToString(CultureInfo.InvariantCulture));
     }
     ProcessUrl = configuration.GetProcessTransactionUrl() + "/" + Token;
 }
 public NotificationTransactionDto(IDictionary<string, string> getDataFromRequest)
 {
     if (getDataFromRequest.ContainsKey("trx_id"))
         TransactionId = Convert.ToUInt64(getDataFromRequest["trx_id"]);
     if (getDataFromRequest.ContainsKey("token"))
         Token = getDataFromRequest["token"];
     if (getDataFromRequest.ContainsKey("monto"))
         Currency = new CurrencyDto(getDataFromRequest["monto"]);
     if (getDataFromRequest.ContainsKey("medio_pago"))
         PaymentMethod = getDataFromRequest["medio_pago"] == "999"
                             ? null
                             : (PaymentMethod?)
                               Enum.Parse(typeof (PaymentMethod),
                                          int.Parse(getDataFromRequest["medio_pago"]).ToString(
                                              CultureInfo.InvariantCulture));
     if (getDataFromRequest.ContainsKey("fecha_aprobacion"))
         DateTimeAcceptance = DateTime.Parse(getDataFromRequest["fecha_aprobacion"]);
     if (getDataFromRequest.ContainsKey("CardNumber"))
         CardNumber = getDataFromRequest["CardNumber"];
     if (getDataFromRequest.ContainsKey("num_cuotas"))
         InstalmentNumber = getDataFromRequest["num_cuotas"];
     if (getDataFromRequest.ContainsKey("tipo_cuotas"))
         InstalmentType = getDataFromRequest["tipo_cuotas"];
     if (getDataFromRequest.ContainsKey("valor_cuota"))
         InstalmentAmount = new CurrencyDto(getDataFromRequest["valor_cuota"]);
     if (getDataFromRequest.ContainsKey("primer_vencimiento"))
         FirtsExpiration = DateTime.Parse(getDataFromRequest["primer_vencimiento"]);
     if (getDataFromRequest.ContainsKey("numero_operacion"))
         OperationNumber = getDataFromRequest["numero_operacion"];
     if (getDataFromRequest.ContainsKey("codigo_autorizacion"))
         AuthorizationCode = getDataFromRequest["codigo_autorizacion"];
     if (getDataFromRequest.ContainsKey("respuesta"))
         WithError = getDataFromRequest["respuesta"] != "00";
 }
        public void given_string_when_create_currency_then_return_correct_currency()
        {
            const string value = "123.23";
            var currency = new CurrencyDto(value);

            Assert.AreEqual("123.23", currency.ToString());
        }
 public CreateTransactionResponseDto(IDictionary<string,string> values, IConfiguration configuration)
 {
     if (values.ContainsKey("trx_id"))
         TransactionId = Convert.ToUInt64(values["trx_id"]);
     if (values.ContainsKey("token"))
         Token = values["token"];
     if (values.ContainsKey("respuesta"))
         WithError = values["respuesta"] != "00";
     if (values.ContainsKey("monto"))
         Currency = new CurrencyDto(values["monto"]);
     if (values.ContainsKey("error"))
         ErrorMessage = values["error"];
     if (values.ContainsKey("medio_pago"))
         PaymentMethod = values["medio_pago"] == "999"
                             ? null
                             : (PaymentMethod?) Enum.Parse(typeof (PaymentMethod), int.Parse(values["medio_pago"]).ToString(CultureInfo.InvariantCulture));
     ProcessUrl = configuration.GetProcessTransactionUrl() + "/" + Token;
 }
 /// <summary>
 /// Create a new object for create process for payment.
 /// </summary>
 /// <param name="amount">Total value of the transaction</param>
 /// <param name="transactionId">Unique identifier of the client's transaction</param>
 public CreateTransactionRequestDto(decimal amount, ulong transactionId)
 {
     TransactionId = transactionId;
     Currency = new CurrencyDto(amount);
 }
        public void given_currency_when_call_to_string_get_amount_with_two_decimal()
        {
            var currency = new CurrencyDto(10000.23256m);

            Assert.AreEqual("10000.23", currency.ToString());
        }
示例#8
0
 /// <summary>
 /// Create a new object for create process for payment.
 /// </summary>
 /// <param name="amount">Total value of the transaction</param>
 /// <param name="transactionId">Unique identifier of the client's transaction</param>
 public CreateTransactionRequestDto(decimal amount, ulong transactionId)
 {
     TransactionId = transactionId;
     Currency      = new CurrencyDto(amount);
 }