public void Process(OrderProcessor processor)
 {
     // set processor reference
       orderProcessor = processor;
       // audit
       orderProcessor.CreateAudit("PSFinalNotification started.",
     20700);
       try
       {
     // send mail to customer
     orderProcessor.MailCustomer("BalloonShop order dispatched.",
       GetMailBody());
     // audit
     orderProcessor.CreateAudit(
       "Dispatch e-mail sent to customer.", 20702);
     // update order status
     orderProcessor.Order.UpdateStatus(8);
       }
       catch
       {
     // mail sending failure
     throw new OrderProcessorException(
       "Unable to send e-mail to customer.", 7);
       }
       // audit
       processor.CreateAudit("PSFinalNotification finished.", 20701);
 }
Exemplo n.º 2
0
        public void Process(OrderProcessor processor)
        {
            // set processor reference
            orderProcessor = processor;
            // audit
            orderProcessor.CreateAudit("PSCheckFunds started.", 20100);

            try
            {
                // check customer funds
                // assume they exist for now
                // set order authorization code and reference
                orderProcessor.Order.SetAuthCodeAndReference("AuthCode",
                                                             "Reference");

                // audit
                orderProcessor.CreateAudit("Funds available for purchase.",
                                           20102);
                // update order status
                orderProcessor.Order.UpdateStatus(2);
                // continue processing
                orderProcessor.ContinueNow = true;
            }

            catch
            {
                // fund checking failure
                throw new OrderProcessorException(
                          "Error occured while checking funds.", 1);
            }
            // audit
            processor.CreateAudit("PSCheckFunds finished.", 20101);
        }
Exemplo n.º 3
0
 public void Process(OrderProcessor processor)
 {
     // set processor reference
       orderProcessor = processor;
       // audit
       orderProcessor.CreateAudit("PSShipGoods started.", 20500);
       try
       {
     // send mail to supplier
     orderProcessor.MailSupplier("BalloonShop ship goods.",
       GetMailBody());
     // audit
     orderProcessor.CreateAudit(
       "Ship goods e-mail sent to supplier.", 20502);
     // update order status
     orderProcessor.Order.UpdateStatus(6);
       }
       catch
       {
     // mail sending failure
     throw new OrderProcessorException(
       "Unable to send e-mail to supplier.", 5);
       }
       // audit
       processor.CreateAudit("PSShipGoods finished.", 20501);
 }
Exemplo n.º 4
0
 public void Process(OrderProcessor processor)
 {
     // set processor reference
     orderProcessor = processor;
     // audit
     orderProcessor.CreateAudit("PSShipGoods started.", 20500);
     try
     {
         // send mail to supplier
         orderProcessor.MailSupplier("BalloonShop ship goods.",
                                     GetMailBody());
         // audit
         orderProcessor.CreateAudit(
             "Ship goods e-mail sent to supplier.", 20502);
         // update order status
         orderProcessor.Order.UpdateStatus(6);
     }
     catch
     {
         // mail sending failure
         throw new OrderProcessorException(
                   "Unable to send e-mail to supplier.", 5);
     }
     // audit
     processor.CreateAudit("PSShipGoods finished.", 20501);
 }
        public void Process(OrderProcessor processor)
        {
            // set processor reference
              orderProcessor = processor;
              // audit
              orderProcessor.CreateAudit("PSInitialNotification started.",
            20000);

              try
              {
            // send mail to customer
            orderProcessor.MailCustomer("BalloonShop order received.",
              GetMailBody());
            // audit
            orderProcessor.CreateAudit(
              "Notification e-mail sent to customer.", 20002);
            // update order status
            orderProcessor.Order.UpdateStatus(1);
            // continue processing
            orderProcessor.ContinueNow = true;
              }
              catch
              {
            // mail sending failure
            throw new OrderProcessorException(
              "Unable to send e-mail to customer.", 0);
              }
              // audit
              processor.CreateAudit("PSInitialNotification finished.", 20001);
        }
 public void Process(OrderProcessor processor)
 {
     // set processor reference
     orderProcessor = processor;
     // audit
     orderProcessor.CreateAudit("PSTakePayment started.", 20400);
     try
     {
         // take customer funds
         // assume success for now
         // audit
         orderProcessor.CreateAudit(
             "Funds deducted from customer credit card account.",
             20402);
         // update order status
         orderProcessor.Order.UpdateStatus(5);
         // continue processing
         orderProcessor.ContinueNow = true;
     }
     catch
     {
         // fund checking failure
         throw new OrderProcessorException(
                   "Error occured while taking payment.", 4);
     }
     // audit
     processor.CreateAudit("PSTakePayment finished.", 20401);
 }
Exemplo n.º 7
0
        public void Process(OrderProcessor processor)
        {
            // set processor reference
              orderProcessor = processor;
              // audit
              orderProcessor.CreateAudit("PSCheckStock started.", 20200);

              try
              {
            // send mail to supplier
            orderProcessor.MailSupplier("BalloonShop stock check.",
              GetMailBody());
            // audit
            orderProcessor.CreateAudit(
              "Notification e-mail sent to supplier.", 20202);
            // update order status
            orderProcessor.Order.UpdateStatus(3);
              }
              catch
              {
            // mail sending failure
            throw new OrderProcessorException(
              "Unable to send e-mail to supplier.", 2);
              }
              // audit
              processor.CreateAudit("PSCheckStock finished.", 20201);
        }
 // continue order processing
 protected void processOrderButton_Click(object sender, EventArgs e)
 {
     string orderId = Session["AdminOrderID"].ToString();
     OrderProcessor processor = new OrderProcessor(orderId);
     processor.Process();
     PopulateControls();
 }
