Пример #1
0
    /// <summary>
    /// Handles the Click event of the SendShippingInfoButton control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void SendShippingInfoButton_Click(object sender, EventArgs e)
    {
        TextBox carrierTB        = (TextBox)LoginView.FindControl("CarrierTextBox");
        TextBox trackingNumberTB = (TextBox)LoginView.FindControl("TrackingNumberTextBox");
        Label   orderNumberLbl   = (Label)LoginView.FindControl("GoogleOrderNumberLabel");
        Panel   shippingPanel    = (Panel)LoginView.FindControl("ShippingPanel");

        GCheckout.OrderProcessing.DeliverOrderRequest deliverReq = new GCheckout.OrderProcessing.DeliverOrderRequest(orderNumberLbl.Text, carrierTB.Text, trackingNumberTB.Text, true);
        deliverReq.Send();
        shippingPanel.Visible = false;
    }
 public void PostUrl()
 {
     DeliverOrderRequest Req;
       // Sandbox.
       Req = new DeliverOrderRequest(MERCHANT_ID, MERCHANT_KEY, "Sandbox", ORDER_NUMBER, false);
       Assert.AreEqual("https://sandbox.google.com/checkout/api/checkout/v2/request/Merchant/" + MERCHANT_ID, Req.GetPostUrl());
       Req = new DeliverOrderRequest(MERCHANT_ID, MERCHANT_KEY, "Production", ORDER_NUMBER, false);
       Assert.AreEqual("https://checkout.google.com/api/checkout/v2/request/Merchant/" + MERCHANT_ID, Req.GetPostUrl());
 }
        public void DeliverOrderRequest()
        {
            DeliverOrderRequest Req;
              DeliverOrderRequest Req2;
              AutoGen.DeliverOrderRequest D;

              // Test the first constructor.
              Req = new DeliverOrderRequest(MERCHANT_ID, MERCHANT_KEY, "Sandbox", ORDER_NUMBER);
              D = ParseDeliverOrderRequest(Req.GetXml());
              Assert.AreEqual(ORDER_NUMBER, D.googleordernumber);
              Assert.AreEqual(false, D.sendemailSpecified);
              Assert.AreEqual(null, D.trackingdata);

              Req2 = new DeliverOrderRequest(ORDER_NUMBER);
              D = ParseDeliverOrderRequest(Req.GetXml());
              Assert.AreEqual(ORDER_NUMBER, D.googleordernumber);
              Assert.AreEqual(false, D.sendemailSpecified);
              Assert.AreEqual(null, D.trackingdata);

              // Test the second constructor.
              Req = new DeliverOrderRequest(MERCHANT_ID, MERCHANT_KEY, "Sandbox", ORDER_NUMBER, "UPS",
            "1234", false);
              D = ParseDeliverOrderRequest(Req.GetXml());
              Assert.AreEqual(ORDER_NUMBER, D.googleordernumber);
              Assert.AreEqual(true, D.sendemailSpecified);
              Assert.AreEqual(false, D.sendemail);
              Assert.AreEqual("UPS", D.trackingdata.carrier);
              Assert.AreEqual("1234", D.trackingdata.trackingnumber);

              Req2 = new DeliverOrderRequest(ORDER_NUMBER, "UPS", "1234", false);
              D = ParseDeliverOrderRequest(Req.GetXml());
              Assert.AreEqual(ORDER_NUMBER, D.googleordernumber);
              Assert.AreEqual(true, D.sendemailSpecified);
              Assert.AreEqual(false, D.sendemail);
              Assert.AreEqual("UPS", D.trackingdata.carrier);
              Assert.AreEqual("1234", D.trackingdata.trackingnumber);

              // Test the third constructor.
              Req = new DeliverOrderRequest(MERCHANT_ID, MERCHANT_KEY, "Sandbox", ORDER_NUMBER, "UPS",
            "1234");
              D = ParseDeliverOrderRequest(Req.GetXml());
              Assert.AreEqual(ORDER_NUMBER, D.googleordernumber);
              Assert.AreEqual(false, D.sendemailSpecified);
              Assert.AreEqual("UPS", D.trackingdata.carrier);
              Assert.AreEqual("1234", D.trackingdata.trackingnumber);

              Req2 = new DeliverOrderRequest(ORDER_NUMBER, "UPS", "1234");
              D = ParseDeliverOrderRequest(Req.GetXml());
              Assert.AreEqual(ORDER_NUMBER, D.googleordernumber);
              Assert.AreEqual(false, D.sendemailSpecified);
              Assert.AreEqual("UPS", D.trackingdata.carrier);
              Assert.AreEqual("1234", D.trackingdata.trackingnumber);

              // Test the fourth constructor.
              Req = new DeliverOrderRequest(MERCHANT_ID, MERCHANT_KEY, "Sandbox", ORDER_NUMBER, false);
              D = ParseDeliverOrderRequest(Req.GetXml());
              Assert.AreEqual(ORDER_NUMBER, D.googleordernumber);
              Assert.AreEqual(true, D.sendemailSpecified);
              Assert.AreEqual(false, D.sendemail);
              Assert.AreEqual(null, D.trackingdata);

              // Test the 8th constructor.
              Req2 = new DeliverOrderRequest(ORDER_NUMBER, false);
              D = ParseDeliverOrderRequest(Req.GetXml());
              Assert.AreEqual(Req2.GoogleOrderNumber, D.googleordernumber);
              Assert.AreEqual(true, D.sendemailSpecified);
              Assert.AreEqual(false, D.sendemail);
              Assert.AreEqual(null, D.trackingdata);
        }