Exemplo n.º 1
0
        public HttpResponseMessage RetornaFinalizaPagamentoTray(string token, string PayerID, string codpag)
        {
            ConfigAppMembers cf  = Util.ConfigApp.getConfig();
            string           ret = "";

            try
            {
                List <pedidopagamento> lstpag = PagamentoADO.BuscaPagamentoTituloByCodpag(codpag, cf.datasource, cf.schema);
                //PagamentoADO.GravaPagamento(lstpag[0].codped, "5", lstpag[0].valorpago, "N", "S", "1", "N", codpag, "", "A", token, PayerID, "", "", "", cf.datasource, cf.schema);
                ret = "ok";
            }
            catch (Exception e)
            {
                Util.LogUtil.GravaLog(this, "RetornaFinalizaPagamentoTray : " + e.ToString(), cf.Cnpj, Log.TipoLog.erro);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "ERRO"));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, ret));
        }
Exemplo n.º 2
0
        public HttpResponseMessage RetornaFinalizaPagamentoPaypal(string token, string PayerID, string codpag)
        {
            ConfigAppMembers cf  = Util.ConfigApp.getConfig();
            PaypalFinalize   ret = new PaypalFinalize();

            try
            {
                NameValueCollection nvp = Checkout.finalize(token, PayerID);
                ret.payerid        = PayerID;
                ret.tokentransacao = token;
                ret.shiptoname     = nvp["PAYMENTREQUEST_0_SHIPTONAME"];
                ret.shiptocity     = nvp["PAYMENTREQUEST_0_SHIPTOCITY"];
                ret.shiptostate    = nvp["PAYMENTREQUEST_0_SHIPTOSTATE"];
                ret.shiptostreet   = nvp["PAYMENTREQUEST_0_SHIPTOSTREET"];
                ret.shiptostreet2  = nvp["PAYMENTREQUEST_0_SHIPTOSTREET2"];
                ret.shiptozip      = nvp["PAYMENTREQUEST_0_SHIPTOZIP"];
                ret.statusakc      = nvp["ACK"];
                ret.firstname      = nvp["FIRSTNAME"];
                ret.lastname       = nvp["LASTNAME"];
                ret.email          = nvp["EMAIL"];

                //Finaliza o pagamento
                if (ret.statusakc == "Success")
                {
                    List <pedidopagamento> lstpag = PagamentoADO.BuscaPagamentoTituloByCodpag(codpag, cf.datasource, cf.schema);

                    PagamentoADO.GravaPagamento(lstpag[0].codped, "5", lstpag[0].valorpago, "N", "S", "1", "N", codpag, "", "A", token, PayerID, "", "", "", cf.datasource, cf.schema, "2");
                }
            }
            catch (Exception e)
            {
                Util.LogUtil.GravaLog(this, "RetornaFinalizaPagamentoPaypal : " + e.ToString(), cf.Cnpj, Log.TipoLog.erro);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "ERRO"));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, ret));
        }