Maverick
Well-Known Member
Искам да огранича плащането през скрил да става само в $. До колкото виждам файла който трябва да променя е */catalog/controller/payment/moneybookers.php
егопей модула има такава опция. Изважда съобщение за грешка:
Ето и целия файл на егопей:
Някой който разбира от програмиране може ли да помогне?
Код:
<?php
class ControllerPaymentMoneybookers extends Controller {
protected function index() {
$this->load->model('checkout/order');
$this->language->load('payment/moneybookers');
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['action'] = 'https://www.moneybookers.com/app/payment.pl?p=OpenCart';
$this->data['pay_to_email'] = $this->config->get('moneybookers_email');
$this->data['platform'] = '31974336';
$this->data['description'] = $this->config->get('config_name');
$this->data['transaction_id'] = $this->session->data['order_id'];
$this->data['return_url'] = $this->url->link('checkout/success');
$this->data['cancel_url'] = $this->url->link('checkout/checkout', '', 'SSL');
$this->data['status_url'] = $this->url->link('payment/moneybookers/callback');
$this->data['language'] = $this->session->data['language'];
$this->data['logo'] = $this->config->get('config_url') . 'image/' . $this->config->get('config_logo');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$this->data['pay_from_email'] = $order_info['email'];
$this->data['firstname'] = $order_info['payment_firstname'];
$this->data['lastname'] = $order_info['payment_lastname'];
$this->data['address'] = $order_info['payment_address_1'];
$this->data['address2'] = $order_info['payment_address_2'];
$this->data['phone_number'] = $order_info['telephone'];
$this->data['postal_code'] = $order_info['payment_postcode'];
$this->data['city'] = $order_info['payment_city'];
$this->data['state'] = $order_info['payment_zone'];
$this->data['country'] = $order_info['payment_iso_code_3'];
$this->data['amount'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false);
$this->data['currency'] = $order_info['currency_code'];
$products = '';
foreach ($this->cart->getProducts() as $product) {
$products .= $product['quantity'] . ' x ' . $product['name'] . ', ';
}
$this->data['detail1_text'] = $products;
$this->data['order_id'] = $this->session->data['order_id'];
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/moneybookers.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/moneybookers.tpl';
} else {
$this->template = 'default/template/payment/moneybookers.tpl';
}
$this->render();
}
public function callback() {
if (isset($this->request->post['order_id'])) {
$order_id = $this->request->post['order_id'];
} else {
$order_id = 0;
}
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
$this->model_checkout_order->confirm($order_id, $this->config->get('config_order_status_id'));
$verified = true;
// md5sig validation
if ($this->config->get('moneybookers_secret')) {
$hash = $this->request->post['merchant_id'];
$hash .= $this->request->post['transaction_id'];
$hash .= strtoupper(md5($this->config->get('moneybookers_secret')));
$hash .= $this->request->post['mb_amount'];
$hash .= $this->request->post['mb_currency'];
$hash .= $this->request->post['status'];
$md5hash = strtoupper(md5($hash));
$md5sig = $this->request->post['md5sig'];
if ($md5hash != $md5sig) {
$verified = false;
}
}
if ($verified) {
switch($this->request->post['status']) {
case '2':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_order_status_id'), '', true);
break;
case '0':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_pending_status_id'), '', true);
break;
case '-1':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_canceled_status_id'), '', true);
break;
case '-2':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_failed_status_id'), '', true);
break;
case '-3':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_chargeback_status_id'), '', true);
break;
}
} else {
$this->log->write('md5sig returned (' + $md5sig + ') does not match generated (' + $md5hash + '). Verify Manually. Current order state: ' . $this->config->get('config_order_status_id'));
}
}
}
}
?>
егопей модула има такава опция. Изважда съобщение за грешка:
Код:
$total_amount = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], FALSE);
if($order_info['currency_code'] != 'USD' && $order_info['currency_code'] != 'EUR'){
echo '<script type="text/javascript">alert ("Only payments in USD/EUR are currently available");</script>';
return '';
Ето и целия файл на егопей:
Код:
<?php
$egopaysci_path = DIR_SYSTEM . 'library/egopaysci.php';
if (file_exists($egopaysci_path)) {
require_once($egopaysci_path);
}
class ControllerPaymentEgopay extends Controller {
public $aResponse;
protected function index() {
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['button_back'] = $this->language->get('button_back');
$this->data['action'] = EgoPaySci::EGOPAY_PAYMENT_URL;
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
if ($this->request->get['route'] != 'checkout/guest_step_3') {
$return_fail_url = HTTPS_SERVER . 'index.php?route=checkout/payment';
} else {
$return_fail_url = HTTPS_SERVER . 'index.php?route=checkout/guest_step_2';
}
try {
$oEgopay = new EgoPaySci(array(
'store_id' => $this->config->get('egopay_store_id'),
'store_password' => $this->config->get('egopay_store_password')
));
$sPaymentHash = $oEgopay->createHash(array(
'amount' => $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], FALSE),
'currency' => $order_info['currency_code'],
'description' => 'Payment for: ' . $this->session->data['order_id'],
'cf_1' => $this->session->data['order_id'],
'success_url' => HTTPS_SERVER . 'index.php?route=checkout/success',
'fail_url' => $return_fail_url,
'callback_url' => HTTPS_SERVER . 'index.php?route=payment/egopay/callback'
));
} catch (EgoPayException $e) {
die($e->getMessage());
}
$this->data['hash'] = $sPaymentHash;
if ($this->request->get['route'] != 'checkout/guest_step_3') {
$this->data['back'] = HTTPS_SERVER . 'index.php?route=checkout/payment';
} else {
$this->data['back'] = HTTPS_SERVER . 'index.php?route=checkout/guest_step_2';
}
$this->id = 'payment';
$total_amount = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], FALSE);
if($order_info['currency_code'] != 'USD' && $order_info['currency_code'] != 'EUR'){
echo '<script type="text/javascript">alert ("Only payments in USD/EUR are currently available");</script>';
return '';
}else if($total_amount < 1){
echo '<script type="text/javascript">alert("Total amount must be greater than 1.00");</script>';
return '';
}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/egopay.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/egopay.tpl';
} else {
$this->template = 'default/template/payment/egopay.tpl';
}
$this->render();
}
public function callback() {
if (isset($this->request->post['product_id'])) {
try {
$EgoPay = new EgoPaySciCallback(array(
'store_id' => $this->config->get('egopay_store_id'),
'store_password' => $this->config->get('egopay_store_password')
));
$this->aResponse = $EgoPay->getResponse($_POST);
} catch (EgoPayException $e) {
die($e->getMessage());
}
}
$order_id = $this->aResponse['cf_1'];
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
$total_amount = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], FALSE);
if($total_amount != $this->aResponse['fAmount']){
if (!$order_info['order_status_id']) {
$this->model_checkout_order->confirm($order_id, $this->config->get('egopay_error_status_id'), 'EGOPAY: incorrect amount received (' . $this->aResponse['fAmount'] . ' ' . $this->aResponse['sCurrency'] . ')');
} else {
$this->model_checkout_order->update($order_id, $this->config->get('egopay_error_status_id'), 'EGOPAY: incorrect amount received (' . $this->aResponse['fAmount'] . ' ' . $this->aResponse['sCurrency'] . ')');
}
return '';
}else if($order_info['currency_code'] != $this->aResponse['sCurrency']){
if (!$order_info['order_status_id']) {
$this->model_checkout_order->confirm($order_id, $this->config->get('egopay_error_status_id'), 'EGOPAY: incorrect currency received (' . $this->aResponse['sCurrency'] . ')');
} else {
$this->model_checkout_order->update($order_id, $this->config->get('egopay_error_status_id'), 'EGOPAY: incorrect currency received (' . $this->aResponse['sCurrency'] . ')');
}
return '';
}
if ($order_info) {
switch ($this->aResponse['sStatus']) {
case 'Completed':
$order_status_id = $this->config->get('egopay_completed_status_id');
break;
case 'Pending':
$order_status_id = $this->config->get('egopay_pending_status_id');
break;
case 'On Hold':
$order_status_id = $this->config->get('egopay_on_hold_status_id');
break;
case 'Canceled':
$order_status_id = $this->config->get('egopay_canceled_status_id');
break;
}
if (!$order_info['order_status_id']) {
$this->model_checkout_order->confirm($order_id, $order_status_id, 'EGOPAY');
} else {
$this->model_checkout_order->update($order_id, $order_status_id, 'EGOPAY');
}
} else {
return 0;
}
}
}
?>
Някой който разбира от програмиране може ли да помогне?