private void btnDatosGTO_Click(object sender, EventArgs e)
        {
            DocumentoReferencia = txtBooking.Text.Trim();

            if (checkBox2.Checked)
            {
                TipoDoc    = "E";
                Contenedor = "";
            }
            else
            {
                MessageBox.Show("Este botón solo obtiene datos para GTO");
            }

            var resdo = da.obtenerTramaDepotOrder(DocumentoReferencia, Contenedor, TipoDoc);

            foreach (var item in resdo)
            {
                var responseDO = proxy.DepotOrder(item);

                if (responseDO.isValid)
                {
                    if (MessageBox.Show("El Booking se procesó correctamente, desea enviar el pago?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        RequestPayment request = new RequestPayment();
                        request.SenderID = "PAGOSONLINE";
                        request.Payments = da.obtenerTramaPayment(item.ReferenceNumber, item.Equipments.FirstOrDefault().EquipmentNumber, TipoDoc);

                        var responsePay = proxy.PaymentRegister(request);
                    }
                }
            }
        }
Beispiel #2
0
    protected void BtnPayBox_Click(object sender, EventArgs e)
    {
        RequestPayment RequestPayment = new RequestPayment();

        RequestPayment.PartnerAPIId   = PARTNER_API_ID;
        RequestPayment.PartnerAPIKey  = PARTNER_API_KEY;
        RequestPayment.PaymentType    = Convert.ToInt32(Payment_Type.Text.Trim());
        RequestPayment.PgCode         = PGCode.Text.Trim();
        RequestPayment.OrderNo        = OrderNo.Text.Trim();
        RequestPayment.TransAmount    = Convert.ToDouble(TransAmount.Text.Trim());
        RequestPayment.NotiUrl        = NotiUrl.Text.Trim();
        RequestPayment.ReturnUrl      = ReturnUrl.Text.Trim();
        RequestPayment.CancelUrl      = CancelUrl.Text.Trim();
        RequestPayment.OrderInfo      = OrderInfo.Text.Trim();
        RequestPayment.Email          = Email.Text.Trim();
        RequestPayment.AdditionalInfo = AdditionalInfo.Text.Trim();

        string errMsg  = string.Empty;
        string encData = PayBoxModule.GetPaymentEncrypt(PAYMENT_ENCRYPT_URL, RequestPayment, out errMsg);

        StringBuilder sbHtml = new StringBuilder();

        if (!string.IsNullOrEmpty(errMsg))
        {
            sbHtml.Append("<script>alert('" + errMsg + "'); self.close();</script>");
            Response.Write(sbHtml.ToString());

            return;
        }

        sbHtml.Append("<form id='payboxsubmit' name='payboxsubmit' action='" + string.Format(REQUEST_PAYMENT_URL, RequestPayment.PgCode) + "' method='GET'>");
        sbHtml.Append("<input type='hidden' name='param' value='" + encData + "'/>");
        sbHtml.Append("<script>document.forms['payboxsubmit'].submit();</script>");
        Response.Write(sbHtml.ToString());
    }
        public IHttpActionResult PutRequestPayment(int id, RequestPayment requestPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != requestPayment.Transaction_ID)
            {
                return(BadRequest());
            }

            db.Entry(requestPayment).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RequestPaymentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #4
0
        public string GrantToken(RequestPayment request)
        {
            long         grantedTokenId;
            const string chargeid       = "Granted By Admin";
            var          token          = GetToken(request.TokenId);
            var          generatedToken = "UST-" + Common.GetUniqueKey(10);

            if (token != null)
            {
                var tokenExpiresOn = DateTime.Now.AddDays(token.ExpireDurationInDays).ToAppDateTime();
                dbContext.PaymentTransaction.Add(new PaymentTransaction
                {
                    Amount            = token.Amount,
                    IsActive          = true,
                    IsDeleted         = false,
                    TokenId           = token.Id,
                    TransactionDate   = DateTime.Now.ToAppDateTime(),
                    TransactionNumber = chargeid,
                    UserId            = Convert.ToInt64(request.UserId),
                });

                dbContext.Managetoken.Add(new Managetoken
                {
                    CreateDate           = DateTime.Now.ToAppDateTime(),
                    IsActive             = true,
                    TokenId              = token.Id,
                    UserId               = Convert.ToInt64(request.UserId),
                    UniqueTokenId        = generatedToken,
                    WillExpireOn         = tokenExpiresOn,
                    RemainingUploadCount = token.NoOfUploadsAllowed,
                });
                dbContext.SaveChanges();
            }
            return(generatedToken);
        }
Beispiel #5
0
        public string PagoDocumentos(RequestPayment requestPayment, string documentDetails)
        {
            string json = string.Empty;

            try
            {
                var jsonRequestPayment = new JavaScriptSerializer().Serialize(requestPayment);
                var conn = new Conexioncs().QueryString;
                using (var cn = new SqlConnection(conn))
                {
                    cn.Open();
                    using (var cmd = new SqlCommand("GET_PAYMENT", cn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@rqUUID", SqlDbType.VarChar).Value          = requestPayment.rqUUID;
                        cmd.Parameters.Add("@operationDate", SqlDbType.VarChar).Value   = requestPayment.operationDate;
                        cmd.Parameters.Add("@operationNumber", SqlDbType.VarChar).Value = requestPayment.operationNumber;
                        cmd.Parameters.Add("@financialEntity", SqlDbType.VarChar).Value = requestPayment.financialEntity;
                        cmd.Parameters.Add("@channel", SqlDbType.VarChar).Value         = requestPayment.channel;
                        cmd.Parameters.Add("@serviceId", SqlDbType.VarChar).Value       = requestPayment.serviceId;
                        cmd.Parameters.Add("@customerId", SqlDbType.VarChar).Value      = requestPayment.customerId;
                        cmd.Parameters.Add("@paymentType", SqlDbType.VarChar).Value     = requestPayment.paymentType;
                        cmd.Parameters.Add("@amountTotal", SqlDbType.VarChar).Value     = requestPayment.amountTotal;
                        if (requestPayment.check != null)
                        {
                            if (requestPayment.check.checkNumber != null && requestPayment.check.financialEntity != null)
                            {
                                cmd.Parameters.Add("@checkNumber", SqlDbType.VarChar).Value          = requestPayment.check.checkNumber;
                                cmd.Parameters.Add("@checkfinancialEntity", SqlDbType.VarChar).Value = requestPayment.check.financialEntity;
                            }
                        }
                        cmd.Parameters.Add("@documentDetail", SqlDbType.VarChar).Value = documentDetails;
                        cmd.Parameters.Add("@request", SqlDbType.VarChar).Value        = jsonRequestPayment;
                        SqlDataReader rd = cmd.ExecuteReader();
                        while (rd.Read())
                        {
                            json = rd[0].ToString();
                            json = json.Substring(1, json.Length - 2);
                        }
                    }
                }
                return(json);
            }
            catch (Exception ex)
            {
                var    dateFormat     = "yyyy-MM-ddTHH:mm:ss";
                string dateOperation  = DateTimeOffset.UtcNow.ToString(dateFormat);
                var    respuestaError = new ErrorResponse();
                respuestaError.rqUUID                   = requestPayment.rqUUID;
                respuestaError.resultCode               = "CP0138";
                respuestaError.resultDescription        = "ERROR AL PROCESAR TRANSACCION";
                respuestaError.resultCodeCompany        = "ERROR-21DB";
                respuestaError.resultDescriptionCompany = ex.Message.ToString().ToUpper();
                respuestaError.operationDate            = dateOperation;
                json = new JavaScriptSerializer().Serialize(respuestaError);
                log.Info("Error al ejecutar el llamado del metodo Inquire: " + json);
                return(json);
            }
        }
Beispiel #6
0
        public async Task <BaseResponseMessage> PaymentService(RequestPayment request)
        {
            PaymentOperation op = new PaymentOperation(request, this.paymentTransactionService);

            op.Execute();

            return(op.baseResponseMessage);
        }
Beispiel #7
0
        public async Task <ActionResult> Pay(RequestPayment model)
        {
            // ساخت کد پرداخت به منظور هدایت به درگاه بانکی
            var payCode = await CallApi <PaymentResult>(config.AppSettings["PAYMENT_URL"], model);

            //هدایت کاربر به درگاه بانک
            return(Redirect(config.AppSettings["GOTOIPG_URL"] + payCode.Code));
        }
        public ActionResult AddRequestPayment(RequestPayment ReqPay)
        {
            ReqPay.Transaction_Date = DateTime.Now;
            ReqPay.BalanceID        = (int)Session["userID"];
            HttpResponseMessage response = GlobalVariable.WebApiClient.PostAsJsonAsync("RequestPayments", ReqPay).Result;

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> RequestPayment(RequestPayment requestPaymentAggregate)
        {
            var entity = await this.mediator.Send(new RequestPaymentCommand(requestPaymentAggregate));

            return(new ObjectResult(entity)
            {
                StatusCode = Microsoft.AspNetCore.Http.StatusCodes.Status201Created
            });
        }
Beispiel #10
0
        /// <summary>
        /// Requests the payment.
        /// </summary>
        /// <param name="requestPayment"></param>
        /// <returns></returns>
        public async Task <BankResponsePayment> RequestPaymentAsync(RequestPayment requestPayment)
        {
            var randomStatus = new Random();

            return(await Task.FromResult(new BankResponsePayment()
            {
                PaymentStatus = (PaymentStatusTypes)randomStatus.Next(0, 2), //this will return either Success or Unsuccess
                BankRequestCode = Guid.NewGuid()
            }));
        }
        public async Task <Unit> Handle(RequestPayment command, CancellationToken cancellationToken)
        {
            await externalCommandBus.Post(
                externalServicesConfig.PaymentsUrl,
                "payments",
                command,
                cancellationToken);

            return(Unit.Value);
        }
Beispiel #12
0
        public async Task <BaseResponseMessage> PaymentService([FromBody] JObject json)
        {
            string jsonRequest = json.ToString();

            RequestPayment request = new RequestPayment();

            request = JsonConvert.DeserializeObject <RequestPayment>(jsonRequest);

            return(await this.repository.PaymentService(request));
        }
        public IHttpActionResult GetRequestPayment(int id)
        {
            RequestPayment requestPayment = db.RequestPayments.Find(id);

            if (requestPayment == null)
            {
                return(NotFound());
            }

            return(Ok(requestPayment));
        }
    public static string GetPaymentEncrypt(string requestUrl, RequestPayment requestPayment, out string errorMsg)
    {
        errorMsg = string.Empty;

        RequestDataResult requestDataResult = new RequestDataResult();

        string data          = JsonConvert.SerializeObject(requestPayment);
        string response_data = string.Empty;

        byte[] byteDataParams = UTF8Encoding.UTF8.GetBytes(data.ToString());

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUrl);

        request.Method        = "POST";
        request.ContentType   = "application/json";
        request.ContentLength = byteDataParams.Length;
        Stream stDataParams = request.GetRequestStream();

        stDataParams.Write(byteDataParams, 0, byteDataParams.Length);
        stDataParams.Close();

        try
        {
            HttpWebResponse webResponse    = (HttpWebResponse)request.GetResponse();
            Stream          webStream      = webResponse.GetResponseStream();
            StreamReader    responseReader = new StreamReader(webStream, System.Text.Encoding.UTF8);
            requestDataResult = JsonConvert.DeserializeObject <RequestDataResult>(responseReader.ReadToEnd());
            Console.Out.WriteLine(requestDataResult.Data);
            responseReader.Close();
        }
        catch (WebException e)
        {
            using (WebResponse response = e.Response)
            {
                HttpWebResponse httpResponse = (HttpWebResponse)response;

                using (Stream errorData = response.GetResponseStream())
                    using (StreamReader errorReader = new StreamReader(errorData))
                    {
                        string errorText = errorReader.ReadToEnd();
                        Console.WriteLine("--------Error---------");
                        Console.WriteLine("Error code: {0}", httpResponse.StatusCode);
                        Console.WriteLine("Error Msg: {0}", errorText);

                        ErrorResult errorResult = JsonConvert.DeserializeObject <ErrorResult>(errorText);
                        errorMsg = errorResult.Error.Detail;
                    }
            }

            requestDataResult.Data = string.Empty;
        }

        return(requestDataResult.Data);
    }
        public IHttpActionResult PostRequestPayment(RequestPayment requestPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.RequestPayments.Add(requestPayment);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = requestPayment.Transaction_ID }, requestPayment));
        }
