?> <?php $order = Order::model()->findByPk($orderID); if (!empty($order)) { ?> <h5>Transaction ID: <?php echo $ref; ?> </h5> <h5>Name: <?php echo $order->firstname . ' ' . $order->lastname; ?> </h5> <h5>Total Amount Due: <?php echo UtilityHelper::formatPrice($total); ?> </h5> <h5>Email: <?php echo $order->email; ?> </h5> <h5>Phone: <?php echo $order->telephone; ?> </h5> <br/> <span>Please take note of your transaction id, you may be required to present it in future.</span> <?php echo CHtml::hiddenField('merch_txnref', $ref); echo CHtml::hiddenField('merchantid', "174");
<div class="related_inner"> <a href="<?php echo $link; ?> "><?php $tpath = Yii::app()->request->baseUrl . '/img/no-image.jpg'; if (!empty($related->thumbs)) { $tpath = Yii::app()->request->baseUrl . $related->thumbs[0]->source; } ?> <?php echo CHtml::image($tpath); ?> <span class="related_title"><?php echo $related->getName(); ?> </span> <span class="related_price"><?php echo UtilityHelper::formatPrice($related->price); ?> </span></a> </div> </div> <?php if ($i == 2) { break; } } ?>
<?php $i++; } } ?> </div> <div class="col-md-4 product_right" style="margin-top: -6%"> <div class="reg"><?php //echo CHtml::image(Yii::app()->request->baseUrl.'/img/product_price.png'); ?> <?php echo ' ' . Yii::t('label', 'Price'); ?> </div> <div class="product_price"><?php echo UtilityHelper::formatPrice($product->price); ?> </div> <div class="reg"><?php //echo CHtml::image(Yii::app()->request->baseUrl.'/img/product_stock.png'); echo ' ' . Yii::t('label', 'Stock'); ?> </div> <div class="product_stock">Only <?php echo $product->quantity; ?> items left</div> <!--<div class="product_free"><?php //echo CHtml::image(Yii::app()->request->baseUrl.'/img/delivery_icon.png'); ?> <div class="p_free"><?php
<?php $this->widget('bootstrap.widgets.TbAlert'); ?> <?php $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', 'product_name', 'product_quantity', 'product_colour', 'specification', 'comment', 'payment_code', 'firstname', 'lastname', 'email', 'telephone', array('name' => 'total', 'type' => 'raw', 'value' => UtilityHelper::formatPrice($model->total)), array('name' => 'order_status_id', 'type' => 'raw', 'value' => !empty($model->orderStatus) ? TbHtml::encode($model->orderStatus->getName()) : null), 'address_1', 'address_2', 'city', 'postal_code', array('name' => 'zone', 'label' => 'State', 'type' => 'raw', 'value' => $model->zone !== null ? TbHtml::encode($model->zone->name) : null), array('name' => 'country', 'type' => 'raw', 'value' => $model->country !== null ? TbHtml::encode($model->country->name) : null), 'ip', 'forwarded_ip', 'user_agent', 'date_added', 'date_modified'))); ?> <div class="hlinks hide"> <div class="uid"><?php echo $model->id; ?> </div> </div>
?> <div class="checkout_head_general"> <span class="checkout_title">Where should we deliver</span> <?php $cid = strtolower((string) $this->id); if ($cid != 'specialorder') { ?> <div class="checkout_top"> <span class="in_your_cart">In your Cart</span> <?php echo CHtml::image(Yii::app()->request->baseUrl . '/img/checkout_arrow.png'); ?> <span class="badge"><?php echo $this->getCartCount(); ?> </span> <strong>@ <?php echo UtilityHelper::formatPrice($this->getCartTotal()); ?> </strong> <a href="<?php echo $this->createUrl('cart/cart'); ?> "><?php echo CHtml::image(Yii::app()->request->baseUrl . '/img/checkout_edit.png'); ?> </a> </div> <?php } ?> <div class="clear"></div> </div>
?> <h5>Name : <?php echo $response['merch_name']; ?> </h5> <h5>Phone number : <?php echo $response['merch_phoneno']; ?> </h5> <h5>Transaction Amount : <?php echo UtilityHelper::formatPrice($response['merch_amt']); ?> </h5> <h5>Debited Amount : <?php echo UtilityHelper::formatPrice($response['amount']); ?> </h5> <h5>Transaction Date : <?php echo $response['txn_date']; ?> </h5> <h5>Payment Method : <?php echo $response['pmt_method']; ?> </h5> <h5>Payment Status : <?php echo $response['pmt_status']; ?> </h5> <h5>Transaction Reference Number : <?php
<div class="productoptionvalue"> <?php echo CHtml::$type("OrderOption[{$i}][product_option_value_id]", '', CHtml::listData($productoptionvalue, 'id', function ($data) { $sign = '+'; $soldout = ''; if ($data->quantity < 1) { $soldout = '-Sold Out'; } if ($data->subtract) { $sign = '-'; } $optionvalue = OptionValue::model()->findByPk($data->option_value_id); $dprice = ""; if ($data->price > 0) { $dprice = " ( {$sign} " . UtilityHelper::formatPrice($data->price) . ")"; } return $optionvalue->getName() . $dprice . "{$soldout}"; }), array('encode' => false)); ?> </div> <?php } else { if ($option->type == 'date') { ?> <div class="input-append"> <?php $this->widget('yiiwheels.widgets.datepicker.WhDatePicker', array('name' => "OrderOption[{$i}][value]", 'pluginOptions' => array('format' => 'mm/dd/yyyy'))); ?> <span class="add-on"><icon class="icon-calendar"></icon></span>
public static function callInterswitch($ref, &$json) { //$ref = $_POST['txnref']; $order = Order::model()->findByAttributes(array('payment_code' => $ref)); $pay = PaymentTransaction::model()->findByAttributes(array('reference_number' => $ref)); $url = UtilityHelper::yiiparam('interswitchGet') . '?productid=' . UtilityHelper::yiiparam('interswitchProductID') . '&transactionreference=' . $ref . '&amount=' . $order->total * 100; //self::sendToLog($url); try { $cURL = curl_init(); curl_setopt($cURL, CURLOPT_URL, $url); curl_setopt($cURL, CURLOPT_HTTPGET, true); curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Hash: ' . hash('sha512', UtilityHelper::yiiparam('interswitchProductID') . $ref . UtilityHelper::yiiparam('MAC_key')))); $result = curl_exec($cURL); if (FALSE === $result) { throw new Exception(curl_error($cURL), curl_errno($cURL)); } //self::sendToLog($result,"Json things!!!"); curl_close($cURL); } catch (Exception $e) { self::sendToLog(sprintf('Curl failed with error #%d: %s', $e->getCode(), $e->getMessage()), "CURL Interswitch Error"); return false; } $json = json_decode($result, true); //$pay->transaction_date = $json['TransactionDate']; //$pay->reference_number = $ref; $pay->payment_reference = $json['PaymentReference']; $pay->response_description = $json['ResponseDescription']; $pay->response_code = $json['ResponseCode']; $pay->approved_amount = $json['Amount'] / 100; //$pay->customer_name = ; $pay->save(); $json['CustomerName'] = $pay->customer_name; $total = UtilityHelper::formatPrice($order->total); $siteurl = UtilityHelper::yiiparam('siteUrl'); if (empty($order->check)) { $messg = "Dear {$order->firstname} {$order->lastname},<br/><br/>You have just attempted making payment for order #{$order->id} on {$order->store_url}. Find the details below.<br/><br/>Amount: {$total}<br/><br/>Response Description: {$json['ResponseDescription']}<br/><br/>Response Code: {$json['ResponseCode']}<br/><br/>Transaction Ref No: {$ref}<br/><br/>Payment Reference: {$json['PaymentReference']}<br/><br/>Transaction Date: {$json['TransactionDate']}<br/>"; if ($json['ResponseCode'] == '09') { } else { if ($json['ResponseCode'] == '00') { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Successful Payment Notification', $messg); //UtilityHelper::changeOrderStatus($order->id); $order->order_status_id = 2; $order->check = 1; $order->save(); UtilityHelper::subtractOrder($order->id); } else { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Failed Payment Notification', $messg); //UtilityHelper::changeOrderStatus($order->id,10); $order->order_status_id = 10; $order->check = 1; $order->save(); } } } //return $order; }
} ?> <!-- second secondary menu --> <?php if (Yii::app()->user->hasFlash('orderMessage')) { ?> <div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <?php echo Yii::app()->user->getFlash('orderMessage'); ?> </div> <?php } if (isset($orders)) { if (!empty($orders)) { $this->widget('bootstrap.widgets.TbGridView', array('id' => 'manufacturer-grid', 'type' => array(TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_CONDENSED), 'dataProvider' => $orders->search(), 'filter' => $orders, 'rowCssClassExpression' => '"items[]_{$data->id}"', 'columns' => array('id', array('name' => 'total', 'type' => 'raw', 'value' => function () { return UtilityHelper::formatPrice($data->total); }), array('name' => 'order_status_id', 'type' => 'raw', 'value' => function () { $status = OrderStatus::model()->findByPk($data->order_status_id); return !empty($status) ? $status->name : null; }), 'payment_code', 'invoice_no'))); } else { echo "<h5>You have not placed an order with us yet.</h5>"; } } else { echo "<h3>Please <a href=" . $this->createUrl('/user/login') . ">Log in</a> to view your order history</h3>"; } ?> </div> </div>
public static function callGlobalPay($txnref, &$trans) { //$txnref = $_GET["txnref"]; $client = new SoapClient('https://www.globalpay.com.ng/globalpaywebservice/service.asmx?wsdl', array('exceptions' => 0, 'encoding' => 'UTF-8')); $soapaction = "https://www.eazypaynigeria.com/globalpay/getTransactions"; $namespace = "https://www.eazypaynigeria.com/globalpay/"; $order = Order::model()->findByAttributes(array('payment_code' => $txnref)); $pay = PaymentTransaction::model()->findByAttributes(array('reference_number' => $txnref)); $merch_txnref = $txnref; $channel = ""; //change the merchantid to the one sent to you $merchantID = "174"; $start_date = ""; $end_date = ""; //change the uid and pwd to the one sent to you $uid = "yl_ws_user"; $pwd = "yl_ws_password"; $payment_status = ""; /* $err = $client->getError(); if ($err) { $this->render('view2',array('response'=>$err, 'error'=>1)); }*/ // Doc/lit parameters get wrapped $MethodToCall = "getTransactions"; //$MethodToCall= "Checkcenter"; $param = array('merch_txnref' => $merch_txnref, 'channel' => $channel, 'merchantID' => $merchantID, 'start_date' => $start_date, 'end_date' => $end_date, 'uid' => $uid, 'pwd' => $pwd, 'payment_status' => $payment_status); $result = $client->__soapCall($MethodToCall, array('parameters' => $param), array('uri' => $namespace, 'soapaction' => $soapaction)); // Check for a fault if (is_soap_fault($result)) { //"SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})"; return false; } else { //This gives getTransactionsResult $WebResult = $MethodToCall . "Result"; // Pass the result into XML if (is_object($result)) { $xresult = $result->{$WebResult}; } else { $xresult = $result[$WebResult]; } $xml = simplexml_load_string($xresult); //self::sendToLog($xml); //$trans = array(); $trans['amount'] = $xml->record->amount; $trans['txn_date'] = $xml->record->payment_date; $trans['pmt_method'] = $xml->record->channel; $trans['pmt_status'] = $xml->record->payment_status; $trans['pmt_txnref'] = $xml->record->txnref; $trans['currency'] = $xml->record->field_values->field_values->field[2]->currency; // $pnr = 'PNR'; $trans['trans_status'] = $xml->record->payment_status_description; $trans['merch_name'] = $pay->customer_name; $trans['merch_phoneno'] = $order->telephone; $trans['merch_amt'] = $pay->transaction_amount; //$pay = new PaymentTransaction; $pay->transaction_date = $trans['txn_date']; //$pay->reference_number = ; $pay->payment_reference = $trans['pmt_txnref']; if ($trans['amount'] != $trans['merch_amt']) { $trans['pmt_status'] .= " ( Amount does not match and no service will be rendered)"; $pay->response_code = $trans['pmt_status']; } else { $pay->response_code = $trans['pmt_status']; } $pay->response_description = $trans['trans_status']; $pay->approved_amount = $trans['amount']; //$pay->transaction_amount = $trans['merch_amt']; $pay->transaction_currency = $trans['currency']; //$pay->customer_name = $trans['merch_name']; $pay->save(); if (empty($order->check)) { $message = "Dear {$order->firstname} {$order->lastname},<br/><br/>You have just attempted making payment for order #{$order->id} on {$order->store_url}. Find the details below.<br/><br/>Name : {$order->firstname} {$order->lastname} <br/><br/>Phone number : {$order->telephone} <br/><br/>Amount : " . UtilityHelper::formatPrice($trans['amount']) . " <br/><br/>Transaction Date : {$trans['txn_date']} <br/><br/>Payment Method : {$trans['pmt_method']} <br/><br/>Payment Status : {$pay->response_code} <br/><br/>Transaction Reference Number : {$trans['pmt_txnref']} <br/><br/>Currency : {$trans['currency']} <br/><br/>Transaction Status : {$trans['trans_status']} <br/><br/>"; if ($trans['pmt_status'] == 'successful' && $trans['amount'] == $trans['merch_amt']) { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Successful Payment Notification', $message); //UtilityHelper::changeOrderStatus($order->id); $order->order_status_id = 2; $order->check = 1; $order->save(); UtilityHelper::subtractOrder($order->id); } else { if ($trans['pmt_status'] == 'pending') { } else { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Failed Payment Notification', $message); //UtilityHelper::changeOrderStatus($order->id,10); $order->order_status_id = 10; $order->check = 1; $order->save(); } } } return $order; } return false; }
?> <h5>Name : <?php echo $response['CustomerName']; ?> </h5> <h5>Transaction Reference #: <?php echo $ref; ?> </h5> <h5>Payment Reference: <?php echo $response['PaymentReference']; ?> </h5> <h5>Payment Status Description: <?php echo $response['ResponseDescription']; ?> </h5> <h5>Payment Response Code: <?php echo $response['ResponseCode']; ?> </h5> <h5>Amount: <?php echo UtilityHelper::formatPrice($response['Amount'] / 100); ?> </h5> <h5>Transaction Date : <?php echo $response['TransactionDate']; ?> </h5> </div> </div>
protected function completePaymentTransaction($response) { $order = Order::model()->findByAttributes(array('payment_code' => $response['invoice'])); $pay = PaymentTransaction::model()->findByAttributes(array('reference_number' => $response['invoice'])); $pay->query_code = $response['process_code']; $pay->response_description = $response['message']; $pay->response_code = $response['status']; $pay->approved_amount = $response['total']; $pay->save(); $total = UtilityHelper::formatPrice($order->total); $siteurl = UtilityHelper::yiiparam('siteUrl'); if (empty($order->check)) { $messg = "Dear {$order->firstname} {$order->lastname},<br/><br/>You have just attempted making payment for order #{$order->id} on {$order->store_url}. Find the details below.<br/><br/>Amount: {$total}<br/><br/>Response Description: {$response['message']}<br/><br/>Response Code: {$response['process_code']}<br/><br/>Transaction Ref No: {$response['invoice']}<br/><br/>Payment Reference: {$response['transaction_id']}<br/><br/>Transaction Date: " . date("D/M/Y") . "<br/>"; } else { if ($response['status'] == 'SUCCESS') { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Successful Payment Notification', $messg); $order->order_status_id = 2; $order->check = 1; $order->save(); UtilityHelper::subtractOrder($order->id); } else { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Failed Payment Notification', $messg); $order->order_status_id = 10; $order->check = 1; $order->save(); } } $this->logResults($response['status']); }