Пример #1
0
        private ReqMessage ProcessGeoITDPruchaseVoid(ReqMessage reqMsg_)
        {
            LOG.Trace("ENTER");

            ReqMessage retVal = new ReqMessage(null);

            try
            {
                string jsonBody = ByteStream.PByteToPrimitive(reqMsg_.Body, 0, typeof(string)).ToString();

                GeoITDPurchaseRequest purchaseRequest = GeoITDPurchaseRequest.DeserializeJson(jsonBody);

                GeoITDClient geoITDClient = new GeoITDClient();
                //(ConfigMgr.Instance.MercadoPagoAPIURL, ConfigMgr.Instance.MercadoLibreAPIURL, ConfigMgr.Instance.MercadoLibreAPIAccessTOKEN);

                string strAux = "";
                PurchaseVoidResponse response;

                LOG.Info("{Message}", $"Before calling PurchaseVoid(), REQUEST:\r\n{jsonBody}");

                if (geoITDClient.PurchaseVoid(GeoITDPurchaseRequest.ToPurchaseVoidRequest(purchaseRequest), out response))
                {
                    strAux = $"response_code={response.ResponseCode}|" +
                             $"transaction_id={response.TransactionId}";
                }
                else
                {
                    strAux = $"response_code={(response == null? -1 : response.ResponseCode)}";
                }

                //retVal.MessageType = reqMsg_.MessageType;
                retVal.Body = ByteStream.ToPByte(strAux);
                //retVal.BodySize = retVal.Body.Length;
                //retVal.Checksum = retVal.GenerateChecksum();

                LOG.Info("{Message}", $"After calling Purchase(), RESPONSE:\r\n{strAux}");
            }
            catch (Exception ex)
            {
                //retVal.MessageType = reqMsg_.MessageType;
                retVal.Body = ByteStream.ToPByte(ex.Message);
                //retVal.BodySize = retVal.Body.Length;
                //retVal.Checksum = retVal.GenerateChecksum();

                LOG.Fatal(ex, "{Message}", "Exception caught.");
            }
            finally
            {
                LOG.Trace("EXIT");
            }

            retVal.MessageType = reqMsg_.MessageType;
            retVal.BodySize    = retVal.Body.Length;
            retVal.Checksum    = retVal.GenerateChecksum();

            return(retVal);
        }
