Ejemplo n.º 1
0
        }         // CloseTodayAndYesterdayFiles

        public PacnetReturnData GetReport(DateTime endTime, DateTime startTime)
        {
            try {
                var timestampProvider = new TimestampProvider();

                var request = new RavenRequest(RavenOperationType.PAYMENTS.ToString());

                request.Set("ReportFormat", "RavenPaymentFile_v1.0");
                request.Set("StartTime", timestampProvider.FormatTimestamp(startTime));
                request.Set("EndTime", timestampProvider.FormatTimestamp(endTime));
                request.Set("ResultFields", "PRN PymtType Amount Currency CardNumber Description FileName Status");

                RavenResponse response = request.Send();

                OutputReport(response);

                using (var wr = new StringWriter()) {
                    serializer.Serialize(wr, response);
                    log.Debug("Result: " + wr);
                }                 // using

                log.Msg("GetReport completed successfully");
                return(new PacnetReturnData(response));
            } catch (Exception ex) {
                log.Alert(ex, "GetReport failed.");
                return(new PacnetReturnData {
                    Error = ex.Message
                });
            }     // try
        }         // GetReport
Ejemplo n.º 2
0
        }         // CheckStatus

        public PacnetReturnData CloseFile(int userId, string fileName = "ezbob")
        {
            log.Msg("Pacnet close file(user id: {0}, fileName: '{1}'", userId, fileName);

            try {
                var request = new RavenRequest(RavenOperationType.CLOSEFILE.ToString());

                request.Set("Filename", fileName);

                RavenResponse response = request.Send();

                using (var wr = new StringWriter()) {
                    serializer.Serialize(wr, response);
                    log.Debug("Result: {0}", wr);
                }                 // using

                log.Msg("Completed successfully: Pacnet close file(user id: {0}, fileName: '{1}'", userId, fileName);

                return(new PacnetReturnData(response));
            } catch (Exception ex) {
                log.Alert(ex, "Error while: Pacnet close file(user id: {0}, fileName: '{1}'", userId, fileName);
                return(new PacnetReturnData {
                    Error = ex.Message
                });
            }     // try
        }         // CloseFile
Ejemplo n.º 3
0
        //-----------------------------------------------------------------------------------
        public PacnetReturnData(RavenResponse response)
        {
            if (response == null)
            {
                Error = "Response is null";
                return;
            }
            var data = response.GetParams();

            OutParams = data;

            if (data.ContainsKey("HTTPStatus") && data["HTTPStatus"] != "OK")
            {
                Error = "Http status was: " + data["HTTPStatus"];
            }

            if (data.ContainsKey("TrackingNumber"))
            {
                TrackingNumber = data["TrackingNumber"];
            }

            if (data.ContainsKey("Status"))
            {
                Status = data["Status"];
            }
        }
Ejemplo n.º 4
0
        }         // GetReport

        protected void OutputReport(RavenResponse response)
        {
            bool reportToConsole = true;

            var reportGenerator = new ReportGenerator();

            if (reportToConsole)
            {
                reportGenerator.PrintReport(response.Get("Report"));
            }
            else
            {
                reportGenerator.SaveReport(response.Get("Report"), "pacnetReport.txt");
            }
        }         // OutputReport
Ejemplo n.º 5
0
        }         // SendMoney

        public PacnetReturnData CheckStatus(int userId, string trackingNumber)
        {
            log.Msg("Pacnet check status(user id: {0}, tracking #: '{1}').", userId, trackingNumber);

            try {
                var request = new RavenRequest(RavenOperationType.STATUS.ToString());

                request.Set("PaymentRoutingNumber", RoutingNumber);
                request.Set("TrackingNumber", trackingNumber);
                request.Set("PymtType", PaymentType);

                RavenResponse response = request.Send();

                using (var wr = new StringWriter()) {
                    serializer.Serialize(wr, response);
                    log.Debug("Result: {0}", wr);
                }                 // using

                log.Msg(
                    "Completed successfully: Pacnet check status(user id: {0}, tracking #: '{1}').",
                    userId,
                    trackingNumber
                    );

                var pacnetResponse = new PacnetReturnData(response);

                log.Msg(
                    "Status = '{2}' at Pacnet check status(user id: {0}, tracking #: '{1}').",
                    userId,
                    trackingNumber,
                    pacnetResponse.Status
                    );

                return(pacnetResponse);
            } catch (Exception ex) {
                log.Alert(
                    ex,
                    "Error while: Pacnet check status(user id: {0}, tracking #: '{1}').",
                    userId,
                    trackingNumber
                    );

                return(new PacnetReturnData {
                    Error = ex.Message
                });
            }     // try
        }         // CheckStatus