/** * [action_form] generates the form to pay at paypal */ public function action_pay() { $this->auto_render = FALSE; $id_order = $this->request->param('id'); //retrieve info for the item in DB $order = new Model_Order(); $order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find(); if ($order->loaded()) { //its a fraud...lets let him know if ($order->is_fraud() === TRUE) { Alert::set(Alert::ERROR, __('We had, issues with your transaction. Please try paying with another paymethod.')); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } if (($order_id = twocheckout::validate_passback($order)) !== FALSE) { //mark as paid $order->confirm_payment('2checkout', $order_id); //redirect him to his ads Alert::set(Alert::SUCCESS, __('Thanks for your payment!')); $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders'))); } else { Alert::set(Alert::INFO, __('Please fill your card details.')); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } } else { Alert::set(Alert::INFO, __('Order could not be loaded')); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } }
/** * [action_form] generates the form to pay at paypal */ public function action_pay() { $this->auto_render = FALSE; //sandobx doesnt do the x_receipt_link_url redirect so in sanbbox instead we put the order id $id_order = Core::config('payment.twocheckout_sandbox') == 1 ? Core::request('x_receipt_link_url') : $this->request->param('id'); //retrieve info for the item in DB $order = new Model_Order(); $order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find(); if ($order->loaded()) { //its a fraud...lets let him know if ($order->is_fraud() === TRUE) { Alert::set(Alert::ERROR, __('We had, issues with your transaction. Please try paying with another paymethod.')); $this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order))); } if (($order_id = twocheckout::validate_passback($order)) !== FALSE) { //mark as paid $order->confirm_payment('2checkout', $order_id, NULL, NULL, NULL, Twocheckout::calculate_fee($order->amount)); //redirect him to his ads Alert::set(Alert::SUCCESS, __('Thanks for your payment!')); $this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'goal', 'id' => $order->id_order))); } else { Alert::set(Alert::INFO, __('Please fill your card details.')); $this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order))); } } else { Alert::set(Alert::INFO, __('Order could not be loaded')); $this->redirect(Route::url('default')); } }
/** * [action_form] generates the form to pay at paypal */ public function action_pay() { $this->auto_render = FALSE; $id_order = $this->request->param('id'); //retrieve info for the item in DB $order = new Model_Order(); $order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find(); if ($order->loaded()) { if (($order_id = twocheckout::validate_passback($order)) !== FALSE) { //mark as paid $order->confirm_payment('2checkout', $order_id); //redirect him to his ads Alert::set(Alert::SUCCESS, __('Thanks for your payment!')); $this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'goal', 'id' => $order->id_order))); } else { Alert::set(Alert::INFO, __('Please fill your card details.')); $this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order))); } } else { Alert::set(Alert::INFO, __('Order could not be loaded')); $this->redirect(Route::url('default')); } }
</li> <?php } ?> <?php if (($bp = Bitpay::button($order)) != '') { ?> <li class="text-right"><?php echo $bp; ?> </li> <?php } ?> <?php if (($two = twocheckout::form($order)) != '') { ?> <li class="text-right"><?php echo $two; ?> </li> <?php } ?> <?php if (($paysbuy = paysbuy::form($order)) != '') { ?> <li class="text-right"><?php echo $paysbuy; ?> </li>
echo $form_action; ?> " method="post"> <input type="hidden" name="sid" value="<?php echo Core::config('payment.twocheckout_sid'); ?> " /> <input type="hidden" name="mode" value="2CO" /> <input type="hidden" name="li_0_type" value="product" /> <input type="hidden" name="li_0_tangible" value="N" /> <input type="hidden" name="li_0_name" value="<?php echo $order->id_product; ?> " /> <input type="hidden" name="li_0_price" value="<?php echo twocheckout::money_format($order->amount); ?> " /> <input type="hidden" name="li_0_quantity" value="1" /> <input type="hidden" name="currency_code" value="<?php echo $order->currency; ?> " /> <input type="hidden" name="email" value="<?php echo $order->user->email; ?> " /> <input type="hidden" name="x_receipt_link_url" value="<?php echo Route::url('default', array('controller' => 'twocheckout', 'action' => 'pay', 'id' => $order->id_order)); ?> ">