Beispiel #16
0
        /// <summary>
        /// 认证缴费
        /// </summary>
        /// <returns></returns>
        public string AuditPayment(RequestPayment Param)
        {
            SystemPayment payment = Param.MapToEntity <SystemPayment>();

            if (Insert <SystemPayment>(payment))
            {
                return(ServiceMessage.INSERTSUCCESS);
            }
            else
            {
                return(ServiceMessage.INSERTFAIL);
            }
        }
        public IHttpActionResult DeleteRequestPayment(int id)
        {
            RequestPayment requestPayment = db.RequestPayments.Find(id);

            if (requestPayment == null)
            {
                return(NotFound());
            }

            db.RequestPayments.Remove(requestPayment);
            db.SaveChanges();

            return(Ok(requestPayment));
        }
        public ResponsePayment PaymentRegister(RequestPayment request)
        {
            var responseToken = GenerarToken();

            var url      = ConfigurationManager.AppSettings["UrlPayment"];
            var response = Helper.InvocarServicio <ResponsePayment>(request, "POST", url, responseToken.access_token);

            if (response == null)
            {
                throw new Exception(string.Format("Problemas con el servicio: {0}", url));
            }

            return(response);
        }
Beispiel #19
0
        public async Task <RequestPayment> GetById([FromRoute] int id)
        {
            RequestPayment requestPayment = null;

            try
            {
                requestPayment = await _requestPaymentService.GetByIdAsync(id);
            }
            catch (Exception ex)
            {
            }


            return(requestPayment);
        }