Exemplo n.º 9
0
 // continue order processing
 protected void processOrderButton_Click(object sender, EventArgs e)
 {
     string orderId = Request.QueryString["OrderID"];
     OrderProcessor processor = new OrderProcessor(orderId);
     processor.Process();
     PopulateControls(orderId);
 }
Exemplo n.º 10
0
    protected void placeOrderButton_Click(object sender, EventArgs e)
    {
        // Store the total amount
        decimal amount = ShoppingCartAccess.GetTotalAmount();
        // Get shipping ID or default to 0
        int shippingId = 0;
        int.TryParse(shippingSelection.SelectedValue, out shippingId);

        // Get tax ID or default to "No tax"
        string shippingRegion =
          (HttpContext.Current.Profile as ProfileCommon).ShippingRegion;
        int taxId;
        switch (shippingRegion)
        {
          case "2":
        taxId = 1;
        break;
          default:
        taxId = 2;
        break;
        }

        // Create the order and store the order ID
        string orderId = ShoppingCartAccess.CreateCommerceLibOrder(shippingId, taxId);
        // Process order
        OrderProcessor processor = new OrderProcessor(orderId);
        processor.Process();
        // Redirect to the conformation page
        Response.Redirect("OrderPlaced.aspx");
    }
Exemplo n.º 11
0
        public void Process(OrderProcessor processor)
        {
            // set processor reference
              orderProcessor = processor;
              // audit
              orderProcessor.CreateAudit("PSCheckFunds started.", 20100);

              try
              {
            // check customer funds
            // assume they exist for now
            // set order authorization code and reference
            orderProcessor.Order.SetAuthCodeAndReference("AuthCode",
              "Reference");

            // audit
            orderProcessor.CreateAudit("Funds available for purchase.",
              20102);
            // update order status
            orderProcessor.Order.UpdateStatus(2);
            // continue processing
            orderProcessor.ContinueNow = true;
              }

              catch
              {
            // fund checking failure
            throw new OrderProcessorException(
              "Error occured while checking funds.", 1);
              }
              // audit
              processor.CreateAudit("PSCheckFunds finished.", 20101);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
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);
 }
Exemplo n.º 15
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);
 }
 public void Process(OrderProcessor processor)
 {
     // set processor reference
     orderProcessor = processor;
     // audit
     orderProcessor.CreateAudit("PSStockOK started.", 20300);
     // the method is called when the supplier confirms that stock is
     // available, so we don't have to do anything here except audit
     orderProcessor.CreateAudit("Stock confirmed by supplier.",
                                20302);
     // update order status
     orderProcessor.Order.UpdateStatus(4);
     // continue processing
     orderProcessor.ContinueNow = true;
     // audit
     processor.CreateAudit("PSStockOK finished.", 20301);
 }
Exemplo n.º 17
0
 public void Process(OrderProcessor processor)
 {
     // set processor reference
       orderProcessor = processor;
       // audit
       orderProcessor.CreateAudit("PSStockOK started.", 20300);
       // the method is called when the supplier confirms that stock is
       // available, so we don't have to do anything here except audit
       orderProcessor.CreateAudit("Stock confirmed by supplier.",
     20302);
       // update order status
       orderProcessor.Order.UpdateStatus(4);
       // continue processing
       orderProcessor.ContinueNow = true;
       // audit
       processor.CreateAudit("PSStockOK finished.", 20301);
 }
 public void Process(OrderProcessor processor)
 {
     // set processor reference
     orderProcessor = processor;
     // audit
     orderProcessor.CreateAudit("PSShipOK started.", 20600);
     // set order shipment date
     orderProcessor.Order.SetDateShipped();
     // audit
     orderProcessor.CreateAudit("Order dispatched by supplier.",
                                20602);
     // update order status
     orderProcessor.Order.UpdateStatus(7);
     // continue processing
     orderProcessor.ContinueNow = true;
     // audit
     processor.CreateAudit("PSShipOK finished.", 20601);
 }
Exemplo n.º 19
0
 public void Process(OrderProcessor processor)
 {
     // set processor reference
       orderProcessor = processor;
       // audit
       orderProcessor.CreateAudit("PSShipOK started.", 20600);
       // set order shipment date
       orderProcessor.Order.SetDateShipped();
       // audit
       orderProcessor.CreateAudit("Order dispatched by supplier.",
     20602);
       // update order status
       orderProcessor.Order.UpdateStatus(7);
       // continue processing
       orderProcessor.ContinueNow = true;
       // audit
       processor.CreateAudit("PSShipOK finished.", 20601);
 }
Exemplo n.º 20
0
    protected void processButton_Click(object sender, EventArgs e)
    {
        try
        {
          OrderProcessor processor = new OrderProcessor(orderIDBox.Text);
          processor.Process();
          CommerceLibOrderInfo orderInfo =
        CommerceLibAccess.GetOrder(orderIDBox.Text);
          processResultLabel.Text = "Order processed, status now: "
        + orderInfo.Status.ToString();
        }

        catch
        {
          CommerceLibOrderInfo orderInfo =
        CommerceLibAccess.GetOrder(orderIDBox.Text);
          processResultLabel.Text =
        "Order processing error, status now: "
        + orderInfo.Status.ToString();
        }
    }
Exemplo n.º 21
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);
 }
Exemplo n.º 22
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 =
                    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);
        }