Code Monkey home page Code Monkey logo

google-checkout-java-sample-code's People

Contributors

jasona7 avatar

google-checkout-java-sample-code's Issues

bug in parameterized-url xml

My code looks like:
----
final CheckoutShoppingCartRequest checkoutCart =
  new CheckoutShoppingCartRequest(getConstants(request));

// code populating shopping cart

final Collection<UrlParameter> parameters = new
ArrayList<UrlParameter>(params.size());
for (final Param param : params)
{
  parameters.add(new UrlParameter(param.getName(),
    param.getParameter().googleCheckoutParameterType));
}
checkoutCart.addParameterizedUrl(url, false, parameters);
----

And the xml that results is:
----
<parameterized-urls>
<parameterized-url
url="https://www.linkconnector.com/traffic_merchant.php?lc=000069"><parameters><
url-parameter
name="oid" type="order-id"/></parameters><parameters><url-parameter
name="amt"
type="order-total"/></parameters></parameterized-url></parameterized-urls>
----

This is clearly wrong.  I don't want two <parameters> blocks with one
<url-parameter> in each.  I want one <parameters> block with both
parameters in it.

I hope this is cleared up soon.

Cheers,
Erik

P.S.  If you care, the error that Google gives back is:
--
XML failed to validate against the schema at line: 1, column: 1, with
error: cvc-complex-type.2.4.d: Invalid content was found starting with
element 'parameters'. No child element is expected at this point.
--

Original issue reported on code.google.com by [email protected] on 4 Jun 2007 at 8:44

Domain objects for notification

The Google Checkout API doesn't define the domain objects that correspond
to the XML documents.  That is, it would be very helpful to have a
NewOrderNotification object that has a getBuyerId(), a getGoogleOrderId(),
etc.  

It'd be nice if the notification processors returned these objects
(possibly related to issue 1?), but anywhere is good, as long as I can
verify that the XML gets turned into an object for use elsewhere.

Original issue reported on code.google.com by [email protected] on 25 Apr 2007 at 11:48

You have tried to post a cart with an unknown Country Code: BQ

What steps will reproduce the problem?
1. Try to get checkout redirect url using java
2. Add all country code with tax percentage


What is the expected output? What do you see instead?
Expected response is checkout redirect url. But, throw the exception 'You have 
tried to post a cart with an unknown Country Code: BQ'

What version of the product are you using? On what operating system?
Version 2.5 and Windows XP

Please provide any additional information below.
The country code 'BQ' is in your recommended country list. 
http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en
1.html


Original issue reported on code.google.com by [email protected] on 28 Mar 2011 at 6:03

MerchantConstantsFactory

What steps will reproduce the problem?
1. Deploy War "JavaCheckoutWebExampleWar.war"
2. try to open http://localhost:8080/JavaCheckoutWebExampleWar/
3.

What is the expected output?

It should display ShopingCart.jps

What do you see instead?

Error 500 
org.apache.jasper.JasperException: No se puede compilar la clase para JSP: 

Ha tenido lugar un error en la l�nea: 48 en el archivo jsp:
/shopping_cart.jsp
The constructor CheckoutShoppingCartRequest(MerchantConstants) is undefined
45:     String redirectUrl = null;
46:     
47:   if (button == null || button.equals("")) {
48:       cart = new CheckoutShoppingCartRequest(mc);
49:       session.setAttribute("cart", cart);
50:       prettyXml = cart.getXmlPretty();
51:       responseXml = "";


Ha tenido lugar un error en la l�nea: 55 en el archivo jsp:
/shopping_cart.jsp
The constructor CheckoutShoppingCartRequest(MerchantConstants) is undefined
52:       redirectUrl = "";  
53:   }
54:   else if (button.equals("NewCart")) {
55:       cart = new CheckoutShoppingCartRequest(mc);
56:       session.setAttribute("cart", cart);
57:       
58:       prettyXml = cart.getXmlPretty();




What version of the product are you using? On what operating system?


Please provide any additional information below.

At first Time the error 500 was caused by there is no
MerchantConstanstsFactory Class. Cos there's no package
com.google.checkout.example, so I tryed to create it but i think libs that
i Used to create it there are no a compatible version:

/*******************************************************************************
 * Copyright (C) 2007 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a
copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
under
 * the License.
 ******************************************************************************/

package com.google.checkout;

import com.google.checkout.util.Base64Coder;

/**
 * This class encapsulates the various merchant specific settings. An instance
 * of this class will be required by most of the other classes in order to
 * properly parameterise the API requests.
 *
 * @author simonjsmith
 */
public class MerchantConstants {

        private String merchantId;

        private String merchantKey;

        private String env;

        private String currencyCode;

        private String checkoutUrl;

        private String merchantCheckoutUrl;

        private String requestUrl;

        /**
         * The constructor.
         *
         * @param merchantId
         *            The Merchant Id.
         * @param merchantKey
         *            The Merchant Key.
         * @param env
         *            The Environment Type.
         * @param currencyCode
         *            The Currency Code.
         * @param checkoutUrl
         *            The Checkout Url
         * @param merchantCheckoutUrl
         *            The Merchant Checkout Url
         * @param requestUrl
         *            The Request Url
         */
        public MerchantConstants(String merchantId, String merchantKey,
String env,
                        String currencyCode, String checkoutUrl,
                        String merchantCheckoutUrl, String requestUrl) {
                this.merchantId = merchantId;
                this.merchantKey = merchantKey;
                this.env = env;
                this.currencyCode = currencyCode;
                this.checkoutUrl = checkoutUrl;
                this.merchantCheckoutUrl = merchantCheckoutUrl;
                this.requestUrl = requestUrl;
        }

        /**
         * Return the Currency Code.
         *
         * @return The Currency Code.
         */
        public String getCurrencyCode() {
                return this.currencyCode;
        }

        /**
         * Return the Environment Type value.
         *
         * @return The Environment Type.
         *
         * @see EnvironmentType
         */
        public String getEnv() {
                return this.env;
        }

        /**
         * Return the Merchant Id.
         *
         * @return The Merchant Id.
         */
        public String getMerchantId() {
                return this.merchantId;
        }

        /**
         * Return the Merchant Key.
         *
         * @return The Merchant Key.
         */
        public String getMerchantKey() {
                return this.merchantKey;
        }

        /**
         * Set the Currency Code.
         *
         * @param currencyCode
         *            The Currency Code.
         */
        public void setCurrencyCode(String currencyCode) {
                this.currencyCode = currencyCode;

        }

        /**
         * Set the Environment Type value.
         *
         * @param env
         *            The Environment Type.
         *
         * @see EnvironmentType
         */
        public void setEnv(String env) {
                this.env = env;

        }

        /**
         * Set the Merchant Id.
         *
         * @param merchantId
         *            The Merchant Id.
         */
        public void setMerchantId(String merchantId) {
                this.merchantId = merchantId;

        }

        /**
         * Set the Merchant Key.
         *
         * @param merchantKey
         *            The Merchant Key.
         */
        public void setMerchantKey(String merchantKey) {
                this.merchantKey = merchantKey;

        }

        /**
         * Return the Checkout URL.
         *
         * @return The Checkout URL.
         */
        public String getCheckoutUrl() {
                return checkoutUrl;
        }

        /**
         * Return the Request URL.
         *
         * @return The Request URL.
         */
        public String getRequestUrl() {
                return requestUrl;
        }

        /**
         * Return the HTTP Auth value.
         *
         * @return The HTTP Auth value.
         */
        public String getHttpAuth() {
                return Base64Coder.encode(new
StringBuffer(getMerchantId()).append(":")
                                .append(getMerchantKey()).toString());
        }

        /**
         * Return the Merchant Checkout URL.
         *
         * @return The Checkout URL.
         */
        public String getMerchantCheckoutUrl() {
                return merchantCheckoutUrl;
        }

        /**
         * Set the Merchant Checkout URL.
         *
         * @param merchantCheckoutUrl
         *            The Merchant Checkout URL.
         */
        public void setMerchantCheckoutUrl(String merchantCheckoutUrl) {
                this.merchantCheckoutUrl = merchantCheckoutUrl;
        }

        /**
         * Set the Checkout URL.
         *
         * @param checkoutUrl
         *            The Checkout URL.
         */
        public void setCheckoutUrl(String checkoutUrl) {
                this.checkoutUrl = checkoutUrl;
        }

        /**
         * Set the Request URL.
         *
         * @param requestUrl
         *            The Checkout URL.
         */
        public void setRequestUrl(String requestUrl) {
                this.requestUrl = requestUrl;
        }

}



And this is my MerchantConstantsFactory.java class

package com.google.checkout.example;

import com.google.checkout.MerchantConstants;

public class MerchantConstantsFactory {

    public static MerchantConstants getMerchantConstants(){
        MerchantConstants mc=new
MerchantConstants("11453453454","XXXXXXXXXXXXXXXXXX","","USD","","https://sandbo
x.google.com/checkout/api/checkout/v2/merchantCheckout/Merchant/11453453454","")
;
        return mc;
    }
}

I would like if you can help me and give me some mor information Thank you,
very much.



Original issue reported on code.google.com by [email protected] on 16 Jun 2009 at 8:06

Utils methods do not need document as first parameter

In many cases, the Utils class passes the Document explicitly:

findElementElseCreateAndSet(Document document, Element parent, String
child, String value);

You can use this idiom instead:

Document document = parent.getOwnerDocument();

Original issue reported on code.google.com by [email protected] on 30 Apr 2007 at 8:31

Examples do not work

What steps will reproduce the problem?
1. Download example war
2. Deploy in tomcat
3. Click on any link on the app

What is the expected output? What do you see instead?
JSP compilation exceptions, MerchantConstantFactory not found


What version of the product are you using? On what operating system?
0.91, Windows Vista


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 12 Sep 2008 at 2:45

Sandbox URL hardcoded in DeliverOrderRequest.java

What steps will reproduce the problem?
1. Change environment to Production
2. Try to send a DeliverOrder Request


What is the expected output? What do you see instead?
Delivers order,

Error merchant not found

What version of the product are you using? On what operating system?
JavaCheckoutRefImpl-0.7.zip

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 25 Jul 2007 at 6:41

Utils does preorder traversal for elements

Throughout the code, the Utils class uses 

parent.getElementsByTagName(child);

This method will do a preorder traversal to get all the descendent elements
that might have this name.  If you're doing this from the root, this is
inefficient (and potentially dangerous if you have a repeating element such
as "<name>" in one of the private sections).

In most cases, the code should only search its immediate child elements for
something with that name.

Original issue reported on code.google.com by [email protected] on 30 Apr 2007 at 8:27

Utils.getElementStringValue is not comprehensive

getElementStringValue uses the following code to return a String: 

  return nl.item(0).getFirstChild().getNodeValue();     

This does not cover the case where you have a mix of text and CDATA nodes.

A better solution is to iterate over the children and append CATA and text
nodes into a stringbuffer.

Original issue reported on code.google.com by [email protected] on 30 Apr 2007 at 8:35

SimpleDateFormat is not threadsafe

In the 0.2 version of JavaCheckoutRefImpl.jar, the
com.google.checkout.impl.util.Utils class uses SimpleDateFormat as a static
variable, and in static methods.  The formatter gets used by the
Notification Servlet, which is multi-threaded, so there is the possibility
of something bad happening here.

Original issue reported on code.google.com by [email protected] on 25 Apr 2007 at 12:37

Utils.getElements() throws Exception when not all subChildren are Elements

What steps will reproduce the problem?
1. While processing a checkout-shopping-cart XML notification
2.
Element shoppingCartElement = Utils.findElementOrContainer(document, 
document.getDocumentElement(), "shopping-cart");
Element itemsElement = Utils.findElementOrContainer(document, 
shoppingCartElement, "items");
Element[] childElements = Utils.findElements(document,itemsElement);

What is the expected output? What do you see instead?

Attempted to get item list from checkout-shopping-cart notification, but 
Utils.getElements() throws class cast exception on non-element items.

What version of the product are you using? On what operating system?

Using version JavaCheckoutRefImpl-0.2
Java 1.6 on Windows Vista

Please provide any additional information below.

See d.patterson comment on http://forum.java.sun.com/thread.jspa?
threadID=226630&messageID=4359876

Fix:

NodeList nl = itemsElement.getChildNodes();
ArrayList<Element> childNodes = new ArrayList<Element>();
   for(int i=0; i<nl.getLength(); i++ ) {
      Node node = nl.item(i);
      if(node instanceof Element) { // need to do test to see if just 
string with return character
      Element test = (Element)node;
      childNodes.add(test);
   }
}
Element[] elements = childNodes.toArray(new Element[childNodes.size()]);

Original issue reported on code.google.com by [email protected] on 27 Apr 2007 at 12:36

Utils should not swallow exceptions

There are places in Utils where this idiom is used:

try {
  return xml.doStuff();
} catch (SomeKindOfException e) {
  e.printStackTrace();
}

return null;

This means that if there's an exception in the XML, it can't be logged or
dealt with, since that exception never makes it out of the method.  I'd
prefer that the exception simply be thrown or wrapped in a generic
UtilException class.

Original issue reported on code.google.com by [email protected] on 25 Apr 2007 at 1:06

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.