public void SendBuyerMessageRequestTests()
        {
            SendBuyerMessageRequest req = new SendBuyerMessageRequest(ORDER_NUMBER, MESSAGE, true);

            AutoGen.SendBuyerMessageRequest post = EncodeHelper.Deserialize(req.GetXml()) as AutoGen.SendBuyerMessageRequest;

            Assert.AreEqual(req.GoogleOrderNumber, post.googleordernumber);
            Assert.AreEqual(req.Message, post.message);
            Assert.AreEqual(req.SendEmail, true);

            req  = new SendBuyerMessageRequest(MERCHANT_ID, MERCHANT_KEY, "Sandbox", ORDER_NUMBER, MESSAGE, true);
            post = EncodeHelper.Deserialize(req.GetXml()) as AutoGen.SendBuyerMessageRequest;

            Assert.AreEqual(req.GoogleOrderNumber, post.googleordernumber);
            Assert.AreEqual(req.Message, post.message);
            Assert.AreEqual(req.SendEmail, post.sendemail);

            req  = new SendBuyerMessageRequest(ORDER_NUMBER, MESSAGE);
            post = EncodeHelper.Deserialize(req.GetXml()) as AutoGen.SendBuyerMessageRequest;

            Assert.AreEqual(req.GoogleOrderNumber, post.googleordernumber);
            Assert.AreEqual(req.Message, post.message);
            Assert.AreEqual(req.SendEmail, post.sendemail);

            req  = new SendBuyerMessageRequest(MERCHANT_ID, MERCHANT_KEY, "Sandbox", ORDER_NUMBER, MESSAGE);
            post = EncodeHelper.Deserialize(req.GetXml()) as AutoGen.SendBuyerMessageRequest;

            Assert.AreEqual(req.GoogleOrderNumber, post.googleordernumber);
            Assert.AreEqual(req.Message, post.message);
            Assert.AreEqual(req.SendEmail, post.sendemail, "Send Email");
        }
Exemplo n.º 2
0
        public static void SendBuyerMessage(GoogleCheckout instance, string googleOrderNumber, string message, bool sendEmail)
        {
            string env         = instance.UseTestMode ? "Sandbox" : "Production";
            string merchantId  = instance.MerchantID;
            string merchantKey = instance.MerchantKey;

            SendBuyerMessageRequest request = new SendBuyerMessageRequest(merchantId, merchantKey, env, googleOrderNumber, message, sendEmail);

            Util.GCheckoutResponse response = request.Send();

            if (response.IsGood)
            {
                Utility.Logger.Debug("Send Buyer Message Request initiated successfuly. GoogleOrderNumber=" + googleOrderNumber);
            }
            else
            {
                Utility.Logger.Debug("Send Buyer Message Request could not be initiated. ErrorMessage=" + response.ErrorMessage);
            }
        }