Beispiel #20
0
        /// <summary>
        /// Adds a payment.
        /// </summary>
        /// <param name="requestPayment">The request payment.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public async Task <Guid> AddPaymentAsync(RequestPayment requestPayment)
        {
            var payment = new Model.PaymentRequest();

            payment.CardNumber  = requestPayment.Card.CardNumber;
            payment.CodeStatus  = (int)PaymentStatusTypes.Pending;
            payment.Cvv         = requestPayment.Card.Cvv.ToString();
            payment.Name        = requestPayment.Card.Name;
            payment.ExpiryMonth = requestPayment.Card.ExpiryMonth;
            payment.ExpiryYear  = requestPayment.Card.ExpiryYear;
            payment.PaymentCode = Guid.NewGuid(); //this will be changed to the code provided by the bank, this is temporary

            await this.unitOfWork.Context.PaymentRequest.AddAsync(payment);

            await this.unitOfWork.CommitAsync();

            return(payment.PaymentCode);
        }
Beispiel #21
0
        public void Charge(RequestPayment requestPayment, StripePayment stripe)
        {
            // Set your secret key: remember to change this to your live secret key in production
            // See your keys here: https://dashboard.stripe.com/account/apikeys
            StripeConfiguration.ApiKey = "sk_test_lomdOfxbm7QDgZWvR82UhV6D";

            // Token is created using Checkout or Elements!
            // Get the payment token submitted by the form:
            var token = requestPayment.StripeToken;

            var options = new ChargeCreateOptions {
                Amount      = stripe.Amount,
                Currency    = stripe.Currency,
                Description = stripe.Description,
                Source      = token,
            };
            var    service = new ChargeService();
            Charge charge  = service.Create(options);
        }
        public ActionResult Upload(FormCollection formCollection)
        {
            if (Request != null)
            {
                HttpPostedFileBase file = Request.Files["UploadedFile"];
                if ((file != null) && (file.ContentLength > 0) && !string.IsNullOrEmpty(file.FileName))
                {
                    string fileName        = file.FileName;
                    string fileContentType = file.ContentType;
                    byte[] fileBytes       = new byte[file.ContentLength];
                    var    data            = file.InputStream.Read(fileBytes, 0, Convert.ToInt32(file.ContentLength));
                    var    PaymentList     = new List <RequestPayment>();

                    // If you use EPPlus in a noncommercial context
                    // according to the Polyform Noncommercial license:
                    ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
                    using (var package = new ExcelPackage(file.InputStream))
                    {
                        var currentSheet = package.Workbook.Worksheets;
                        var workSheet    = currentSheet.First();
                        var noOfCol      = workSheet.Dimension.End.Column;
                        var noOfRow      = workSheet.Dimension.End.Row;

                        for (int rowIterator = 1; rowIterator <= noOfRow; rowIterator++)
                        {
                            var RequestPayment = new RequestPayment();
                            RequestPayment.Merchant         = workSheet.Cells[rowIterator, 1].Value.ToString();
                            RequestPayment.Acc_No           = workSheet.Cells[rowIterator, 2].Value.ToString();
                            RequestPayment.Account_Name     = workSheet.Cells[rowIterator, 3].Value.ToString();
                            RequestPayment.Ref_No           = workSheet.Cells[rowIterator, 4].Value.ToString();
                            RequestPayment.Other_detail     = workSheet.Cells[rowIterator, 5].Value.ToString();
                            RequestPayment.Amount           = Decimal.Parse(workSheet.Cells[rowIterator, 6].Value.ToString());
                            RequestPayment.Transaction_Date = DateTime.Now;
                            RequestPayment.BalanceID        = (int)Session["userID"];

                            HttpResponseMessage response = GlobalVariable.WebApiClient.PostAsJsonAsync("RequestPayments", RequestPayment).Result;
                        }
                    }
                }
            }

            return(RedirectToAction("Index", "RequestPayment"));
        }
        public async Task Handle(RequestPayment message, IMessageHandlerContext context)
        {
            var payment = new Payment
            {
                EventId       = message.EventId,
                EventName     = message.EventName,
                PaymentId     = message.PaymentId,
                Price         = message.Price,
                UserName      = message.UserName,
                PaymentStatus = PaymentStatus.New
            };

            await this.DbContext.Payments.AddAsync(payment);

            await this.DbContext.SaveChangesAsync();

            this.Data.PaymentId = payment.PaymentId;
            this.Data.Completed = false;
            await this.RequestTimeout <PaymentSagaTimeout>(context, TimeSpan.FromDays(1));
        }
        public async Task <ActionResult> Charge([FromForm] string stripeToken, [FromForm] string email, [FromForm] int orderId, [FromForm] string description, [FromForm] int amount, string currency = "usd")
        {
            var service = new StripePayment
            {
                OrderId     = orderId,
                StripeToken = stripeToken,
                Amount      = amount,
                Description = description,
                Currency    = currency
            };

            var payment = new RequestPayment
            {
                Email       = email,
                OrderId     = orderId,
                StripeToken = stripeToken
            };

            _services.Charge(payment, service);

            return(Ok());
        }
        /// <summary>
        /// 调用商户服务器支付统一下单接口,进行预支付
        /// </summary>
        public RequestPayment Prepay(string openid, string appid, string title, int total_fee)
        {
            bool isMock = !Cat.Foundation.ConfigManager.BookSettings.OpenWxPay.ToBoolean(true);

            //注释下面这个判断,就是一个正常的微信支付流程了。 或配置OpenWxPay的值为false
            if (isMock)
            {
                var user = AllServices.BookUserService.GetSingle(openid);
                if (user == null)
                {
                    throw new Exception("找不到用户");
                }
                var MM_Currency_Ratio = Foundation.ConfigManager.BookSettings.Currency_Ratio;
                var MM_Currency       = total_fee * 0.01 * MM_Currency_Ratio;
                //新增充值记录
                AllServices.BookUserRechargeService.Add(user.Openid, (int)Cat.Enums.Book.RechargeType.微信支付充值, (int)MM_Currency, "模拟充值");
                //调整用户账户余额
                user.Currency = user.Currency + (int)MM_Currency;
                AllServices.BookUserService.Update(user);
                // throw new Exception("充值成功!惊不惊喜?意不意外?");
            }
            else
            {
                //string openid = "o0LDq4njwCCuQuj3FOIZeLFDrc9o";
                string key = WechatAppConfig.Mch_id_secret; //商户平台设置的密钥key

                //int price = 120;
                //int total_fee = price * 100;

                string outTradeNo = StringHelper.GetUUID().ToString(); //商户订单号

                TenPayV3UnifiedorderRequestData requestData = new TenPayV3UnifiedorderRequestData(
                    appid,
                    WechatAppConfig.Mch_id,
                    title,
                    outTradeNo,
                    total_fee,
                    IPHelper.GetClientIP(),
                    CatContext.HttpContext.Request.Scheme + "://" + CatContext.HttpContext.Request.Host + "/Book/WechatPay/Notify",
                    TenPayV3Type.JSAPI,
                    openid,
                    key,
                    TenPayV3Util.GetNoncestr()
                    );
                var result = TenPayV3.Unifiedorder(requestData);

                AllLogService.SysActionLogService.AddLog(Log.Services.Enum.LogLevel.INFO, requestData.ToJson(), "微信支付统一下单");

                //接口请求失败
                if (result.return_code != "SUCCESS")
                {
                    throw new Exception(result.return_msg);
                }
                //业务失败
                else if (result.result_code != "SUCCESS")
                {
                    throw new Exception(string.Format("[{0}]{1}", result.err_code, result.err_code_des));
                }
                //成功
                else if (result.IsResultCodeSuccess())
                {
                    //再次签名接口,返回支付数据
                    string timeStamp = TenPayV3Util.GetTimestamp();
                    string nonceStr  = TenPayV3Util.GetNoncestr();
                    string package   = "prepay_id=" + result.prepay_id;
                    string paySign   = TenPayV3.GetJsPaySign(result.appid, timeStamp, nonceStr, package, key);
                    var    data      = new RequestPayment()
                    {
                        AppId     = result.appid,
                        NonceStr  = nonceStr,
                        Package   = package,
                        SignType  = "MD5",
                        TimeStamp = timeStamp,
                        PaySign   = paySign
                    };

                    //数据库记录订单信息
                    AllPublicService.WechatPayOrderService.Add(Enums.Wechat.AppKey.喵喵看书, appid, openid, WechatAppConfig.Mch_id, outTradeNo, title, requestData.ToJson(), total_fee, false, "预支付", result.prepay_id);

                    return(data);
                }
            }

            if (isMock)
            {
                throw new Exception("充值成功!惊不惊喜?意不意外?");
            }

            throw new Exception("微信预支付失败");
        }
