Esempio n. 1
0
        /*
         * CASH
         */
        public CashModel CashCreate(string type, string invoice,
                                    string description,
                                    string value,
                                    string tax,
                                    string tax_base,
                                    string currency,
                                    string type_person,
                                    string doc_type,
                                    string doc_number,
                                    string name,
                                    string last_name,
                                    string email,
                                    string cell_phone,
                                    string end_date,
                                    string url_response,
                                    string url_confirmation,
                                    string method_confirmation)
        {
            ENDPOINT  = body.getQueryCash(type);
            PARAMETER = body.getBodyCashCreate(_auxiliars.ConvertToBase64(IV), _TEST, _PUBLIC_KEY, _PRIVATE_KEY,
                                               invoice, description, value, tax, tax_base, currency, type_person, doc_type, doc_number, name,
                                               last_name, email, cell_phone, end_date, url_response, url_confirmation, method_confirmation);
            string content = _restRequest.Execute(
                ENDPOINT,
                "POST",
                _auxiliars.ConvertToBase64(_PUBLIC_KEY),
                PARAMETER);
            CashModel cash = JsonConvert.DeserializeObject <CashModel>(content);

            return(cash);
        }
Esempio n. 2
0
        /*
         * CASH
         */
        public CashModel CashCreate(string type, string invoice,
                                    string description,
                                    string value,
                                    string tax,
                                    string tax_base,
                                    string currency,
                                    string type_person,
                                    string doc_type,
                                    string doc_number,
                                    string name,
                                    string last_name,
                                    string email,
                                    string cell_phone,
                                    string end_date,
                                    string url_response,
                                    string url_confirmation,
                                    string method_confirmation,
                                    CashSplitModel split_data = null)
        {
            CashModel cash    = null;
            string    content = "";

            ENDPOINT = body.getQueryCash(type);

            if (split_data != null)
            {
                PARAMETER = body.getBodyBankCreateSplit(_auxiliars.ConvertToBase64(IV), _TEST, _PUBLIC_KEY, _PRIVATE_KEY,
                                                        "", invoice, description, value, tax, tax_base, currency, type_person, doc_type, doc_number, name,
                                                        last_name, email, "", cell_phone, url_response, url_confirmation, method_confirmation, split_data.splitpayment,
                                                        split_data.split_app_id, split_data.split_merchant_id, split_data.split_type, split_data.split_primary_receiver,
                                                        split_data.split_primary_receiver_fee, split_data.split_receivers);
            }
            else
            {
                PARAMETER = body.getBodyCashCreate(_auxiliars.ConvertToBase64(IV), _TEST, _PUBLIC_KEY, _PRIVATE_KEY,
                                                   invoice, description, value, tax, tax_base, currency, type_person, doc_type, doc_number, name,
                                                   last_name, email, cell_phone, end_date, url_response, url_confirmation, method_confirmation);
            }

            content = _restRequest.Execute(
                ENDPOINT,
                "POST",
                _auxiliars.ConvertToBase64(_PUBLIC_KEY),
                PARAMETER);

            cash = JsonConvert.DeserializeObject <CashModel>(content);
            return(cash);
        }
Esempio n. 3
0
        /*
         * CASH
         */
        public CashModel CashCreate(string type, string invoice,
                                    string description,
                                    string value,
                                    string tax,
                                    string tax_base,
                                    string ico,
                                    string currency,
                                    string type_person,
                                    string doc_type,
                                    string doc_number,
                                    string name,
                                    string last_name,
                                    string email,
                                    string cell_phone,
                                    string end_date,
                                    string url_response,
                                    string url_confirmation,
                                    string method_confirmation,
                                    string extra1            = "N/A",
                                    string extra2            = "N/A",
                                    string extra3            = "N/A",
                                    string extra4            = "N/A",
                                    string extra5            = "N/A",
                                    string extra6            = "N/A",
                                    string extra7            = "N/A",
                                    string extra8            = "N/A",
                                    string extra9            = "N/A",
                                    string extra10           = "N/A",
                                    SplitModel split_details = null)
        {
            CashModel cash;
            string    content;
            CashModel invalid = new CashModel
            {
                success        = false,
                title_response = "Error",
                text_response  = "Método de pago en efectivo no válido, unicamnete soportados: efecty, gana, redservi, puntored, sured",
                last_action    = "validation transaction",
                data           = new DataCash
                {
                    totalerrores = 1,
                    errores      = new List <errors>
                    {
                        new errors
                        {
                            codError     = "109",
                            errorMessage = "Método de pago en efectivo no válido, unicamnete soportados: efecty, gana, redservi, puntored, sured"
                        }
                    }
                }
            };
            string medio = type.ToLower();

            if (medio == "baloto")
            {
                return(invalid);
            }
            bool isCorrect = this.GetEntitiesCash(type);

            if (!isCorrect)
            {
                return(invalid);
            }
            ENDPOINT = Constants.url_cash + type;

            PARAMETER = body.getBodyCashCreate(_auxiliars.ConvertToBase64(IV), _TEST, _PUBLIC_KEY, _PRIVATE_KEY,
                                               invoice, description, value, tax, tax_base, ico, currency, type_person, doc_type, doc_number, name,
                                               last_name, email, cell_phone, end_date, url_response, url_confirmation, method_confirmation, extra1, extra2, extra3, extra4, extra5, extra6, extra7, extra8, extra9, extra10);

            if (split_details != null)
            {
                string split_req_body = body.getBodySplitPayments(split_details, true);
                PARAMETER = Auxiliars.ConcatBodyStrings(PARAMETER, split_req_body);
            }
            content = _restRequest.Execute(
                ENDPOINT,
                "POST",
                _auxiliars.ConvertToBase64(_PUBLIC_KEY),
                PARAMETER);
            cash = JsonConvert.DeserializeObject <CashModel>(content);
            return(cash);
        }