The form_set_value() throws error because the #parents isn't set for the $method_element['total'] field. I am not sure what would be the right parent(s), but it seems an empty array() is good enough.

Furthermore the existence of total in $form_state and $form should be checked separately. Currently the validation is unsuccessful and doesn't stops when the form is submitted with a bigger value than the maximum amount setting.

Comments

sgabe’s picture

Status: Active » Needs review
StatusFileSize
new1.02 KB

See the attached patch.

quicksketch’s picture

This doesn't look like it would work. The #parents array determines where in $form_state['values'] the value should be set. With this patch, it doesn't look like any value would be sent to the payment gateway. I'm also not getting this error at all, so I'll need to try and figure out how this is happening in the first place. Perhaps there's a change in the newest version of Pay?

sgabe’s picture

Yeah, I got you. I am not sure either, but I tried to set properly the #parents and I couldn't figure out the right setting. Either the amount validation didn't work or the payment method wasn't executed.

With the empty array() it looks fine. I got the error if the amount is not good and the payment method is executed too. However I am sure that the #parents needs to be set for form_set_value().

I see this is inherited from Pay, I guess I should have ask there first. Feel free to move the issue if you want.

quicksketch’s picture

Status: Needs review » Fixed
StatusFileSize
new3.7 KB

The central issue with this request is that you're using the "Custom payment" gateway which I hadn't extensively tested in any way (I was just testing Credit Card processing). Upon trying out a custom payment I found that there isn't a form element at all for custom payments, so there isn't any need to set a "total" for that form element. When using CC payments, the form element is used to send the value to CC processing gateway. The form-level total is used to store in the Pay module transaction history.

This patch makes several changes that make Webform Pay work better with custom payments, including properly displaying both CC and non-CC submissions, and conditionally setting the total value based on the payment mechanism used. I've committed to CVS. Thanks for your patches sgabe. :)

quicksketch’s picture

Title: For form_set_value() the #parents needs to be defined » Make Webform Pay work properly with the "Custom payment" pay method

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

renesmee’s picture

can anyone tell how to use 'webform pay'? i added the module but payment methods are missing.