예제 #1
0
        public void Process(OrderProcessor processor)
        {
            // set processor reference
            orderProcessor = processor;
            // audit
            orderProcessor.CreateAudit("PSTakePayment started.", 20400);
            try
            {
                // take customer funds via DataCash gateway
                // configure DataCash XML request
                DataCashRequest request = new DataCashRequest();
                request.Authentication.Client =
                    BalloonShopConfiguration.DataCashClient;

                request.Authentication.Password =
                    BalloonShopConfiguration.DataCashPassword;
                request.Transaction.HistoricTxn.Method =
                    "fulfill";
                request.Transaction.HistoricTxn.AuthCode =
                    orderProcessor.Order.AuthCode;
                request.Transaction.HistoricTxn.Reference =
                    orderProcessor.Order.Reference;
                // get DataCash response
                DataCashResponse response =
                    request.GetResponse(
                        BalloonShopConfiguration.DataCashUrl);
                if (response.Status == "1")
                {
                    // audit
                    orderProcessor.CreateAudit(
                        "Funds deducted from customer credit card account.",
                        20402);
                    // update order status
                    orderProcessor.Order.UpdateStatus(5);
                    // continue processing
                    orderProcessor.ContinueNow = true;
                }
                else
                {
                    // audit
                    orderProcessor.CreateAudit(
                        "Error taking funds from customer credit card account.",
                        20403);
                    // mail admin
                    orderProcessor.MailAdmin(
                        "Credit card fulfillment declined.",
                        "XML data exchanged:\n" + request.Xml + "\n\n" +
                        response.Xml, 1);
                }
            }
            catch
            {
                // fund checking failure
                throw new OrderProcessorException(
                          "Error occured while taking payment.", 4);
            }
            // audit
            processor.CreateAudit("PSTakePayment finished.", 20401);
        }
예제 #2
0
        public void Process(OrderProcessor processor)
        {
            // set processor reference
              orderProcessor = processor;
              // audit
              orderProcessor.CreateAudit("PSTakePayment started.", 20400);
              try
              {
            // take customer funds via DataCash gateway
            // configure DataCash XML request
            DataCashRequest request = new DataCashRequest();
            request.Authentication.Client =
              BalloonShopConfiguration.DataCashClient;

            request.Authentication.Password =
              BalloonShopConfiguration.DataCashPassword;
            request.Transaction.HistoricTxn.Method =
              "fulfill";
            request.Transaction.HistoricTxn.AuthCode =
              orderProcessor.Order.AuthCode;
            request.Transaction.HistoricTxn.Reference =
              orderProcessor.Order.Reference;
            // get DataCash response
            DataCashResponse response =
              request.GetResponse(
              BalloonShopConfiguration.DataCashUrl);
            if (true || response.Status == "1")
            {
              // audit
              orderProcessor.CreateAudit(
            "Funds deducted from customer credit card account.",
            20402);
              // update order status
              orderProcessor.Order.UpdateStatus(5);
              // continue processing
              orderProcessor.ContinueNow = true;
            }
            else
            {
              // audit
              orderProcessor.CreateAudit(
               "Error taking funds from customer credit card account.",
               20403);
              // mail admin
              orderProcessor.MailAdmin(
            "Credit card fulfillment declined.",
            "XML data exchanged:\n" + request.Xml + "\n\n" +
            response.Xml, 1);
            }
              }
              catch
              {
            // fund checking failure
            throw new OrderProcessorException(
              "Error occured while taking payment.", 4);
              }
              // audit
              processor.CreateAudit("PSTakePayment finished.", 20401);
        }
예제 #3
0
 public void Process(OrderProcessor processor)
 {
     processor.CreateAudit("PSDoNothing started.", 99999);
       processor.CreateAudit("Customer: "
     + processor.Order.Customer.UserName, 99999);
       processor.CreateAudit("First item in order: "
     + processor.Order.OrderDetails[0].ItemAsString, 99999);
       processor.MailAdmin("Test.", "Test mail from PSDummy.", 99999);
       processor.CreateAudit("PSDoNothing finished.", 99999);
 }
예제 #4
0
 public void Process(OrderProcessor processor)
 {
     processor.CreateAudit("PSDoNothing started.", 99999);
     processor.CreateAudit("Customer: "
                           + processor.Order.Customer.UserName, 99999);
     processor.CreateAudit("First item in order: "
                           + processor.Order.OrderDetails[0].ItemAsString, 99999);
     processor.MailAdmin("Test.", "Test mail from PSDummy.", 99999);
     processor.CreateAudit("PSDoNothing finished.", 99999);
 }
