i also have encountered the same issue when single element in the array, in
your case funding_instruments and transactions contain only one element in
array.

Nalin's suggestion would do the needful! Nevertheless other
further operations you do might get failed if you use that!

it can be send as it is if you don't build the message!



On Thu, Aug 29, 2013 at 11:26 AM, Ravi Undupitiya <r...@wso2.com> wrote:

> Maybe you can place another dummy object inside the JSON arrays instead of
> having just one object inside?
> That is not a proper solution, but it may help to find out if this is a
> JSON -> XML -> JSON serialisation issue.
>
>
> On Thu, Aug 29, 2013 at 5:41 AM, Malaka Silva <mal...@wso2.com> wrote:
>
>> Hi,
>>
>> I have the following issue when sending a json.
>>
>> following is the required format
>>
>> {
>>   "intent":"sale",
>>   "payer":{
>>     "payment_method":"credit_card",
>>     "funding_instruments":[
>>       {
>>         "credit_card":{
>>           "number":"4417119669820331",
>>           "type":"visa",
>>           "expire_month":11,
>>           "expire_year":2018,
>>           "cvv2":"874",
>>           "first_name":"Joe",
>>           "last_name":"Shopper",
>>           "billing_address":{
>>             "line1":"52 N Main ST",
>>             "city":"Johnstown",
>>             "country_code":"US",
>>             "postal_code":"43210",
>>             "state":"OH"
>>           }
>>         }
>>       }
>>     ]
>>   },
>>   "transactions":[
>>     {
>>       "amount":{
>>         "total":"7.47",
>>         "currency":"USD",
>>         "details":{
>>           "subtotal":"7.41",
>>           "tax":"0.03",
>>           "shipping":"0.03"
>>         }
>>       },
>>       "description":"This is the payment transaction description."
>>     }
>>   ]
>> }
>>
>> So I set the payload using following configuration
>>
>>          <payloadFactory media-type="json">
>>
>> <format>{"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card":{"number":"4417119669820331","type":"visa","expire_month":11,"expire_year":2018,"cvv2":"874","first_name":"Joe","last_name":"Shopper","billing_address":{"line1":"52
>> N Main
>> ST","city":"Johnstown","country_code":"US","postal_code":"43210","state":"OH"}}}]},"transactions":[{"amount":{"total":"0.47","currency":"USD","details":{"subtotal":"0.41","tax":"0.03","shipping":"0.03"}},"description":"This
>> is the payment transaction description."}]}</format>
>>             <args/>
>>          </payloadFactory>
>>
>>
>> However following is the actual wire log when sending.
>>
>> {"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":{"credit_card":{"number":"4417119669820331","type":"visa","expire_month":"11","expire_year":"2018","cvv2":"874","first_name":"Joe","last_name":"Shopper","billing_address":{"line1":"52
>> N Main
>> ST","city":"Johnstown","country_code":"US","postal_code":"43210","state":"OH"}}}},"transactions":{"amount":{"total":"0.47","currency":"USD","details":{"subtotal":"0.41","tax":"0.03","shipping":"0.03"}},"description":"This
>> is the payment transaction description."}}[\r][\n]"
>>
>>
>> I noticed that the '[' and ']'  are missing when sending to paypal. I
>> guess this is because it transforms the JSON to XML and XML to JSON before
>> sending. It is causing this.
>>
>> Any idea to solve this?
>>
>> thx
>>
>> --
>> Best Regards,
>>
>> Malaka Silva
>> Senior Tech Lead
>> M: +94 777 219 791
>> T: +1 408 754 7388
>> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
>> Blog : http://mrmalakasilva.blogspot.com/
>>
>> WSO2, Inc.
>> lean . enterprise . middleware
>> http://www.wso2.com/
>>
>
>
>
> --
> *Ravi Undupitiya*
> Software Engineer; WSO2 Inc.; http://wso2.com
> *
> *
> *E-mail: r...@wso2.com
> **M: **+94 772 930 712*
> *
> *Lean . Enterprise . Middleware
>



-- 
Sivajothy Vanjikumaran
*Senior Software Engineer*
*Integration Technologies Team*
*WSO2 Inc. http://wso2.com/*
*Mobile:(+94)777219209**
*[image: Facebook] <https://www.facebook.com/vanjikumaran> [image:
Twitter]<https://twitter.com/vanjikumaran> [image:
LinkedIn] <http://www.linkedin.com/pub/vanjikumaran-sivajothy/25/b31/293>
[image:
Blogger] <http://vanjikumaran.blogspot.com/> [image:
SlideShare]<http://www.slideshare.net/vanjikumaran>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to