Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
- Implement secret key feature.
- Implement sandbox feature.
  • Loading branch information
chenyaau94 committed Jul 24, 2018
1 parent 5fff1c1 commit 850825b
Show file tree
Hide file tree
Showing 9 changed files with 348 additions and 285 deletions.
53 changes: 39 additions & 14 deletions OpenCart2.0_Seamless_Plugin/admin/controller/payment/molpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function index() {

$data['entry_mid'] = $this->language->get('entry_mid');
$data['entry_vkey'] = $this->language->get('entry_vkey');
$data['entry_order_status'] = $this->language->get('entry_order_status');
$data['entry_skey'] = $this->language->get('entry_skey');
$data['entry_type'] = $this->language->get('entry_type');
$data['entry_completed_status'] = $this->language->get('entry_completed_status');
$data['entry_pending_status'] = $this->language->get('entry_pending_status');
$data['entry_failed_status'] = $this->language->get('entry_failed_status');
Expand All @@ -48,7 +49,9 @@ public function index() {
$data['channel_list'] = $this->language->get('channel_list');

$data['help_vkey'] = $this->language->get('help_vkey');

$data['help_skey'] = $this->language->get('help_skey');
$data['help_type'] = $this->language->get('help_type');

$data['button_save'] = $this->language->get('button_save');
$data['button_cancel'] = $this->language->get('button_cancel');

Expand All @@ -70,6 +73,18 @@ public function index() {
$data['error_vkey'] = '';
}

if (isset($this->error['skey'])) {
$data['error_skey'] = $this->error['skey'];
} else {
$data['error_skey'] = '';
}

if (isset($this->error['type'])) {
$data['error_type'] = $this->error['type'];
} else {
$data['error_type'] = '';
}

$data['breadcrumbs'] = array();

$data['breadcrumbs'][] = array(
Expand Down Expand Up @@ -102,10 +117,16 @@ public function index() {
$data['molpay_vkey'] = $this->config->get('molpay_vkey');
}

if (isset($this->request->post['molpay_order_status_id'])) {
$data['molpay_order_status_id'] = $this->request->post['molpay_order_status_id'];
if (isset($this->request->post['molpay_skey'])) {
$data['molpay_skey'] = $this->request->post['molpay_skey'];
} else {
$data['molpay_skey'] = $this->config->get('molpay_skey');
}

if (isset($this->request->post['molpay_type'])) {
$data['molpay_type'] = $this->request->post['molpay_type'];
} else {
$data['molpay_order_status_id'] = $this->config->get('molpay_order_status_id');
$data['molpay_type'] = $this->config->get('molpay_type');
}

if (isset($this->request->post['molpay_completed_status_id'])) {
Expand Down Expand Up @@ -154,15 +175,11 @@ public function index() {

//Load the data into variable

foreach($data['channel_list'] as $key=>$val)
{
if (isset($this->request->post['molpay_'.$key.'_status']))
{
$data['molpay_'.$key.'_status'] = $this->request->post['molpay_'.$key.'_status'];
}
else
{
$data['molpay_'.$key.'_status'] = $this->config->get('molpay_'.$key.'_status');
foreach ($data['channel_list'] as $key=>$val) {
if (isset($this->request->post['molpay_'.$key.'_status'])) {
$data["dbchannel_list"]['molpay_'.$key.'_status'] = $this->request->post['molpay_'.$key.'_status'];
} else {
$data["dbchannel_list"]['molpay_'.$key.'_status'] = $this->config->get('molpay_'.$key.'_status');
}
}

Expand All @@ -186,6 +203,14 @@ protected function validate() {
$this->error['vkey'] = $this->language->get('error_vkey');
}

if (!$this->request->post['molpay_skey']) {
$this->error['skey'] = $this->language->get('error_skey');
}

if (!$this->request->post['molpay_type']) {
$this->error['type'] = $this->language->get('error_type');
}

return !$this->error;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*
* @package Payment Gateway
* @author MOLPay Technical Team <technical@molpay.com>
* @version 2.0
* @version 2.0.1
*/

// Versioning
$_['molpay_ptype'] = "OpenCart";
$_['molpay_pversion'] = "2.0";
$_['molpay_pversion'] = "2.0.1";

// Heading
$_['heading_title'] = 'MOLPay Malaysia Online Payment Gateway';
Expand All @@ -23,7 +23,8 @@
// Entry
$_['entry_mid'] = 'MOLPay Merchant ID';
$_['entry_vkey'] = 'MOLPay Verify Key';
$_['entry_order_status'] = 'Order Status';
$_['entry_skey'] = 'MOLPay Secret Key';
$_['entry_type'] = 'MOLPay Account Type';
$_['entry_completed_status'] = 'Completed Status';
$_['entry_pending_status'] = 'Pending Status';
$_['entry_failed_status'] = 'Failed Status';
Expand Down Expand Up @@ -52,18 +53,23 @@
'credit3' => 'Multi Currency Credit Card',
'NGANLUONG' => 'NGANLUONG',
'crossborder' => 'Credit Card/ Debit Card (PayVision)',
'PEXPLUS' => 'PEx+',
'jompay' => 'JOMPay',
'PEXPLUS' => 'PEx+',
'jompay' => 'JOMPay',
'Cash-Esapay' => 'Cash Esapay',
'alipay' => 'Alipay.com'
'alipay' => 'Alipay.com'
);

// Help
$_['help_vkey'] = 'Please refer to your MOLPay Merchant Profile for this key.';
$_['help_skey'] = 'Please refer to your MOLPay Merchant Profile for this key.';
$_['help_type'] = 'Please choose your account type (Sandbox/Production)';
$_['type'] = array(1=> "Production", 2=>"Sandbox");

// Error
$_['error_permission'] = 'Warning: You do not have permission to modify MOLPay Malaysia Online Payment Gateway!';
$_['error_mid'] = '<b>MOLPay Merchant ID</b> Required!';
$_['error_vkey'] = '<b>MOLPay Verify Key</b> Required!';
$_['error_skey'] = '<b>MOLPay Secret Key</b> Required!';
$_['error_type'] = '<b>MOLPay Account Type</b> Required!';
$_['error_settings'] = 'MOLPay merchant id and verify key mismatch, contact support@molpay.com to assist.';
$_['error_status'] = 'Unable to connect MOLPay API.';
Loading

0 comments on commit 850825b

Please sign in to comment.