예제 #5
0
 public void Process(OrderProcessor processor)
 {
     // set processor reference
       orderProcessor = processor;
       // audit
       orderProcessor.CreateAudit("PSCheckFunds started.", 20100);
       try
       {
     // check customer funds via DataCash gateway
     // configure DataCash XML request
     DataCashRequest request = new DataCashRequest();
     request.Authentication.Client =
        BalloonShopConfiguration.DataCashClient;
     request.Authentication.Password =
        BalloonShopConfiguration.DataCashPassword;
     request.Transaction.TxnDetails.MerchantReference =
       orderProcessor.Order.OrderID.ToString()
       .PadLeft(6, '0').PadLeft(7, '5');
     request.Transaction.TxnDetails.Amount.Amount =
       orderProcessor.Order.TotalCost.ToString();
     request.Transaction.TxnDetails.Amount.Currency = "GBP";
     request.Transaction.CardTxn.Method = "pre";
     request.Transaction.CardTxn.Card.CardNumber =
       orderProcessor.Order.CreditCard.CardNumber;
     request.Transaction.CardTxn.Card.ExpiryDate =
       orderProcessor.Order.CreditCard.ExpiryDate;
     if (orderProcessor.Order.CreditCard.IssueDate != "")
     {
       request.Transaction.CardTxn.Card.StartDate =
     orderProcessor.Order.CreditCard.IssueDate;
     }
     if (orderProcessor.Order.CreditCard.IssueNumber != "")
     {
       request.Transaction.CardTxn.Card.IssueNumber =
     orderProcessor.Order.CreditCard.IssueNumber;
     }
     // get DataCash response
     DataCashResponse response =
       request.GetResponse(
       BalloonShopConfiguration.DataCashUrl);
     if (response.Status == "1")
     {
       // update order authorization code and reference
       orderProcessor.Order.SetAuthCodeAndReference(
     response.MerchantReference,
     response.DatacashReference);
       // audit
       orderProcessor.CreateAudit(
     "Funds available for purchase.", 20102);
       // update order status
       orderProcessor.Order.UpdateStatus(2);
       // continue processing
       orderProcessor.ContinueNow = true;
     }
     else
     {
       // audit
       orderProcessor.CreateAudit(
     "Funds not available for purchase.", 20103);
       // mail admin
       orderProcessor.MailAdmin("Credit card declined.",
     "XML data exchanged:\n" + request.Xml + "\n\n"
     + response.Xml, 1);
     }
       }
       catch
       {
     // fund checking failure
     throw new OrderProcessorException(
       "Error occured while checking funds.", 1);
       }
       // audit
       processor.CreateAudit("PSCheckFunds finished.", 20101);
 }
        public void Process(OrderProcessor processor)
        {
            // set processor reference
            orderProcessor = processor;
            // audit
            orderProcessor.CreateAudit("PSCheckFunds started.", 20100);
            try
            {
                // check customer funds via DataCash gateway
                // configure DataCash XML request
                DataCashRequest request = new DataCashRequest();
                request.Authentication.Client =
                    BalloonShopConfiguration.DataCashClient;
                request.Authentication.Password =
                    BalloonShopConfiguration.DataCashPassword;

                request.Transaction.TxnDetails.MerchantReference =
                    orderProcessor.Order.OrderID.ToString()
                    .PadLeft(6, '0').PadLeft(7, '5');
                request.Transaction.TxnDetails.Amount.Amount =
                    orderProcessor.Order.TotalCost.ToString();
                request.Transaction.TxnDetails.Amount.Currency =
                    BalloonShopConfiguration.DataCashCurrency;
                request.Transaction.CardTxn.Method          = "pre";
                request.Transaction.CardTxn.Card.CardNumber =
                    orderProcessor.Order.CreditCard.CardNumber;
                request.Transaction.CardTxn.Card.ExpiryDate =
                    orderProcessor.Order.CreditCard.ExpiryDate;
                if (orderProcessor.Order.CreditCard.IssueDate != "")
                {
                    request.Transaction.CardTxn.Card.StartDate =
                        orderProcessor.Order.CreditCard.IssueDate;
                }
                if (orderProcessor.Order.CreditCard.IssueNumber != "")
                {
                    request.Transaction.CardTxn.Card.IssueNumber =
                        orderProcessor.Order.CreditCard.IssueNumber;
                }
                // get DataCash response
                DataCashResponse response =
                    request.GetResponse(
                        BalloonShopConfiguration.DataCashUrl);
                if (true || response.Status == "1")
                {
                    // update order authorization code and reference
                    orderProcessor.Order.SetAuthCodeAndReference(
                        response.MerchantReference,
                        response.DatacashReference);
                    // audit
                    orderProcessor.CreateAudit(
                        "Funds available for purchase.", 20102);
                    // update order status
                    orderProcessor.Order.UpdateStatus(2);
                    // continue processing
                    orderProcessor.ContinueNow = true;
                }
                else
                {
                    // audit
                    orderProcessor.CreateAudit(
                        "Funds not available for purchase.", 20103);
                    // mail admin

                    orderProcessor.MailAdmin("Credit card declined.",
                                             "XML data exchanged:\n" + request.Xml + "\n\n"
                                             + response.Xml, 1);
                }
            }
            catch
            {
                // fund checking failure
                throw new OrderProcessorException(
                          "Error occured while checking funds.", 1);
            }
            // audit
            processor.CreateAudit("PSCheckFunds finished.", 20101);
        }