by iluber » Mon Feb 22, 2010 10:29 am
I have been solicited by user of the forum, then I post how I have solved the problem
Unfortunately I couldn't follow the path illustrated in the post because of lack of time.
So my solution is not clean as it should be and I have never had the chance to write a patch due to the fact that my repository got broken a few times and I had to restore my working copy which included a lot of changes in many points of OCS code.
What I had done is basically the following.
I didn't add a new configuration option, the user either select the manual or the paypal option.
In the template I have modified the layout so that when paypal payment mode is configured, it shows a radiogroup.
Then the user must choose either one of them.
In the execute method of the UserRegistratioForm I have inserted a call to a new method defined in class PaymentManager
function displayPaymentFormUserChosen($queuedPaymentId, &$queuedPayment, $paymentMethodPluginName) {
$paymentPlugin =& $this->getPaymentPluginByName($paymentMethodPluginName);
if ($paymentPlugin !== null && $paymentPlugin->isConfigured()) return $paymentPlugin->displayPaymentForm($queuedPaymentId, $queuedPayment);
return false;
}
Where the value of the $paymentMethodPluginName parameter is the value passed at form submission by selecting one of the two radios.
In this way the payment method used depends both from the configuration and the user choice.
Ivano Luberti
^^^^^^^^^^^
"If you want total security, go to prison. There you're fed, clothed, given medical care and so on. The only thing lacking is freedom."
Dwight Eisenhower