You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the SagePay Server model has some errors when trying to purchase a recurring profile.
(/catalog/model/extension/payment/sagepay_server.php)
(/catalog/model/payment/sagepay_server.php) for OC < 2.2
PHP Notice: Undefined index: recurring_trial in /catalog/model/payment/sagepay_server.php on line 109
PHP Notice: Undefined index: recurring_price in /catalog/model/payment/sagepay_server.php on line 116
PHP Notice: Undefined index: recurring_cycle in /catalog/model/payment/sagepay_server.php on line 117
PHP Notice: Undefined index: recurring_frequency in /catalog/model/payment/sagepay_server.php on line 117
PHP Notice: Undefined index: recurring_duration in /catalog/model/payment/sagepay_server.php on line 119
It gets its data from system/library/cart.php which has the following for recurring payments:
'recurring_id' => $cart['recurring_id'],
'name' => $recurring_query->row['name'],
'frequency' => $recurring_query->row['frequency'],
'price' => $recurring_query->row['price'],
'cycle' => $recurring_query->row['cycle'],
'duration' => $recurring_query->row['duration'],
'trial' => $recurring_query->row['trial_status'],
'trial_frequency' => $recurring_query->row['trial_frequency'],
'trial_price' => $recurring_query->row['trial_price'],
'trial_cycle' => $recurring_query->row['trial_cycle'],
'trial_duration' => $recurring_query->row['trial_duration']
These don't match the "recurring_" variants listed in the errors above and also the current function is not getting the data from the ['recurring'] array inside $item.
For example
$item['recurring_trial']
should really be
$item['recurring']['trial']
To fix this, the addRecurringPayment function should be as follows :
public function addRecurringPayment($item, $vendor_tx_code) {
$this->load->model('checkout/recurring');
$this->load->language('payment/sagepay_server');
//trial information
if ($item['recurring']['trial'] == 1) {
$trial_amt = $this->currency->format($this->tax->calculate($item['recurring']['trial_price'], $item['tax_class_id'], $this->config->get('config_tax')), false, false, false) * $item['quantity'] . ' ' . $this->currency->getCode();
$trial_text = sprintf($this->language->get('text_trial'), $trial_amt, $item['recurring']['trial_cycle'], $item['recurring']['trial_frequency'], $item['recurring']['trial_duration']);
} else {
$trial_text = '';
}
$recurring_amt = $this->currency->format($this->tax->calculate($item['recurring']['price'], $item['tax_class_id'], $this->config->get('config_tax')), false, false, false) * $item['quantity'] . ' ' . $this->currency->getCode();
$recurring_description = $trial_text . sprintf($this->language->get('text_recurring'), $recurring_amt, $item['recurring']['cycle'], $item['recurring']['frequency']);
if ($item['recurring']['duration'] > 0) {
$recurring_description .= sprintf($this->language->get('text_length'), $item['recurring']['duration']);
}
//create new recurring and set to pending status as no payment has been made yet.
$recurring_id = $this->model_checkout_recurring->create($item, $this->session->data['order_id'], $recurring_description);
$this->model_checkout_recurring->addReference($recurring_id, $vendor_tx_code);
}
Hope this helps :)
The text was updated successfully, but these errors were encountered:
danielkerr
changed the title
SagePay Server Recurring Payment Error
[sagepay server] Recurring Payment Error
Jun 10, 2017
Hi,
the SagePay Server model has some errors when trying to purchase a recurring profile.
(/catalog/model/extension/payment/sagepay_server.php)
(/catalog/model/payment/sagepay_server.php) for OC < 2.2
PHP Notice: Undefined index: recurring_trial in /catalog/model/payment/sagepay_server.php on line 109
PHP Notice: Undefined index: recurring_price in /catalog/model/payment/sagepay_server.php on line 116
PHP Notice: Undefined index: recurring_cycle in /catalog/model/payment/sagepay_server.php on line 117
PHP Notice: Undefined index: recurring_frequency in /catalog/model/payment/sagepay_server.php on line 117
PHP Notice: Undefined index: recurring_duration in /catalog/model/payment/sagepay_server.php on line 119
It gets its data from system/library/cart.php which has the following for recurring payments:
'recurring_id' => $cart['recurring_id'],
'name' => $recurring_query->row['name'],
'frequency' => $recurring_query->row['frequency'],
'price' => $recurring_query->row['price'],
'cycle' => $recurring_query->row['cycle'],
'duration' => $recurring_query->row['duration'],
'trial' => $recurring_query->row['trial_status'],
'trial_frequency' => $recurring_query->row['trial_frequency'],
'trial_price' => $recurring_query->row['trial_price'],
'trial_cycle' => $recurring_query->row['trial_cycle'],
'trial_duration' => $recurring_query->row['trial_duration']
These don't match the "recurring_" variants listed in the errors above and also the current function is not getting the data from the ['recurring'] array inside $item.
For example
should really be
To fix this, the addRecurringPayment function should be as follows :
Hope this helps :)
The text was updated successfully, but these errors were encountered: