Hi,

If the request is JSON and you want to send JSON out, you may use stream
builder and formatter for JSON. But this may affect any other scenario
which is not mentioned here.

Thanks.


On Thu, Aug 29, 2013 at 10:57 AM, Ishan Jayawardena <is...@wso2.com> wrote:

> Hi Malaka,
> What formatter and builder are you using? Unless you use the default
> builder, the JSON->XML->JSON conversion must not happen, AFAIU.
> Thanks,
> Ishan.
>
>
> 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/
>>
>
>
>
> --
> Ishan Jayawardena
> Software Engineer
> Mobile: +94 (77) 408 2330
>



-- 
Nalin Chamara
Software Engineer
na...@wso2.com
+94715614756
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to