Пример #2
0
        private ReqMessage ProcessGeoITDQueryStatus(ReqMessage reqMsg_, bool waitForStatus = true)
        {
            LOG.Trace("ENTER");

            ReqMessage retVal = new ReqMessage(null);

            try
            {
                string jsonBody = ByteStream.PByteToPrimitive(reqMsg_.Body, 0, typeof(string)).ToString();

                GeoITDPurchaseQueryRequest queryRequest = GeoITDPurchaseQueryRequest.DeserializeJson(jsonBody);

                GeoITDClient geoITDClient = new GeoITDClient();

                string strAux = "";
                PurchaseQueryResponse queryResponse;

                LOG.Info("{Message}", $"Before calling ProcessGeoITDQueryStatus(), REQUEST:\r\n{jsonBody}");

                if (geoITDClient.QueryTransactionStatus(GeoITDPurchaseQueryRequest.ToPurchaseQueryRequest(queryRequest), out queryResponse, waitForStatus))
                {
                    strAux = $"response_code={queryResponse.ResponseCode}|" +
                             $"pos_response_code={queryResponse.PosResponseCode}|" +
                             $"pos_response_code_ext={queryResponse.PosResponseCodeExtension}|" +
                             $"ticket={queryResponse.Ticket}|" +
                             $"authorization_code={queryResponse.AuthorizationCode}|" +
                             $"issuer={queryResponse.Issuer}|" +
                             $"card_number={queryResponse.CardNumber}|" +
                             $"expiration_date={queryResponse.ExpirationDate}|" +
                             $"transaction_date={DateTime.ParseExact($"{queryResponse.TransactionDate}", "yyMMdd", CultureInfo.InvariantCulture):dd/MM/yyyy}|" +
                             $"transaction_time={DateTime.ParseExact($"{queryResponse.TransactionHour}", "HHmmss", CultureInfo.InvariantCulture):HH:mm}|" +
                             $"EMV_application_id={queryResponse.EmvApplicationId}|" +
                             $"EMV_application_name={queryResponse.EmvApplicationName}|" +
                             $"transaction_type={queryResponse.TransactionType}|" +
                             $"origin_card_type={queryResponse.OriginCardType}|" +
                             $"batch={queryResponse.Batch}|" +
                             $"acquirer={queryResponse.Acquirer}|" +
                             $"merchant={queryResponse.Merchant}|" +
                             $"input_mode={queryResponse.InputMode}|" +
                             $"card_owner_name={queryResponse.CardOwnerName}|" +
                             $"tax_amount={queryResponse.TaxAmount}";
                }
                else
                {
                    strAux = $"response_code={queryResponse.ResponseCode}";
                }

                retVal.MessageType = reqMsg_.MessageType;
                retVal.Body        = ByteStream.ToPByte(strAux);
                retVal.BodySize    = retVal.Body.Length;
                retVal.Checksum    = retVal.GenerateChecksum();

                LOG.Info("{Message}", $"After calling ProcessGeoITDQueryStatus(), RESPONSE:\r\n{strAux}");
            }
            catch (Exception ex)
            {
                LOG.Fatal(ex, "{Message}", "Exception caught.");
            }
            finally
            {
                LOG.Trace("EXIT");
            }

            return(retVal);
        }
Пример #3
0
        //private ReqMessage ProcessGeoITDPruchaseVoid(ReqMessage reqMsg_)
        //{
        //    LOG.Trace("ENTER");

        //    ReqMessage retVal = new ReqMessage(null);

        //    try
        //    {
        //        string jsonBody = ByteStream.PByteToPrimitive(reqMsg_.Body, 0, typeof(string)).ToString();

        //        GeoITDPurchaseRequest purchaseRequest = GeoITDPurchaseRequest.DeserializeJson(jsonBody);

        //        GeoITDClient geoITDClient = new GeoITDClient();
        //        //(ConfigMgr.Instance.MercadoPagoAPIURL, ConfigMgr.Instance.MercadoLibreAPIURL, ConfigMgr.Instance.MercadoLibreAPIAccessTOKEN);

        //        string strAux = "";
        //        long transactionId = 0;
        //        PurchaseQueryResponse queryResponse;

        //        LOG.Info("{Message}", $"Before calling Purchase(), REQUEST:\r\n{jsonBody}");

        //        if (geoITDClient.PurchaseVoid(GeoITDPurchaseRequest.ToPurchaseVoidRequest(purchaseRequest), out queryResponse))
        //        {
        //            strAux = $"response_code={queryResponse.ResponseCode}|" +
        //                     $"pos_response_code={queryResponse.PosResponseCode}|" +
        //                     $"pos_response_code_ext={queryResponse.PosResponseCodeExtension}|" +
        //                     $"transaction_id={transactionId}|" +
        //                     $"ticket={queryResponse.Ticket}|" +
        //                     $"authorization_code={queryResponse.AuthorizationCode}|" +
        //                     $"issuer={queryResponse.Issuer}|" +
        //                     $"card_number={queryResponse.CardNumber}|" +
        //                     $"expiration_date={queryResponse.ExpirationDate}|" +
        //                     $"transaction_datetime={queryResponse.TransactionDate} {queryResponse.TransactionHour}";
        //        }
        //        else
        //        {
        //            strAux = $"response_code={queryResponse.ResponseCode}";
        //        }

        //        retVal.MessageType = reqMsg_.MessageType;
        //        retVal.Body = ByteStream.ToPByte(strAux);
        //        retVal.BodySize = retVal.Body.Length;
        //        retVal.Checksum = retVal.GenerateChecksum();

        //        LOG.Info("{Message}", $"After calling Purchase(), RESPONSE:\r\n{strAux}");
        //    }
        //    catch (Exception ex)
        //    {
        //        LOG.Fatal(ex, "{Message}", "Exception caught.");
        //    }
        //    finally
        //    {
        //        LOG.Trace("EXIT");
        //    }

        //    return retVal;
        //}

        private ReqMessage ProcessGeoITDPruchaseRefund(ReqMessage reqMsg_)
        {
            LOG.Trace("ENTER");

            ReqMessage retVal = new ReqMessage(null);

            try
            {
                string jsonBody = ByteStream.PByteToPrimitive(reqMsg_.Body, 0, typeof(string)).ToString();

                GeoITDPurchaseRequest purchaseRequest = GeoITDPurchaseRequest.DeserializeJson(jsonBody);

                GeoITDClient geoITDClient = new GeoITDClient();
                //(ConfigMgr.Instance.MercadoPagoAPIURL, ConfigMgr.Instance.MercadoLibreAPIURL, ConfigMgr.Instance.MercadoLibreAPIAccessTOKEN);

                string strAux = "";
                //long transactionId = 0;
                PurchaseRefundResponse queryResponse;

                LOG.Info("{Message}", $"Before calling Purchase(), REQUEST:\r\n{jsonBody}");

                if (geoITDClient.PurchaseRefund(GeoITDPurchaseRequest.ToPurchaseRefundRequest(purchaseRequest), out queryResponse))
                {
                    strAux = $"response_code={queryResponse.ResponseCode}|" +
                             $"transaction_id={queryResponse.TransactionId}";
                }
                else
                {
                    strAux = $"response_code={(queryResponse == null ? -1 : queryResponse.ResponseCode)}";
                }

                //if (geoITDClient.PurchaseRefund(GeoITDPurchaseRequest.ToPurchaseRefundRequest(purchaseRequest), out queryResponse))
                //{
                //    strAux = $"response_code={queryResponse.ResponseCode}|" +
                //             $"pos_response_code={queryResponse.PosResponseCode}|" +
                //             $"pos_response_code_ext={queryResponse.PosResponseCodeExtension}|" +
                //             $"transaction_id={transactionId}|" +
                //             $"ticket={queryResponse.Ticket}|" +
                //             $"authorization_code={queryResponse.AuthorizationCode}|" +
                //             $"issuer={queryResponse.Issuer}|" +
                //             $"card_number={queryResponse.CardNumber}|" +
                //             $"expiration_date={queryResponse.ExpirationDate}|" +
                //             $"transaction_datetime={queryResponse.TransactionDate} {queryResponse.TransactionHour}";
                //}
                //else
                //{
                //    strAux = $"response_code={queryResponse.ResponseCode}";
                //}

                //retVal.MessageType = reqMsg_.MessageType;
                retVal.Body = ByteStream.ToPByte(strAux);
                //retVal.BodySize = retVal.Body.Length;
                //retVal.Checksum = retVal.GenerateChecksum();

                LOG.Info("{Message}", $"After calling Purchase(), RESPONSE:\r\n{strAux}");
            }
            catch (Exception ex)
            {
                retVal.Body = ByteStream.ToPByte(ex.Message);

                LOG.Fatal(ex, "{Message}", "Exception caught.");
            }
            finally
            {
                LOG.Trace("EXIT");
            }

            retVal.MessageType = reqMsg_.MessageType;
            retVal.BodySize    = retVal.Body.Length;
            retVal.Checksum    = retVal.GenerateChecksum();

            return(retVal);
        }
