The new Pay Now feature in customer My Orders listing looks good.
However there are 2 serious problems with the drop-down box,
Looking again at the paypal plugin, for example, found a couple of further issues (which I suppose could be irrelevant in amyn cases, but would be good to see fixed in the generic versions).
(a) It lists all payment methods defined in the payment table, including those which are disabled in the administration screen.
(b) It does not call the payment method onPaymentDisplay() function with the result that it displays all payment methods including those which are not valid in the context of the current order.
(c) Looking at the paypal onPaymentDisplay() function it does not check the enabled[/] flag.
This seems to be a generic problem of all the payment plug-ins.
The latest version of my own paypal plug-in onPaymentDisplay() function now looks like this (also showing call to my routine to check if paypal is compatible with selected shipping method):
function onPaymentDisplay(&$order,&$methods,&$usable_methods){
if (!$this->isShippingValid(@$order->shipping)) return false;
if (empty($order->total)) return false;
if (empty($methods)) return false;
$found = false;
foreach($methods as $method){
if($method->payment_type!='bf_paypal'){
continue;
}
if (!$method->enabled) {
continue;
}
if(empty($order->total)){
continue;
}
if(!empty($method->payment_zone_namekey)){
$zoneClass=hikashop::get('class.zone');
$zones = $zoneClass->getOrderZones($order);
if(!in_array($method->payment_zone_namekey,$zones)){
continue;
}
}
$currencyClass = hikashop::get('class.currency');
$null=null;
$currency_id = intval(@$order->total->prices[0]->price_currency_id);
$currency = $currencyClass->getCurrencies($currency_id,$null);
if(!empty($currency) && !in_array(@$currency[$currency_id]->currency_code,$this->accepted_currencies)){
continue;
}
$usable_methods[$method->ordering]=$method;
$found = true;
}
return $found;
}
(d) The paypal onPaymentSave() function does not check the value returned by the call to onPaymentDisplay(). My own version looks like this:
function onPaymentSave(&$cart,&$rates,&$payment_id){
$usable = array();
if ($this->onPaymentDisplay($cart,$rates,$usable)) {
$payment_id = (int) $payment_id;
foreach($usable as $usable_method){
if($usable_method->payment_id==$payment_id){
return $usable_method;
}
}
}
return false;
}