Ejemplo n.º 1
0
        internal static List <TSelect> Get_Transactions()
        {
            List <TSelect> info = new List <TSelect>();

            using (OracleConnection connection = new OracleConnection(Environment.Constant.Oracle.oracle_cs)) {
                string        query = $"select * from table (proceficator.get_transaction_lifepay)";
                OracleCommand cmd   = new OracleCommand(query, connection);
                connection.Open();
                try {
                    using (OracleDataReader reader = cmd.ExecuteReader()) {
                        while (reader.Read())
                        {
                            Transaction t = new Transaction {
                                id            = reader.GetIntValue("utrnno"),
                                approval      = reader.GetStringValue("approval"),
                                pan           = reader.GetStringValue("pan"),
                                created       = reader.GetDateTimeOffsetValue("created"),
                                amount        = reader.GetDecimalValue("amount"),
                                rrn           = reader.GetStringValue("rrn"),
                                payment_id    = reader.GetOptionalIntValue("payment_id"),
                                mid_rfi       = reader.GetStringValue("mid_rfi"),
                                tid_vtb       = reader.GetStringValue("tid_vtb"),
                                cancel_code   = reader.GetStringValue("cancel_code"),
                                client_id     = reader.GetStringValue("client_id"),
                                tid_rfi       = reader.GetStringValue("tid_rfi"),
                                bank_acquirer = reader.GetStringValue("bank_acquirer"),
                                command       = reader.GetStringValue("command")
                            };

                            Queue q = new Queue {
                                id          = reader.GetIntValue("id_queue"),
                                utrnno      = reader.GetIntValue("utrnno"),
                                reversal    = reader.GetIntValue("reversal"),
                                id_api_user = reader.GetIntValue("id_api_user")
                            };

                            UserConfig c = new UserConfig {
                                method  = reader.GetEnumValue <HttpMethod>("method"),
                                uri     = reader.GetStringValue("uri"),
                                headers = reader.GetDictionary <string, string>("headers")
                            };

                            TSelect ts = new TSelect {
                                transaction = t,
                                queue       = q,
                                config      = c
                            };

                            info.Add(ts);
                        }
                        connection.Close();
                        return(info);
                    }
                } catch (OracleException e) {
                    if (e.ErrorCode == -20001)
                    {
                        throw new Exception(e.Message);
                    }
                    else
                    {
                        Console.Out.WriteLine("OracleException: {0}: {1}", Tool.GetCurrentMethod(), e.Message);
                        throw new Exception("An error occurred during the operation 'Get_Transactions'");
                    }
                }
            }
        }