/** * [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 (isset($_POST['summarycode'])) { $fingerprint = Securepay::fingerprint_validation($order, Core::post('timestamp'), Core::post('summarycode')); if (Core::post('summarycode') == 1 and Core::post('fingerprint') == $fingerprint and Core::post('amount') == Securepay::money_format($order->amount)) { //mark as paid $order->confirm_payment('securepay', Core::post('txnid')); //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 { $msg = __('Transaction not successful!') . ' - ' . Core::post('restext'); Kohana::$log->add(Log::ERROR, 'Securepay ' . $msg); Alert::set(Alert::ERROR, $msg); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } } 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))); } }
echo $url; ?> "> <input type="hidden" name="display_receipt" value="no"> <input type="hidden" name="bill_name" value="transact"> <input type="hidden" name="merchant_id" value="<?php echo Core::config('payment.securepay_merchant'); ?> "> <input type="hidden" name="primary_ref" value="<?php echo Securepay::id_order($order->id_order); ?> "> <input type="hidden" name="txn_type" value="0"> <input type="hidden" name="amount" value="<?php echo Securepay::money_format($order->amount); ?> "> <input type="hidden" name="currency" value="<?php echo $order->currency; ?> "> <input type="hidden" name="fp_timestamp" value="<?php echo $timestamp; ?> "> <input type="hidden" name="fingerprint" value="<?php echo $fingerprint; ?> "> <input type="hidden" name="return_url" value="<?php