Open abdazz25 opened 8 years ago
ok. Will check this for 2.*
Thank you.
welcome @abdazz25
Hi Partic,
I found out a solution to this problem from this link http://stackoverflow.com/questions/26279845/opencart-blog-module-error
Under admin\controller\payment\mpesa.php is where i made the changes as instructed below. Atleast I am now able to view the Lipa Na Mpesa configuration page.
eg. $this->data['insert'] = change to
$data['insert'] =
$this->language->load('module/blog');
change to
$this->load->language('module/blog');
$this->template = 'module/blog/list.tpl'; $this->children = array( 'common/header', 'common/footer' );
$this->response->setOutput($this->render());
change to
$data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer');
$this->response->setOutput($this->load->view('module/blog/list.tpl', $data));
Here is the working file for me File Name:mpesa.php File Location:admin\controller\payment\mpesa.php
`<?php class ControllerPaymentMpesa extends Controller { private $error = array();
public function index() {
$this->load->language('payment/mpesa');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('setting/setting');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('mpesa', $this->request->post);
$this->session->data['success'] = $this->language->get('text_success');
$this->redirect($this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'));
}
$data['heading_title'] = $this->language->get('heading_title');
$data['text_enabled'] = $this->language->get('text_enabled');
$data['text_disabled'] = $this->language->get('text_disabled');
$data['text_all_zones'] = $this->language->get('text_all_zones');
$data['entry_mpesa'] = $this->language->get('entry_mpesa');
$data['entry_total'] = $this->language->get('entry_total');
$data['entry_order_status'] = $this->language->get('entry_order_status');
$data['entry_geo_zone'] = $this->language->get('entry_geo_zone');
$data['entry_status'] = $this->language->get('entry_status');
$data['entry_dev'] = $this->language->get('entry_dev');
$data['entry_sort_order'] = $this->language->get('entry_sort_order');
$data['button_save'] = $this->language->get('button_save');
$data['button_cancel'] = $this->language->get('button_cancel');
if (isset($this->error['warning'])) {
$data['error_warning'] = $this->error['warning'];
} else {
$data['error_warning'] = '';
}
$this->load->model('localisation/language');
$languages = $this->model_localisation_language->getLanguages();
foreach ($languages as $language) {
if (isset($this->error['mpesa_' . $language['language_id']])) {
$data['error_mpesa_' . $language['language_id']] = $this->error['mpesa_' . $language['language_id']];
} else {
$data['error_mpesa_' . $language['language_id']] = '';
}
}
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => false
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_payment'),
'href' => $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => ' :: '
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('payment/mpesa', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => ' :: '
);
$data['action'] = $this->url->link('payment/mpesa', 'token=' . $this->session->data['token'], 'SSL');
$data['cancel'] = $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL');
$this->load->model('localisation/language');
foreach ($languages as $language) {
if (isset($this->request->post['mpesa_' . $language['language_id']])) {
$data['mpesa_' . $language['language_id']] = $this->request->post['mpesa_' . $language['language_id']];
} else {
$data['mpesa_' . $language['language_id']] = $this->config->get('mpesa_' . $language['language_id']);
}
}
$data['languages'] = $languages;
if (isset($this->request->post['mpesa_total'])) {
$data['mpesa_total'] = $this->request->post['mpesa_total'];
} else {
$data['mpesa_total'] = $this->config->get('mpesa_total');
}
if (isset($this->request->post['mpesa_order_status_id'])) {
$data['mpesa_order_status_id'] = $this->request->post['mpesa_order_status_id'];
} else {
$data['mpesa_order_status_id'] = $this->config->get('mpesa_order_status_id');
}
$this->load->model('localisation/order_status');
$data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
if (isset($this->request->post['mpesa_geo_zone_id'])) {
$data['mpesa_geo_zone_id'] = $this->request->post['mpesa_geo_zone_id'];
} else {
$data['mpesa_geo_zone_id'] = $this->config->get('mpesa_geo_zone_id');
}
$this->load->model('localisation/geo_zone');
$data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
if (isset($this->request->post['mpesa_status'])) {
$data['mpesa_status'] = $this->request->post['mpesa_status'];
} else {
$data['mpesa_status'] = $this->config->get('mpesa_status');
}
if (isset($this->request->post['mpesa_sort_order'])) {
$data['mpesa_sort_order'] = $this->request->post['mpesa_sort_order'];
} else {
$data['mpesa_sort_order'] = $this->config->get('mpesa_sort_order');
}
//$this->template = 'payment/mpesa.tpl';
//$this->children = array(
// 'common/header',
// 'common/footer'
// );
// $this->response->setOutput($this->render());
$data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer');
$this->response->setOutput($this->load->view('payment/mpesa.tpl', $data));
}
protected function validate() {
if (!$this->user->hasPermission('modify', 'payment/mpesa')) {
$this->error['warning'] = $this->language->get('error_permission');
}
$this->load->model('localisation/language');
$languages = $this->model_localisation_language->getLanguages();
foreach ($languages as $language) {
if (!$this->request->post['mpesa_' . $language['language_id']]) {
$this->error['mpesa_' . $language['language_id']] = $this->language->get('error_mpesa');
}
}
if (!$this->error) {
return true;
} else {
return false;
}
}
} ?>`
Hi Partic, Though am able to view the Li[a Na Mpesa page, the save button when clicked, it routes to a blank page. And when I try to use the Lipa Na Mpesa during checkout, I get an internal server error under payment method.
will develop the same with v2 standards and upload ASAP @abdazz25 Thanks alot. Hope you're enjoying the use...hehe. log all.
Haha thanks @patricmutwiri., Well am just learning how to use your script, I have not yet get it to work. If you could kindly explain to me on this "During registration with mpesa, ask them to send the IPN params to yourstoreurl/index.php?route=payment/mpesa/ipn".
Best regards, Abdalla
From safcom side, they need a url to where to send your order callback details, like, if the amount was received. It's then captured by your site via that url.
Oh okay, I get. Have you considered building/using PesaPi and SMSSync?
haven't used it yet. You've tried it?
Yes I did. All my Mpesa SMSs were Synced online by SMSSync developed by Ushahidi.
wow..never tested though its awesome...
Hi patric, Hope you are keeping well. Did you manage to sort out this issue?
started working on a G2 one, that is not opensource
Kind Regards,
[image: Patrick] http://patric.xyz/
Patrick Mutwiri / _dev
+254 727 542 899
Nairobi, Kenya
[image: Twitter] https://twitter.com/patric_mutwiri [image: Facebook] https://fb.com/happyxy [image: Google +] https://plus.google.com/+patrickmt [image: LinkedIn] https://ke.linkedin.com/in/developerpatrick [image: Instagram] https://instagram.com/patric_mutwiri [image: Github] https://github.com/patricmutwiri [image: Stack Overflow] http://stackoverflow.com/users/3012938/patrick-mutwiri
On Mon, Jun 20, 2016 at 1:49 PM, Abdalla Nizar notifications@github.com wrote:
Hi patric, Hope you are keeping well. Did you manage to sort out this issue?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/patricmutwiri/opencart-lipa-na-mpesa/issues/1#issuecomment-227110133, or mute the thread https://github.com/notifications/unsubscribe/AHPRD4CLN8W1RC_ofEHPagVXEbm5IrBRks5qNnAggaJpZM4ILwZE .
Ok noted with thanks
but its what am working on actually. v2.
Kind Regards,
[image: Patrick] http://patric.xyz/
Patrick Mutwiri / _dev
+254 727 542 899
Nairobi, Kenya
[image: Twitter] https://twitter.com/patric_mutwiri [image: Facebook] https://fb.com/happyxy [image: Google +] https://plus.google.com/+patrickmt [image: LinkedIn] https://ke.linkedin.com/in/developerpatrick [image: Instagram] https://instagram.com/patric_mutwiri [image: Github] https://github.com/patricmutwiri [image: Stack Overflow] http://stackoverflow.com/users/3012938/patrick-mutwiri
On Mon, Jun 20, 2016 at 3:17 PM, Abdalla Nizar notifications@github.com wrote:
Ok noted with thanks
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/patricmutwiri/opencart-lipa-na-mpesa/issues/1#issuecomment-227126105, or mute the thread https://github.com/notifications/unsubscribe/AHPRDyR_6niNgcBN6SFnyXrqzmYg6sgMks5qNoTNgaJpZM4ILwZE .
Awesome man, keep going.
thanks. Must.
Kind Regards,
[image: Patrick] http://patric.xyz/
Patrick Mutwiri / _dev
+254 727 542 899
Nairobi, Kenya
[image: Twitter] https://twitter.com/patric_mutwiri [image: Facebook] https://fb.com/happyxy [image: Google +] https://plus.google.com/+patrickmt [image: LinkedIn] https://ke.linkedin.com/in/developerpatrick [image: Instagram] https://instagram.com/patric_mutwiri [image: Github] https://github.com/patricmutwiri [image: Stack Overflow] http://stackoverflow.com/users/3012938/patrick-mutwiri
On Mon, Jun 20, 2016 at 3:34 PM, Abdalla Nizar notifications@github.com wrote:
Awesome man, keep going.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/patricmutwiri/opencart-lipa-na-mpesa/issues/1#issuecomment-227129504, or mute the thread https://github.com/notifications/unsubscribe/AHPRD5EL8Y8PLbrXX64vbY6CnFOANTtlks5qNojFgaJpZM4ILwZE .
https://github.com/patricmutwiri/opencartv2-lipa-na-mpesa just started, you can contribute too. Nothing in for now, placeholder :)
Kind Regards,
[image: Patrick] http://patric.xyz/
Patrick Mutwiri / _dev
+254 727 542 899
Nairobi, Kenya
[image: Twitter] https://twitter.com/patric_mutwiri [image: Facebook] https://fb.com/happyxy [image: Google +] https://plus.google.com/+patrickmt [image: LinkedIn] https://ke.linkedin.com/in/developerpatrick [image: Instagram] https://instagram.com/patric_mutwiri [image: Github] https://github.com/patricmutwiri [image: Stack Overflow] http://stackoverflow.com/users/3012938/patrick-mutwiri
On Mon, Jun 20, 2016 at 3:34 PM, Patrick Mutwiri patwiri@gmail.com wrote:
thanks. Must.
Kind Regards,
[image: Patrick] http://patric.xyz/
Patrick Mutwiri / _dev
+254 727 542 899
Nairobi, Kenya
[image: Twitter] https://twitter.com/patric_mutwiri [image: Facebook] https://fb.com/happyxy [image: Google +] https://plus.google.com/+patrickmt [image: LinkedIn] https://ke.linkedin.com/in/developerpatrick [image: Instagram] https://instagram.com/patric_mutwiri [image: Github] https://github.com/patricmutwiri [image: Stack Overflow] http://stackoverflow.com/users/3012938/patrick-mutwiri
On Mon, Jun 20, 2016 at 3:34 PM, Abdalla Nizar notifications@github.com wrote:
Awesome man, keep going.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/patricmutwiri/opencart-lipa-na-mpesa/issues/1#issuecomment-227129504, or mute the thread https://github.com/notifications/unsubscribe/AHPRD5EL8Y8PLbrXX64vbY6CnFOANTtlks5qNojFgaJpZM4ILwZE .
What a challenge! haha
:)
Kind Regards,
[image: Patrick] http://patric.xyz/
Patrick Mutwiri / _dev
+254 727 542 899
Nairobi, Kenya
[image: Twitter] https://twitter.com/patric_mutwiri [image: Facebook] https://fb.com/happyxy [image: Google +] https://plus.google.com/+patrickmt [image: LinkedIn] https://ke.linkedin.com/in/developerpatrick [image: Instagram] https://instagram.com/patric_mutwiri [image: Github] https://github.com/patricmutwiri [image: Stack Overflow] http://stackoverflow.com/users/3012938/patrick-mutwiri
On Tue, Jun 21, 2016 at 1:24 PM, Abdalla Nizar notifications@github.com wrote:
What a challenge haha
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/patricmutwiri/opencart-lipa-na-mpesa/issues/1#issuecomment-227400545, or mute the thread https://github.com/notifications/unsubscribe/AHPRDxfqp7E2nyG67RMutaRZqflWAGR6ks5qN7vwgaJpZM4ILwZE .
Hi Patric, Hope you are well.
I needed some help/guidance on the below.
Am working on using the pesapi and smsync for checkout. pesapi and smssync are working great and all sms with Mpesa Confirmation Code are inserted in a table.
I have also worked on a payment module based on yours and a few other lipa na mpesa payment modules for open cart.
Am at the stage where i have collected the mpesa code from the user and here is what i want your help.
Take the Mpesa code, check if the code exists in the database table.
Kindly note am not going to any other url or merchant site to query. Am just checking the code locally.
If the code exists confirm the order and redirect the user to url->link('checkout/success');
If the code does not exist maybe SMSync has not synced the SMS, I want the system to stay on the same page so that the user can click again to check the code.
At this moment i don't want to worry whether the code as been used or not, or the amount is ok or not.
Kindly advice.
Thank and Regards Abdalla
hi Abdalla. in this api, safcom sends all this later, to the url and that's where the code is verified against the one saved in the db. If it doesn't match, the order won't be marked as complete and that's all. see below pls.
Hi Patric. Thanks for your reply.
Hi Patirc, Long time. Hope You are well. Any working module with version v3.0.2.0?
Regards
Hi Patric, I have installed the Lipa Na Mpesa on OpenCart 2.2.0.0 and when I go to Payment List I am able to install Lipa Na Mpesa, but when I click edit, I get the error below. Kindly assist.
Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 20Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 22Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 23Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 24Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 26Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 27Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 28Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 29Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 30Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 31Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 33Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 35Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 36Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 41Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 52Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 56Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 58Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 64Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 70Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 76Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 78Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 86Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 90Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 95Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 101Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 106Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 111Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 116Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 121Notice: Indirect modification of overloaded property ControllerPaymentMpesa::$data has no effect in C:\wamp\www\opencart\admin\controller\payment\mpesa.php on line 127
Regards, Abdalla