Пример #4
0
        static void Main(string[] args)
        {
            POSInterfaceServiceClient svc = new POSInterfaceServiceClient();

            svc.ChannelFactory.Endpoint.ListenUri = new Uri("http://geoitddev.geocom.com.uy:8554/v2/itdservice");

            PurchaseRequest pr = new PurchaseRequest();

            pr.SystemId    = "F3D5877B-3C08-488C-BE97-907444042490";
            pr.PosID       = "43113460";
            pr.Branch      = "LOCAL 1";
            pr.ClientAppId = "WS 001";
            pr.UserId      = "LUIS";
            pr.TransactionDateTimeyyyyMMddHHmmssSSS = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            pr.InvoiceAmount = "12200";
            pr.Amount        = "12200";
            pr.TaxableAmount = "10000";
            pr.TipAmount     = "1220";
            pr.Quotas        = 1;
            pr.Plan          = 1;
            pr.Currency      = "858";
            pr.TaxRefund     = 0;

            GeoITDClient client = new GeoITDClient();

            PurchaseQueryResponse purchaseStatus;

            bool bVal;
            long transactionId = 0;

/*
 *          bVal = client.Purchase(pr, out transactionId, out purchaseStatus);
 *
 *          ReverseRequest revReq = new ReverseRequest();
 *          revReq.PosID = pr.PosID;
 *          revReq.SystemId = pr.SystemId;
 *          revReq.Branch = pr.Branch;
 *          revReq.ClientAppId = pr.ClientAppId;
 *          revReq.UserId = pr.UserId;
 *          revReq.TransactionId = transactionId;
 *          revReq.STransactionId = transactionId.ToString();
 *
 *          //int code = -1;
 *          //bVal = client.Reverse(revReq, out code);
 *
 *          PurchaseVoidRequest pvr = new PurchaseVoidRequest()
 *          {
 *              ClientAppId = pr.ClientAppId,
 *              UserId = pr.UserId,
 *              TransactionDateTimeyyyyMMddHHmmssSSS = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
 *              TicketNumber = purchaseStatus.Ticket,
 *              Acquirer = purchaseStatus.Acquirer.ToString(),
 *
 *          };*/

            //bVal = client.PurchaseVoid(pvr, out purchaseStatus);

            PurchaseRefundRequest prr = new PurchaseRefundRequest()
            {
                ClientAppId = pr.ClientAppId,
                UserId      = pr.UserId,
                TransactionDateTimeyyyyMMddHHmmssSSS = DateTime.Now.ToString("yyyyMMddHHmmssffff"),
                TicketNumber = "0022",
                OriginalTransactionDateyyMMdd = DateTime.Now.ToString("yyMMdd"),
                Amount        = "12200",
                Currency      = "858",
                Quotas        = 1,
                Plan          = 1,
                TaxableAmount = "10000",
                TaxRefund     = 0,
                InvoiceAmount = pr.InvoiceAmount,
            };

            //bVal = client.PurchaseRefund(prr, out purchaseStatus);

            /*
             * var response = svc.processFinancialPurchase(pr);
             *
             * bool keepReading = true;
             * while (keepReading)
             * {
             *  tws.geoitd.GeoITDClientSOAP.PurchaseQueryRequest pqr = new tws.geoitd.GeoITDClientSOAP.PurchaseQueryRequest();
             *  pqr.SystemId = pr.SystemId;
             *  pqr.PosID = pr.PosID;
             *  pqr.Branch = pr.Branch;
             *  pqr.ClientAppId = pr.ClientAppId;
             *  pqr.UserId = pr.UserId;
             *  pqr.TransactionDateTimeyyyyMMddHHmmssSSS = pr.TransactionDateTimeyyyyMMddHHmmssfff;
             *  pqr.TransactionId = response.TransactionId;
             *  pqr.STransactionId = response.STransactionId;
             *
             *  purchaseState = svc.processFinancialPurchaseQuery(pqr);
             *
             *  keepReading = (purchaseState.ResponseCode == 10 || purchaseState.ResponseCode == 12);
             *  Thread.Sleep(100);
             * }*/
        }