|
Hello, I desparately try to make paypal plugin work. Whenever I click Buy Now button I get this error:
Error 500: Executing action [buy] of controller [org.grails.paypal.PaypalController] in plugin [paypal] caused exception: null with this stacktrace: java.lang.NullPointerException at org.grails.paypal.PaypalController$_closure4.doCall(PaypalController.groovy:191) at org.grails.paypal.PaypalController$_closure4.doCall(PaypalController.groovy) at java.lang.Thread.run(Thread.java:662) I saw the following post here The reason for the NPE is a missing value for params.originalURL which can be set as an attribute with the paypal:button So, I added originalURL="https://www.sandbox.paypal.com/cgi-bin/webscr" to paypal:button. Now the button click takes me to the mentioned website but this doesn't send the item params to Paypal, so one cannot buy it. I've spent hours trying to fix this, so, help me, please, if you can, it really upsets me :( Thanks and regards, David. |
|
I am using grails 1.3.7 because paypal plugin has compilation issues with grails 2.0.
|
|
I have this inside my grails 1.3.7 app and it works for me.
<paypal:button itemName="${item.name}"
originalURL="${grailsApplication.config.grails.serverURL}"
itemNumber="${item.id}" amount="${item.shoppingCart.getTotalAmount()}"
discountAmount="0"
buyerId="${sec.loggedInUserInfo(field:'id')}"/>
On Thu, Feb 2, 2012 at 11:49 AM, armenian <[hidden email]> wrote: I am using grails 1.3.7 because paypal plugin has compilation issues with Regards Gaurav Chauhan Contact No : +91-95607-66664 Skype : chauhan.gaurav Website : JellyFish Technologies
|
|
Hello Gaurav! Thanks a lot for your answer. This is the paypal tag I use in gsp file:
<paypal:button itemName="some item" originalURL="${grailsApplication.config.grails.serverURL}" itemNumber="IPD0843403" amount="99.00" buyerId="user" /> I set the originalURL like you, but now the paypal button click takes me back to my application's home page as I set grails.serverURL = "<my-public-ip-address>/${appName}" in Config.groovy like plugin's description points out. I appreciate your help very much and will be grateful to receive any suggestions from you. Thanks and regards, David. |
|
Hello community. Point out my mistake, please, please.
|
|
The plugin page says that itemName, itemNumber, amount and discountAmount are required. Are you sure that the npe is caused by the serverURL param? Also do you have all the params required on Config.groovy? On Feb 5, 2012, at 1:41 AM, armenian wrote:
|
|
Hello and thanks for the response! These are the params from Config.groovy:
grails.paypal.server = "https://www.sandbox.paypal.com/cgi-bin/webscr" grails.paypal.email = "xxxxx_1275061677_biz@gmail.com" grails.serverURL = "http://99.99.99.99:8080/ppal" I tested my public IP address. My app can be reached with this Ip address. This is my paypal button with discountAmount: <paypal:button itemName="some item" originalURL="${grailsApplication.config.grails.serverURL}" itemNumber="IPD0843403" amount="99.00" discountAmount="0" buyerId="user" /> This is my PpalFilters.groovy in conf directory: class PpalFilters { def filters = { paymentReceivedFilter(controller: 'paypal', action: 'notify') { after = { def payment = request.payment if (payment && payment.status == org.grails.paypal.Payment.COMPLETE) { def userId = payment.buyerId def productId = payment.paymentItems[0].itemNumber.toLong() new ppal.IPod(userId, productId).save() } } } } } And I also have the ppal.IPod domain class with userId, productId fields. Instead of paypal website, Paypal button click takes me back to the serverURL, i.e. http://99.99.99.99:8080/ppal I need your help, please. Redards, David |
|
Try grails.paypal.serverURL instead of grails.serverURL. I changed to it (don't remeber why), try debugging and see what values are being passed on to the paypal controller inside the plugin -> .grails/version_number/projects/your_project/plugins/paypal-xxx/etc...
On Feb 5, 2012, at 6:24 PM, armenian wrote: > Hello and thanks for the response! These are the params from Config.groovy: > > /grails.paypal.server = "https://www.sandbox.paypal.com/cgi-bin/webscr" > grails.paypal.email = "[hidden email]" > grails.serverURL = "http://99.99.99.99:8080/ppal"/ > > I tested my public IP address. My app can be reached with this Ip address. > This is my paypal button with discountAmount: > > <paypal:button > itemName="some item" > originalURL="${grailsApplication.config.grails.serverURL}" > itemNumber="IPD0843403" > amount="99.00" > discountAmount="0" > buyerId="user" > /> > > This is my PpalFilters.groovy in conf directory: > > class PpalFilters { > > def filters = { > paymentReceivedFilter(controller: 'paypal', action: 'notify') { > after = { > def payment = request.payment > if (payment && payment.status == > org.grails.paypal.Payment.COMPLETE) { > def userId = payment.buyerId > def productId = > payment.paymentItems[0].itemNumber.toLong() > > new ppal.IPod(userId, productId).save() > } > } > } > } > > } > And I also have the ppal.IPod domain class with /userId, productId/ fields. > Instead of paypal website, Paypal button click takes me back to the > /serverURL/, i.e. /http://99.99.99.99:8080/ppal/ > I need your help, please. > Redards, > David > > -- > View this message in context: http://grails.1312388.n4.nabble.com/help-with-paypal-plugin-please-tp4349099p4358650.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hello Akira! I got npe when I changed grails.serverURL to grails.paypal.serverURL.
I added log4j{ ....... root { debug() } in Config.groovy, but it didn't show me what values are being passed on to the paypal controller . Can you bring the configurations that worked for you, please? Also, maybe you wrote some tests for paypal plugin integration. If this is the case, can you share it? |
|
To get the values being passed go to the .grails folder -> 1.3.x -> projects -> your_project -> plugins -> paypal-xxx -> grails-app -> controllers -> domain -> PaypalController.groovy
On Feb 6, 2012, at 7:30 PM, armenian wrote: > Hello Akira! I got npe when I changed grails.serverURL to > grails.paypal.serverURL. > I added > /log4j{ > ....... > root { > debug() > } > / > in Config.groovy, but it didn't show me what values are being passed on to > the paypal controller . > Can you bring the configurations that worked for you, please? > Also, maybe you wrote some tests for paypal plugin integration. If this is > the case, can you share it? > > -- > View this message in context: http://grails.1312388.n4.nabble.com/help-with-paypal-plugin-please-tp4349099p4360858.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hello. I checked the PaypalController.groovy and the only parameter that seems not being passed on is "quantity". I added quantity="1" in paypal:button but it didn't give results. These are the params being passed I got using "println params" in PpalFilters.groovy
[amount:99.00, itemName:iPod Nano, tax:0.0, submit.y:4, submit:[y:4, x:85], submit.x:85, originalURL:http://173.240.34.79:8080/ppal, itemNumber:IPD0843403, buyerId:user, discountAmount:0, currency:USD, action:buy, controller:paypal] Something is missing, right? I still need support. Thanks and regards, David |
|
Hi David, your problem was clicking the button wasn't going to paypal site right? Well, use println to see what value is configured for the $url and what action is being called, you can check the paypal button tags (inside the .grails -> ......... taglib folder) and printout the values too.
On Feb 7, 2012, at 1:31 AM, armenian wrote: > Hello. I checked the PaypalController.groovy and the only parameter that > seems not being passed on is "quantity". I added quantity="1" in > paypal:button but it didn't give results. These are the params being passed > I got using "println params" in PpalFilters.groovy > /[amount:99.00, itemName:iPod Nano, tax:0.0, submit.y:4, submit:[y:4, x:85], > submit.x:85, originalURL:http://173.240.34.79:8080/ppal, > itemNumber:IPD0843403, buyerId:user, discountAmount:0, currency:USD, > action:buy, controller:paypal]/ > Something is missing, right? > I still need support. > Thanks and regards, > David > > -- > View this message in context: http://grails.1312388.n4.nabble.com/help-with-paypal-plugin-please-tp4349099p4361816.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi! There is an "if-else" statement in PaypalController.groovy:
if (payment?.validate()) {...} else { flash.payment = payment redirect(url: params.originalURL) } I think I always go with 'else' branch that is why params are not being passed on to paypal website so println $url displays nothing. I can't grasp what does payment?.validate() check. How to fulfill it? Thanks for your patience. Best Regards, David. |
|
http://grails.org/doc/1.3.7/ref/Domain%20Classes/validate.html
When you hit the paypal button, it creates a record on the payment domain, check the record values on your db, you can get the id by printing params.transactionId Put a println on the else to see what errors are being rejected (inject messageSource on the controller) http://johnrellis.blogspot.com/2010/02/retrieve-grails-domain-errors-from.html payment.errors.allErrors.each { println messageSource.getMessage(it, null) } On Feb 7, 2012, at 3:37 PM, armenian wrote: > Hi! There is an "if-else" statement in PaypalController.groovy: > / if (payment?.validate()) {...} > else { > flash.payment = payment > redirect(url: params.originalURL) > }/ > I think I always go with 'else' branch that is why params are not being > passed on to paypal website so /println $url/ displays nothing. > I can't grasp what does /payment?.validate()/ check. How to fulfill it? > Thanks for your patience. > Best Regards, > David. > > -- > View this message in context: http://grails.1312388.n4.nabble.com/help-with-paypal-plugin-please-tp4349099p4363908.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Dear Akira, I want to express my gratitude for your support. This was of big importance for me and I really appreciate your help. I injected messageSource on the controller(I learned to do it thanks to your links) and found out the problem. This is the error message I got and corrected:
Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Long' for property 'buyerId'; nested exception is java.lang.IllegalArgum entException: Could not parse number: Unparseable number: "user" Also thanks to Gaurav Chauhan. Warm regards and best wishes, David. |
|
Hello. One more question, please. How can I customize the page that displays the response from paypal in case of successful or failed transaction?
Regards, David. |
| Powered by Nabble | Edit this page |
