google-code-export / google-checkout-java-sdk

Automatically exported from code.google.com/p/google-checkout-java-sdk
1 stars 0 forks source link

Multiple merchant private data gets flattened into a single private data element #78

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Post a shopping cart with multiple String elements (count n) in the merchant 
private data list:

public static void 
populateMerchantPrivateData(com.google.checkout.sdk.domain.AnyMultiple 
merchantPrivateData) {
    merchantPrivateData.getContent().clear();
    merchantPrivateData.getContent().add("data1");
    merchantPrivateData.getContent().add("data2");
    merchantPrivateData.getContent().add("data3");
}

2. Receive callback notification upon purchase confirmation and attempt to 
extract n elements of the merchant private data by invoking 

com.google.checkout.sdk.notifications.Notification.getOrderSummary().getShopping
Cart().getMerchantPrivateData().get(0)

up to

com.google.checkout.sdk.notifications.Notification.getOrderSummary().getShopping
Cart().getMerchantPrivateData().get(n-1)

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

Expected: the list contains n elements, indexed between 0 and n-1.

Actual: the list contains only 1 element (index 0), and all the Strings that 
were originally added to the list are "flattened" into the single element, 
separated by a space character.

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

Checkout Java SDK 2.5.1, Windows 7 x86-64, JDK 1.7.0_07 x86-64.

Please provide any additional information below.

The posted XML seems to be already incorrect (private data already flattened):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
    <shopping-cart>
        <merchant-private-data>data1 data2 data3</merchant-private-data>
        <items>
            <item>
                <digital-content>
                    <description>Take digital goods here and there</description>
                    <display-disposition>PESSIMISTIC</display-disposition>
                </digital-content>
                <item-name>Name of item</item-name>
                <item-description>Description of item</item-description>
                <unit-price currency="USD">0.2</unit-price>
                <quantity>1</quantity>
            </item>
        </items>
    </shopping-cart>
    <checkout-flow-support>
        <merchant-checkout-flow-support>
            <continue-shopping-url>http://localhost:8080/myapplication/mypage</continue-shopping-url>
        </merchant-checkout-flow-support>
    </checkout-flow-support>
</checkout-shopping-cart>

And this flattened representation appears in the callback notifications like 
NewOrderNotification etc. too.

I think the XML would be correct this way:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
    <shopping-cart>
        <merchant-private-data>data1</merchant-private-data>
        <merchant-private-data>data2</merchant-private-data>
        <merchant-private-data>data3</merchant-private-data>
        <items>
            <item>
                <digital-content>
                    <description>Take digital goods here and there</description>
                    <display-disposition>PESSIMISTIC</display-disposition>
                </digital-content>
                <item-name>Name of item</item-name>
                <item-description>Description of item</item-description>
                <unit-price currency="USD">0.2</unit-price>
                <quantity>1</quantity>
            </item>
        </items>
    </shopping-cart>
    <checkout-flow-support>
        <merchant-checkout-flow-support>
            <continue-shopping-url>http://localhost:8080/myapplication/mypage</continue-shopping-url>
        </merchant-checkout-flow-support>
    </checkout-flow-support>
</checkout-shopping-cart>

Original issue reported on code.google.com by greyhoun...@gmail.com on 26 Feb 2013 at 12:08