Beispiel #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequestPaymentCommand"/> class.
 /// </summary>
 /// <param name="requestPaymentAggregate">The request payment aggregate.</param>
 public RequestPaymentCommand(RequestPayment requestPayment)
 {
     this.RequestPayment = requestPayment;
 }
 public ObjectResultEx AuditPayment(RequestPayment Param)
 {
     return(ObjectResultEx.Instance(EnterpriseService.AuditPayment(Param), 1, RetrunMessge.SUCCESS, HttpCode.Success));
 }
Beispiel #28
0
 public PaymentOperation(RequestPayment request)
 {
     this.request.Header = new Header();
     this.request        = request;
 }
Beispiel #29
0
        public async Task <IActionResult> Create([FromBody] RequestPayment requestPayment)
        {
            int RequestPaymentId = await _requestPaymentService.CreateAsync(requestPayment);

            return(CreatedAtRoute("GetRequestPayment", new { id = RequestPaymentId }, requestPayment));
        }
        private void btnTrasladar_Click(object sender, EventArgs e)
        {
            if (!checkBox3.Checked)
            {
                DocumentoReferencia = txtDocRef.Text.Trim();
                Contenedor          = txtContenedor.Text.Trim();
                //TipoDoc = rbMaster.Checked ? "M" : "H";

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells["Seleccionar"].Value.ToString() == "1")
                    {
                        try
                        {
                            DocumentoReferencia = dataGridView1.Rows[i].Cells["BL"].Value.ToString();
                            Contenedor          = dataGridView1.Rows[i].Cells["NroContenedor"].Value.ToString();

                            var resdo = da.obtenerTramaDepotOrder(DocumentoReferencia, Contenedor, TipoDoc);

                            foreach (var item in resdo)
                            {
                                if (comboBox1.Text.Equals("Ransa San Agustin"))
                                {
                                    item.YardCode = "DEP02";
                                }
                                else if (comboBox1.Text.Equals("Ransa Primax"))
                                {
                                    item.YardCode = "DEP01";
                                }

                                //Actualizamos la linea naviera del contenedor
                                if (item.Equipments.FirstOrDefault().EquipmentNumber != null && item.Equipments.FirstOrDefault().EquipmentNumber != "")
                                {
                                    da.ActualizarLineaNavieraContenedor(item.Equipments.FirstOrDefault().EquipmentNumber);
                                }

                                var responseDO = proxy.DepotOrder(item);

                                if (responseDO.isValid)
                                {
                                    RequestPayment request = new RequestPayment();
                                    request.SenderID = "PAGOSONLINE";
                                    request.Payments = da.obtenerTramaPayment(item.ReferenceNumber, item.Equipments.FirstOrDefault().EquipmentNumber, TipoDoc);

                                    if (request.Payments.Count > 0)
                                    {
                                        var responsePay = proxy.PaymentRegister(request);

                                        if (!responsePay.isValid)
                                        {
                                            MessageBox.Show(responsePay.messages.FirstOrDefault().message.ToString(), "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                            //return;
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("BL no tiene pago registrado en Tramarsa", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        return;
                                    }
                                }
                                else
                                {
                                    MessageBox.Show(responseDO.messages.FirstOrDefault().message.ToString(), "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    return;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message.ToString(), "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                    }
                }

                MessageBox.Show("Contenedor/es registrado correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                DocumentoReferencia = txtBooking.Text.Trim();
                TipoDoc             = "E";
                Contenedor          = "";

                try
                {
                    var resdo = da.obtenerTramaDepotOrder(DocumentoReferencia, Contenedor, TipoDoc);

                    if (resdo.Count > 0)
                    {
                        foreach (var item in resdo)
                        {
                            item.VoyageStopExternalCode = da.ObtenerVoyageStopExternalCode(item.VoyageStopExternalCode);

                            var responseDO = proxy.DepotOrder(item);

                            if (responseDO.isValid)
                            {
                                if (MessageBox.Show("El Booking se procesó correctamente, desea enviar el pago?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                                {
                                    RequestPayment request = new RequestPayment();
                                    request.SenderID = "PAGOSONLINE";
                                    request.Payments = da.obtenerTramaPayment(item.ReferenceNumber, item.Equipments.FirstOrDefault().EquipmentNumber, TipoDoc);

                                    if (request.Payments.Count > 0)
                                    {
                                        var responsePay = proxy.PaymentRegister(request);
                                    }
                                    else
                                    {
                                        MessageBox.Show("Booking no tiene pago registrado en Tramarsa", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Booking no se encuentra registrado", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }