Post by abdulkaderahmad » Mon Apr 30, 2018 2:28 pm

Hello, I Need Help

I am using opencart 3.0.2.0, my payments getaway is 2 checkout

when the client make order from my site, the payment is successfully from 2co, but the order not showing in my dashboard my store

i try many time and changes the options form panel 2co site management i try

1- Direct Return Approved URL https://primeraboutique.com/index.php?r ... ut/success
not sending the order and not showing in my opencart dashboard

2- Given links back to my website
Approved URL https://www.primeraboutique.com/index.p ... t/callback

also same not showing order in my opencart dashboard


in my dashboard ( opencart ) setting is :
2Checkout Account ID
Secret Word ( same 2co panel )
Test Mode No
Direct Checkout Yes and i try No also not fixed
Order Status Complete
Status enable

also remove the extensions from open cart install again not fixed


when order added from 2checkout return me to Success in my store

and link is :
https://primeraboutique.com/index.php?r ... ut/success

--------------------------------------------------

my file in catalog/controller/extension/payment/

<?php
class ControllerExtensionPaymentTwoCheckout extends Controller {
public function index() {
$data['button_confirm'] = $this->language->get('button_confirm');

$this->load->model('checkout/order');

$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);

$data['action'] = 'https://www.2checkout.com/checkout/purchase';

$data['sid'] = $this->config->get('payment_twocheckout_account');
$data['currency_code'] = $order_info['currency_code'];
$data['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false);
$data['cart_order_id'] = $this->session->data['order_id'];
$data['card_holder_name'] = $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'];
$data['street_address'] = $order_info['payment_address_1'];
$data['city'] = $order_info['payment_city'];

if ($order_info['payment_iso_code_2'] == 'US' || $order_info['payment_iso_code_2'] == 'CA') {
$data['state'] = $order_info['payment_zone'];
} else {
$data['state'] = 'XX';
}

$data['zip'] = $order_info['payment_postcode'];
$data['country'] = $order_info['payment_country'];
$data['email'] = $order_info['email'];
$data['phone'] = $order_info['telephone'];

if ($this->cart->hasShipping()) {
$data['ship_street_address'] = $order_info['shipping_address_1'];
$data['ship_city'] = $order_info['shipping_city'];
$data['ship_state'] = $order_info['shipping_zone'];
$data['ship_zip'] = $order_info['shipping_postcode'];
$data['ship_country'] = $order_info['shipping_country'];
} else {
$data['ship_street_address'] = $order_info['payment_address_1'];
$data['ship_city'] = $order_info['payment_city'];
$data['ship_state'] = $order_info['payment_zone'];
$data['ship_zip'] = $order_info['payment_postcode'];
$data['ship_country'] = $order_info['payment_country'];
}

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

$products = $this->cart->getProducts();

foreach ($products as $product) {
$data['products'][] = array(
'product_id' => $product['product_id'],
'name' => $product['name'],
'description' => $product['name'],
'quantity' => $product['quantity'],
'price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value'], false)
);
}

if ($this->config->get('payment_twocheckout_test')) {
$data['demo'] = 'Y';
} else {
$data['demo'] = '';
}

if ($this->config->get('payment_twocheckout_display')) {
$data['display'] = 'Y';
} else {
$data['display'] = '';
}

$data['lang'] = $this->session->data['language'];

$data['return_url'] = $this->url->link('extension/payment/twocheckout/callback', '', true);

return $this->load->view('extension/payment/twocheckout', $data);
}

public function callback() {
$this->load->model('checkout/order');

$order_info = $this->model_checkout_order->getOrder($this->request->post['cart_order_id']);

if (!$this->config->get('payment_twocheckout_test')) {
$order_number = $this->request->post['order_number'];
} else {
$order_number = '1';
}

if (strtoupper(md5($this->config->get('payment_twocheckout_secret') . $this->config->get('payment_twocheckout_account') . $order_number . $this->request->post['total'])) == $this->request->post['key']) {
if ($this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false) == $this->request->post['total']) {
$this->model_checkout_order->addOrderHistory($this->request->post['cart_order_id'], $this->config->get('payment_twocheckout_order_status_id'));
} else {
$this->model_checkout_order->addOrderHistory($this->request->post['cart_order_id'], $this->config->get('config_order_status_id'));// Ugh. Some one've faked the sum. What should we do? Probably drop a mail to the shop owner?
}

// We can't use $this->response->redirect() here, because of 2CO behavior. It fetches this page
// on behalf of the user and thus user (and his browser) see this as located at 2checkout.com
// domain. So user's cookies are not here and he will see empty basket and probably other
// weird things.

echo '<html>' . "\n";
echo '<head>' . "\n";
echo ' <meta http-equiv="Refresh" content="0; url=' . $this->url->link('checkout/success') . '">' . "\n";
echo '</head>' . "\n";
echo '<body>' . "\n";
echo ' <p>Please follow <a href="' . $this->url->link('checkout/success') . '">link</a>!</p>' . "\n";
echo '</body>' . "\n";
echo '</html>' . "\n";
exit();
} else {
echo 'The response from 2checkout.com can\'t be parsed. Contact site administrator, please!';
}
}
}


please help me what the issues ?


Posts

Joined
Sun Sep 17, 2017 4:24 pm

Post by asep84 » Fri Jun 01, 2018 9:34 pm

Same thing happen to me few days ago, my client use older version 2.3.0.2, the code almost same only have different variable name for 2checkout config, should be not a problem.

I am suggest you to do more test with enable demo setting and sandbox test. Maybe we use wrong callback URL, secret word or something else.

But now I am looking the extension supported 2Checkout Instant Notification Service. Any body can point me to somewhere related to opencart and 2Checkout Instant Notification Service?

Thank you.

Newbie

Posts

Joined
Thu May 31, 2018 10:14 am
Who is online

Users browsing this forum: No registered users and 252 guests