Example #1
0
$data_get = $_GET;
$data_post = $_POST;
$merchant_default_country = Yii::app()->functions->getOptionAdmin('merchant_default_country');
$package_id = isset($_GET['package_id']) ? $_GET['package_id'] : '';
$mode_autho = Yii::app()->functions->getOptionAdmin('admin_mode_autho');
$autho_api_id = Yii::app()->functions->getOptionAdmin('admin_autho_api_id');
$autho_key = Yii::app()->functions->getOptionAdmin('admin_autho_key');
if (empty($mode_autho) && empty($autho_api_id) && empty($autho_key)) {
    $error = t("Authorize.net is not properly configured");
}
if ($res = Yii::app()->functions->getSMSPackagesById($package_id)) {
    $amount_to_pay = $res['price'];
    if ($res['promo_price'] > 0) {
        $amount_to_pay = $res['promo_price'];
    }
    $amount_to_pay = is_numeric($amount_to_pay) ? normalPrettyPrice($amount_to_pay) : '';
    $amount_to_pay = unPrettyPrice($amount_to_pay);
    $payment_description .= isset($res['title']) ? $res['title'] : '';
    /*dump($amount_to_pay);
    	dump($payment_description);*/
    if (isset($_POST['x_card_num'])) {
        define("AUTHORIZENET_API_LOGIN_ID", $autho_api_id);
        define("AUTHORIZENET_TRANSACTION_KEY", $autho_key);
        define("AUTHORIZENET_SANDBOX", $mode_autho == "sandbox" ? true : false);
        //define("TEST_REQUEST", $mode_autho=="sandbox"?"FALSE":"TRUE");
        require_once 'anet_php_sdk/AuthorizeNet.php';
        $transaction = new AuthorizeNetAIM();
        $transaction->setSandbox(AUTHORIZENET_SANDBOX);
        $params = array('description' => $payment_description, 'amount' => $amount_to_pay, 'card_num' => $_POST['x_card_num'], 'exp_date' => $_POST['expiration_month'] . "/" . $_POST['expiration_yr'], 'first_name' => $_POST['x_first_name'], 'last_name' => $_POST['x_last_name'], 'address' => $_POST['x_address'], 'city' => $_POST['x_city'], 'state' => $_POST['x_state'], 'country' => $_POST['x_country'], 'zip' => $_POST['x_zip'], 'card_code' => $_POST['cvv']);
        $transaction->setFields($params);
        $response = $transaction->authorizeAndCapture();
Example #2
0
            ?>
		       <?php 
        }
        ?>
		       
		       <?php 
        if ($data['order_change'] >= 0.1) {
            ?>
	
				<div class="input-block">
		         <div class="label"><?php 
            echo Yii::t("default", "Change");
            ?>
 :</div>
		         <div class="value"><?php 
            echo displayPrice(baseCurrency(), normalPrettyPrice($data['order_change']));
            ?>
</div>
		         <div class="clear"></div>
		       </div>		       
		       <?php 
            $print[] = array('label' => Yii::t("default", "Change"), 'value' => $data['order_change']);
            ?>
				<?php 
        }
        ?>
 
		       
	       
	       <?php 
    }
Example #3
0
 public function merchantPayment()
 {
     $token = isset($this->data['token']) ? $this->data['token'] : '';
     if (isset($this->data['payment_opt'])) {
         if (!($merchant = Yii::app()->functions->getMerchantByToken($token))) {
             $this->msg = Yii::t("default", "ERROR: cannot get merchant information");
             return;
         }
         if ($this->data['payment_opt'] == "ccr") {
             if (is_numeric($this->data['cc_id'])) {
                 if (isset($this->data['renew'])) {
                     $membership_info = Yii::app()->functions->upgradeMembership($merchant['merchant_id'], $this->data['package_id']);
                     $params = array('package_id' => $this->data['package_id'], 'merchant_id' => $merchant['merchant_id'], 'price' => $membership_info['package_price'], 'payment_type' => $this->data['payment_opt'], 'mt_id' => $this->data['cc_id'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'membership_expired' => $membership_info['membership_expired']);
                     $this->insertData("{{package_trans}}", $params);
                     $params_update = array('package_id' => $this->data['package_id'], 'package_price' => $membership_info['package_price'], 'membership_expired' => $membership_info['membership_expired'], 'membership_purchase_date' => date('c'), 'status' => 'active');
                     $this->updateData("{{merchant}}", $params_update, 'merchant_id', $merchant['merchant_id']);
                     $this->code = 1;
                     $this->msg = Yii::t("default", "Payment Successful");
                 } else {
                     $params = array('package_id' => $merchant['package_id'], 'merchant_id' => $merchant['merchant_id'], 'price' => $merchant['package_price'], 'payment_type' => $this->data['payment_opt'], 'mt_id' => $this->data['cc_id'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR']);
                     if ($package = Yii::app()->functions->getPackagesById($merchant['package_id'])) {
                         $expiration = $package['expiration'];
                         $membership_expired = date('Y-m-d', strtotime("+{$expiration} days"));
                         $params['membership_expired'] = $membership_expired;
                     }
                     if ($this->insertData("{{package_trans}}", $params)) {
                         $this->code = 1;
                         $this->msg = Yii::t("default", "Payment Successful");
                         $this->details = $token;
                         $this->updateData("{{merchant}}", array('payment_steps' => 3, 'membership_purchase_date' => date('c')), 'merchant_id', $merchant['merchant_id']);
                     } else {
                         $this->msg = Yii::t("default", "ERROR: Cannot insert records.");
                     }
                 }
             } else {
                 $this->msg = Yii::t("default", "Please select credit card.");
             }
         } elseif ($this->data['payment_opt'] == "pyp") {
             if (isset($this->data['renew'])) {
                 if ($new_info = Yii::app()->functions->getPackagesById($this->data['package_id'])) {
                     $package_price = $new_info['price'];
                     if ($new_info['promo_price'] > 0) {
                         $package_price = $new_info['promo_price'];
                     }
                     $merchant['package_name'] = $new_info['title'];
                     $merchant['package_id'] = $new_info['package_id'];
                 } else {
                     $package_price = 0;
                 }
             } else {
                 $package_price = $merchant['package_price'];
             }
             $paypal_con = Yii::app()->functions->getPaypalConnectionAdmin();
             $params = '';
             $x = 0;
             $params['L_NAME' . $x] = isset($merchant['package_name']) ? $merchant['package_name'] : Yii::t("default", "No description");
             $params['L_NUMBER' . $x] = $merchant['package_id'];
             $params['L_DESC' . $x] = isset($merchant['package_name']) ? $merchant['package_name'] : Yii::t("default", "No description");
             $params['L_AMT' . $x] = normalPrettyPrice($package_price);
             $params['L_QTY' . $x] = 1;
             $params['AMT'] = normalPrettyPrice($package_price);
             /** add card fee */
             $card_fee = Yii::app()->functions->getOptionAdmin('admin_paypal_fee');
             if (!empty($card_fee) && $card_fee >= 0.1) {
                 $x++;
                 $params['L_NAME' . $x] = t("Card Fee");
                 $params['L_DESC' . $x] = t("Card Fee");
                 $params['L_AMT' . $x] = normalPrettyPrice($card_fee);
                 $params['L_QTY' . $x] = 1;
                 $params['AMT'] = $params['AMT'] + $card_fee;
             }
             if (isset($this->data['renew'])) {
                 $params['RETURNURL'] = "http://" . $_SERVER['HTTP_HOST'] . Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3a/internal-token/{$token}/renew/1/package_id/" . $this->data['package_id'];
             } else {
                 $params['RETURNURL'] = "http://" . $_SERVER['HTTP_HOST'] . Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3a/internal-token/{$token}";
             }
             $params['CANCELURL'] = "http://" . $_SERVER['HTTP_HOST'] . Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3/token/{$token}";
             $params['NOSHIPPING'] = '1';
             $params['LANDINGPAGE'] = 'Billing';
             $params['SOLUTIONTYPE'] = 'Sole';
             $params['CURRENCYCODE'] = adminCurrencyCode();
             $paypal = new Paypal($paypal_con);
             $paypal->params = $params;
             $paypal->debug = false;
             if ($resp = $paypal->setExpressCheckout()) {
                 $this->code = 1;
                 $this->msg = Yii::t("default", "Please wait while we redirect you to paypal.");
                 $this->details = $resp['url'];
             } else {
                 $this->msg = $paypal->getError();
             }
         } elseif ($this->data['payment_opt'] == "stp") {
             /*STRIPE*/
             $this->code = 1;
             $this->msg = Yii::t("default", "Please wait while we redirect you to stripe");
             $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}";
             if (isset($this->data['renew'])) {
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/renew/1/package_id/" . $this->data['package_id'];
             }
         } elseif ($this->data['payment_opt'] == "mcd") {
             /*MERCADO*/
             $this->code = 1;
             $this->msg = Yii::t("default", "Please wait while we redirect you to mercadopago");
             $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/mcd";
             if (isset($this->data['renew'])) {
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/mcd/renew/1/package_id/" . $this->data['package_id'];
             }
         } elseif ($this->data['payment_opt'] == "pyl") {
             /*PAYLINE*/
             $this->code = 1;
             $this->msg = Yii::t("default", "Please wait while we redirect you to payline");
             $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/pyl";
             if (isset($this->data['renew'])) {
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/pyl/renew/1/package_id/" . $this->data['package_id'];
             }
         } elseif ($this->data['payment_opt'] == "ide") {
             /*PAYLINE*/
             $this->code = 1;
             $this->msg = Yii::t("default", "Please wait while we redirect you to Sisow");
             $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/ide";
             if (isset($this->data['renew'])) {
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/ide/renew/1/package_id/" . $this->data['package_id'];
             }
         } elseif ($this->data['payment_opt'] == "payu") {
             /*PAYLINE*/
             $this->code = 1;
             $this->msg = Yii::t("default", "Please wait while we redirect you to PayUMoney");
             $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/payu";
             if (isset($this->data['renew'])) {
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/payu/renew/1/package_id/" . $this->data['package_id'];
             }
         } elseif ($this->data['payment_opt'] == "obd") {
             // offline bank deposit
             if (Yii::app()->functions->offlineBankDeposit($merchant, $this->data)) {
                 $this->code = 1;
                 $this->msg = Yii::t("default", "Thank You. an email has been sent to your email.");
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/thankyou3/token/{$token}/";
             } else {
                 $this->msg = Yii::t("default", "Error: cannot send bank instructions email");
             }
         } elseif ($this->data['payment_opt'] == "pys") {
             // paysera
             $this->code = 1;
             $this->msg = Yii::t("default", "Please wait while we redirect you to paysera");
             $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/pys";
             if (isset($this->data['renew'])) {
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/pys/renew/1/package_id/" . $this->data['package_id'];
             }
         } elseif ($this->data['payment_opt'] == "bcy") {
             // barclay
             $this->code = 1;
             $this->msg = Yii::t("default", "Please wait while we redirect you");
             $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/" . $this->data['payment_opt'];
             if (isset($this->data['renew'])) {
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/bcy/renew/1/package_id/" . $this->data['package_id'];
             }
         } elseif ($this->data['payment_opt'] == "epy") {
             // EpayBg
             $this->code = 1;
             $this->msg = Yii::t("default", "Please wait while we redirect you");
             $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/" . $this->data['payment_opt'];
             if (isset($this->data['renew'])) {
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/epy/renew/1/package_id/" . $this->data['package_id'];
             }
         } else {
             if (isset($this->data['payment_opt'])) {
                 $this->code = 1;
                 $this->msg = Yii::t("default", "Please wait while we redirect you");
                 $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/" . $this->data['payment_opt'];
                 if (isset($this->data['renew'])) {
                     $this->details = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3b/token/{$token}/gateway/" . $this->data['payment_opt'] . "/renew/1/package_id/" . $this->data['package_id'];
                 }
             } else {
                 $this->msg = Yii::t("default", "No payment method has been selected.");
             }
         }
     } else {
         $this->msg = Yii::t("default", "Please select payment option");
     }
 }
Example #4
0
$is_merchant = true;
$amount_to_pay = 0;
$payment_description = Yii::t("default", 'Payment to merchant');
$back_url = Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step3/token/{$my_token}";
$payment_ref = Yii::app()->functions->generateCode() . "TT" . Yii::app()->functions->getLastIncrement('{{order}}');
$forms = '';
if ($res = Yii::app()->functions->getMerchantByToken($my_token)) {
    $admin_barclay_mode = Yii::app()->functions->getOptionAdmin('admin_mode_barclay');
    if ($admin_barclay_mode == "sandbox") {
        $pspid = Yii::app()->functions->getOptionAdmin('admin_sandbox_barclay_pspid');
        $psp_pass = Yii::app()->functions->getOptionAdmin('admin_sandbox_barclay_password');
    } else {
        $pspid = Yii::app()->functions->getOptionAdmin('admin_live_barclay_pspid');
        $psp_pass = Yii::app()->functions->getOptionAdmin('admin_live_barclay_password');
    }
    $amount_to_pay = normalPrettyPrice($res['package_price']);
    $amount_to_pay = number_format($amount_to_pay, 2, '.', '');
    $params['AMOUNT'] = $amount_to_pay * 100;
    if (isset($_GET['renew'])) {
        if ($new_info = Yii::app()->functions->getPackagesById($_GET['package_id'])) {
            if ($new_info['promo_price'] >= 1) {
                $amount_to_pay = $new_info['promo_price'];
            } else {
                $amount_to_pay = $new_info['price'];
            }
        }
        $amount_to_pay = number_format($amount_to_pay, 2, '.', '');
        $params['AMOUNT'] = $amount_to_pay * 100;
    }
    $params['BGCOLOR'] = Yii::app()->functions->getOptionAdmin('admin_bcy_bgcolor');
    $params['BUTTONBGCOLOR'] = Yii::app()->functions->getOptionAdmin('admin_bcy_buttoncolor');
Example #5
0
  <label class="uk-form-label"><?php 
echo Yii::t("default", "Type");
?>
</label>  
  <?php 
echo CHtml::dropDownList('voucher_type', $data['voucher_type'], Yii::app()->functions->voucherType(), array('data-validation' => "required"));
?>
</div>

<div class="uk-form-row">
  <label class="uk-form-label"><?php 
echo Yii::t("default", "Discount");
?>
</label>  
  <?php 
echo CHtml::textField('amount', normalPrettyPrice($data['amount']), array('data-validation' => 'required', 'class' => 'numeric_only'));
?>
  <span class="uk-text-muted"><?php 
echo Yii::t("default", "Voucher amount discount.");
?>
</span>
</div>

<div class="uk-form-row">
  <label class="uk-form-label"><?php 
echo Yii::t("default", "Expiration");
?>
</label>  
  <?php 
echo CHtml::hiddenField('expiration', $data['expiration']);
echo CHtml::textField('expiration1', FormatDateTime($data['expiration'], false), array('class' => 'j_date', 'data-id' => 'expiration', 'data-validation' => "required"));
Example #6
0
<div class="uk-form-row">
  <label class="uk-form-label"><?php 
echo Yii::t("default", "commission on orders");
?>
</label>
  <?php 
$percent_commision = Yii::app()->functions->getOptionAdmin('admin_commision_percent');
if ($data['percent_commision'] <= 0) {
    $data['percent_commision'] = $percent_commision;
}
$commision_type = Yii::app()->functions->getOptionAdmin('admin_commision_type');
if (!empty($data['commision_type'])) {
    $data['commision_type'] = $data['commision_type'];
}
echo CHtml::dropDownList('commision_type', $data['commision_type'], array('fixed' => "Fixed", 'percentage' => "Percentage"));
echo CHtml::textField('percent_commision', normalPrettyPrice($data['percent_commision']), array('class' => "uk-form-width-small"));
?>
</div>

<p class="uk-text-danger">
<?php 
echo t("Note: If this is ticked, the merchant will be charged commission per order and membership package will be ignored");
?>
</p>


<?php 
$merchant_id = isset($_GET['id']) ? $_GET['id'] : '';
?>
<h3><?php 
echo t("Offline Payment Option");
Example #7
0
"><?php 
echo t("Withdraw money");
?>
</a>
   </div>
  </li>
  
  
  <li>
   <div class="rounded-box rounded">
     <p><?php 
echo t("Total value of your item sales");
?>
:</p>
     <h3><?php 
echo displayPrice(adminCurrencySymbol(), normalPrettyPrice($sale_total));
?>
</h3>
     <!--<P class="small"><?php 
echo t("based on list price of each item");
?>
</P>-->
     <P class="small"><?php 
echo t("From");
?>
:<?php 
echo $total_sale_count;
?>
 <?php 
echo t("orders");
?>
Example #8
0
$step2 = false;
$amount_to_pay = 0;
$payment_description = '';
$secret_key = '';
$publishable_key = '';
$transaction_type = isset($_GET['type']) ? $_GET['type'] : '';
$payment_code = Yii::app()->functions->paymentCode("stripe");
$package_id = isset($_GET['package_id']) ? $_GET['package_id'] : '';
$my_token = md5(Yii::app()->functions->generateCode());
if ($res = Yii::app()->functions->getSMSPackagesById($package_id)) {
    $payment_ref = Yii::app()->functions->generateCode() . "TT" . Yii::app()->functions->getLastIncrement('{{barclay_trans}}');
    $amount_to_pay = $res['price'];
    if ($res['promo_price'] > 0) {
        $amount_to_pay = $res['promo_price'];
    }
    $amount_to_pay = normalPrettyPrice($amount_to_pay);
    $amount_to_pay = number_format($amount_to_pay, 2, '.', '');
    $payment_description .= isset($res['title']) ? $res['title'] : '';
    /*dump($amount_to_pay);
    	dump($payment_description);*/
    $mode = Yii::app()->functions->getOptionAdmin('admin_mode_epaybg');
    $mode = strtolower($mode);
    if ($mode == "sandbox") {
        $params['mode'] = 'sandbox';
        $min = Yii::app()->functions->getOptionAdmin('admin_sandbox_epaybg_min');
        $secret = Yii::app()->functions->getOptionAdmin('admin_sandbox_epaybg_secret');
        $page = Yii::app()->functions->getOptionAdmin('admin_sandbox_epaybg_request');
        $lang = Yii::app()->functions->getOptionAdmin('admin_sandbox_epaybg_lang');
    } else {
        $params['mode'] = 'live';
        $min = Yii::app()->functions->getOptionAdmin('admin_live_epaybg_min');
Example #9
0
 public function actionProcessPayout()
 {
     $db_ext = new DbExt();
     $paypal_client_id = yii::app()->functions->getOptionAdmin('wd_paypal_client_id');
     $paypal_client_secret = yii::app()->functions->getOptionAdmin('wd_paypal_client_secret');
     $paypal_config = Yii::app()->functions->getPaypalConnectionWithdrawal();
     dump($paypal_config);
     $Paypal = new Paypal($paypal_config);
     $Paypal->debug = true;
     $website_title = yii::app()->functions->getOptionAdmin('website_title');
     $cron = new CronFunctions();
     if ($res = $cron->getPayoutToProcess()) {
         if (is_array($res) && count($res) >= 1) {
             foreach ($res as $val) {
                 $withdrawal_id = $val['withdrawal_id'];
                 $api_raw_response = '';
                 $status_msg = '';
                 dump($val);
                 switch ($val['payment_method']) {
                     case "paypal":
                         dump("Process paypal");
                         //if (!empty($paypal_client_id) && !empty($paypal_client_secret)){
                         if (is_array($paypal_config) && count($paypal_config) >= 1) {
                             if ($val['account'] != "") {
                                 $Paypal->params['RECEIVERTYPE'] = "EmailAddress";
                                 $Paypal->params['CURRENCYCODE'] = "USD";
                                 $Paypal->params['EMAILSUBJECT'] = "=You have a payment from " . $website_title;
                                 $Paypal->params['L_EMAIL0'] = $val['account'];
                                 $Paypal->params['L_AMT0'] = normalPrettyPrice($val['amount']);
                                 $Paypal->params['L_UNIQUEID0'] = str_pad($val['withdrawal_id'], 10, "0");
                                 if ($pay_resp = $Paypal->payout()) {
                                     dump($pay_resp);
                                     if ($pay_resp['ACK'] == "Success") {
                                         $status_msg = 'paid';
                                         $api_raw_response = json_encode($pay_resp);
                                     } else {
                                         $api_raw_response = json_encode($pay_resp);
                                         $status_msg = $pay_resp['L_LONGMESSAGE0'];
                                     }
                                 } else {
                                     $status_msg = $Paypal->getError();
                                 }
                             } else {
                                 $status_msg = t("Paypal account is empty");
                             }
                         } else {
                             $status_msg = t("Payout settings for paypal not yet set");
                         }
                         break;
                     case "bank":
                         $status_msg = 'paid';
                         break;
                 }
                 echo "<h3>Update status</h3>";
                 dump($api_raw_response);
                 dump($status_msg);
                 $params_update = array('date_process' => date('c'), 'api_raw_response' => $api_raw_response, 'status' => $status_msg);
                 dump($params_update);
                 if ($db_ext->updateData("{{withdrawal}}", $params_update, 'withdrawal_id', $withdrawal_id)) {
                     echo "<h2>Update ok</h2>";
                 } else {
                     echo "<h2>Update Failed</h2>";
                 }
                 if ($status_msg == "paid") {
                     // send email
                     $subject = yii::app()->functions->getOptionAdmin('wd_template_process_subject');
                     if (empty($subject)) {
                         $subject = t("Your Request for Withdrawal has been Processed");
                     }
                     if ($merchant_info = Yii::app()->functions->getMerchant($val['merchant_id'])) {
                         $merchant_email = $merchant_info['contact_email'];
                         $tpl = yii::app()->functions->getOptionAdmin('wd_template_process');
                         $tpl = smarty("merchant-name", $merchant_info['restaurant_name'], $tpl);
                         $tpl = smarty("payout-amount", standardPrettyFormat($val['amount']), $tpl);
                         $tpl = smarty("payment-method", $val['payment_method'], $tpl);
                         $tpl = smarty("acoount", $val['account'], $tpl);
                         dump($tpl);
                         if (!empty($tpl)) {
                             sendEmail($merchant_email, '', $subject, $tpl);
                         }
                     }
                 }
             }
         }
     } else {
         dump("No record to process");
     }
 }
   <?php 
    foreach ($res as $val) {
        ?>
  
        <?php 
        $account = $val['account'];
        $method = "Paypal to {$account}";
        if ($val['payment_method'] == "bank") {
            $account = $val['bank_account_number'];
            $method = "Bank account to {$account}";
        }
        ?>
      
        <tr>                        
            <td><?php 
        echo displayPrice(adminCurrencySymbol(), normalPrettyPrice($val['amount']));
        ?>
</td>            
            <td><?php 
        echo $method;
        ?>
</td>            
            <td><?php 
        echo prettyDate($val['date_process']);
        ?>
</td>
            <td><?php 
        echo $val['status'];
        ?>
</td>            
        </tr>
Example #11
0
 public function actionIndex()
 {
     $db_ext = new DbExt();
     $error = '';
     $package_id = isset($_GET['package_id']) ? $_GET['package_id'] : '';
     $amount_to_pay = 0;
     $back_url = Yii::app()->request->baseUrl . "/merchant/purchasesms";
     $payment_ref = Yii::app()->functions->generateCode() . "TT" . Yii::app()->functions->getLastIncrement('{{sms_package_trans}}');
     $package_id = isset($_GET['package_id']) ? $_GET['package_id'] : '';
     $merchant_id = Yii::app()->functions->getMerchantID();
     if ($res = Yii::app()->functions->getSMSPackagesById($package_id)) {
         $amount_to_pay = $res['price'];
         if ($res['promo_price'] > 0) {
             $amount_to_pay = $res['promo_price'];
         }
         $amount_to_pay = is_numeric($amount_to_pay) ? normalPrettyPrice($amount_to_pay) : '';
         $payment_description .= isset($res['title']) ? $res['title'] : '';
         /*dump($payment_description);
         		dump($amount_to_pay);
         		dump($payment_ref);*/
         $amount_to_pay = number_format($amount_to_pay, 2, '.', '');
         $cancel_url = Yii::app()->getBaseUrl(true) . "/merchant/purchasesms";
         $accepturl = Yii::app()->getBaseUrl(true) . "/merchant/pysinit/?type=purchaseSMScredit&package_id=" . $package_id . "&mode=accept&mtid={$merchant_id}";
         $callback = Yii::app()->getBaseUrl(true) . "/paysera/?type=purchaseSMScredit&package_id=" . $package_id . "&mode=callback&mtid={$merchant_id}";
         $country = Yii::app()->functions->getOptionAdmin('admin_paysera_country');
         $mode = Yii::app()->functions->getOptionAdmin('admin_paysera_mode');
         $lang = Yii::app()->functions->getOptionAdmin('admin_paysera_lang');
         $currency = Yii::app()->functions->adminCurrencyCode();
         $projectid = Yii::app()->functions->getOptionAdmin('admin_paysera_project_id');
         $password = Yii::app()->functions->getOptionAdmin('admin_paysera_password');
         if (isset($_GET['mode'])) {
             if ($_GET['mode'] == "accept") {
                 $payment_code = Yii::app()->functions->paymentCode("paysera");
                 $params = array('merchant_id' => $_GET['mtid'], 'sms_package_id' => $package_id, 'payment_type' => $payment_code, 'package_price' => $amount_to_pay, 'sms_limit' => isset($res['sms_limit']) ? $res['sms_limit'] : '', 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_gateway_response' => json_encode($_GET));
                 $db_ext->insertData("{{sms_package_trans}}", $params);
                 header('Location: ' . Yii::app()->request->baseUrl . "/merchant/smsReceipt/id/" . Yii::app()->db->getLastInsertID());
                 die;
             }
             try {
                 $response = WebToPay::checkResponse($_GET, array('projectid' => $projectid, 'sign_password' => $password));
                 if (is_array($response) && count($response) >= 1) {
                     if ($response['status'] == 0) {
                         die("payment has no been executed");
                     }
                     if ($response['status'] == 3) {
                         die("additional payment information");
                     }
                     $stmt = "SELECT * FROM\r\n\t\t            \t{{sms_package_trans}}\r\n\t\t            \tWHERE\r\n\t\t            \tmerchant_id ='" . $_GET['mtid'] . "'\r\n\t\t            \tAND\r\n\t\t            \tsms_package_id='" . $_GET['package_id'] . "'\r\n\t\t            \tORDER BY id DESC\r\n\t\t            \tLIMIT 0,1\r\n\t\t            \t";
                     if ($res2 = $db_ext->rst($stmt)) {
                         $current_id = $res2[0]['id'];
                         $params_update = array('status' => "paid");
                         $db_ext->updateData("{{sms_package_trans}}", $params_update, 'id', $current_id);
                     }
                     echo 'OK';
                     die;
                 } else {
                     $error = t("ERROR: api returns empty");
                 }
             } catch (WebToPayException $e) {
                 $error = t("ERROR: Something went wrong") . ". " . $e;
             }
         } else {
             echo 'init';
         }
     } else {
         $error = Yii::t("default", "Failed. Cannot process payment");
     }
     if (!empty($error)) {
         //$this->render('error',array('message'=>$error));
         echo $error;
     }
     //$this->createLogs('');
 }
Example #12
0
<?php 
if ($res = Yii::app()->functions->getWithdrawalInformation($withdrawal_id)) {
    $wd_days_process = Yii::app()->functions->getOptionAdmin("wd_days_process");
    if (empty($wd_days_process)) {
        $wd_days_process = 5;
    }
    $process_date = date("d F Y", strtotime($res['date_created'] . " +{$wd_days_process} days"));
    ?>

<p>
<?php 
    echo t("Your withdrawal request has been sent to admin");
    ?>
.<br/>
<?php 
    echo t("Total Amount") . " " . displayPrice(adminCurrencySymbol(), normalPrettyPrice($res['amount']));
    ?>
</p>
<p>
<?php 
    echo t("We will complete this request on the");
    ?>
 <?php 
    echo $process_date . " ";
    echo t("(or the next business day), but it can take up to 7 days to appear in your account. A second confirmation email will be sent at this time");
    ?>
</p>

<?php 
} else {
    ?>
Example #13
0
 public function SMSnotificationMerchant($merchant_id = '', $order_info = '', $data = '')
 {
     $db_ext = new DbExt();
     $sms_enabled_alert = Yii::app()->functions->getOption("sms_enabled_alert", $merchant_id);
     $sms_notify_number = Yii::app()->functions->getOption("sms_notify_number", $merchant_id);
     $sms_alert_message = Yii::app()->functions->getOption("sms_alert_message", $merchant_id);
     $sms_alert_message = $this->smarty("customer-name", $order_info['full_name'], $sms_alert_message);
     $item_order = '';
     if (is_array($data) && count($data) >= 1) {
         $in_msg = t("OrderNo:") . $order_info['order_id'] . " ";
         $in_msg .= t("ClientName:") . $order_info['full_name'] . " ";
         foreach ($data['item'] as $val) {
             $item_order .= "(" . $val['qty'] . "x)" . $val['item_name'] . " " . $val['order_notes'] . ",";
             if (is_array($val['sub_item']) && count($val['sub_item']) >= 1) {
                 foreach ($val['sub_item'] as $sub_val) {
                     $item_order .= $sub_val['addon_category'] . ":";
                     $item_order .= "(" . $sub_val['addon_qty'] . "x)" . $sub_val['addon_name'];
                     $item_order .= ", ";
                 }
             }
         }
         $item_order = substr($item_order, 0, -1);
         $sms_alert_message = $this->smarty("receipt", $in_msg . $item_order, $sms_alert_message);
     }
     $sms_alert_message = $this->smarty("orderno", $order_info['order_id'], $sms_alert_message);
     $sms_alert_message = $this->smarty("customername", $order_info['full_name'], $sms_alert_message);
     $sms_alert_message = $this->smarty("customermobile", $order_info['merchant_contact_phone'], $sms_alert_message);
     $sms_alert_message = $this->smarty("customeraddress", $order_info['full_address'], $sms_alert_message);
     $sms_alert_message = $this->smarty("amount", displayPrice(baseCurrency(), normalPrettyPrice($order_info['total_w_tax'])), $sms_alert_message);
     $sms_alert_message = $this->smarty("website-ddress", "http://" . $_SERVER['HTTP_HOST'], $sms_alert_message);
     $sms_alert_message = $this->smarty("website-address", "http://" . $_SERVER['HTTP_HOST'], $sms_alert_message);
     //dump($order_info);
     //send sms to customer
     $client_sms = Yii::app()->functions->getOption("sms_alert_customer", $merchant_id);
     $client_contact_phone = $order_info['contact_phone'];
     if (!empty($client_sms) && !empty($client_contact_phone)) {
         $client_sms = $this->smarty("customer-name", $order_info['full_name'], $client_sms);
         $client_sms = $this->smarty("orderno", $order_info['order_id'], $client_sms);
         $client_sms = $this->smarty("merchantname", $order_info['merchant_name'], $client_sms);
         $client_sms = $this->smarty("merchantphone", $order_info['merchant_contact_phone'], $client_sms);
         $client_sms = $this->smarty("website-ddress", "http://" . $_SERVER['HTTP_HOST'], $client_sms);
         $client_sms = $this->smarty("website-address", "http://" . $_SERVER['HTTP_HOST'], $client_sms);
     }
     $sms_provider = Yii::app()->functions->getOptionAdmin('sms_provider');
     $sms_provider = strtolower($sms_provider);
     if ($sms_enabled_alert == 1 && !empty($sms_notify_number) && !empty($sms_alert_message)) {
         $sms_notify_number_s = explode(",", $sms_notify_number);
         if (is_array($sms_notify_number_s) && count($sms_notify_number_s) >= 1) {
             $x_counter = 1;
             foreach ($sms_notify_number_s as $sms_notify_number) {
                 $balance = $this->getMerchantSMSCredit($merchant_id);
                 if (is_numeric($balance) && $balance >= 1) {
                     //dump($sms_notify_number);
                     $resp = $this->sendSMS($sms_notify_number, $sms_alert_message);
                     $params = array('merchant_id' => $merchant_id, 'broadcast_id' => "999999999", 'client_id' => $order_info['client_id'], 'client_name' => $order_info['full_name'], 'contact_phone' => $sms_notify_number, 'sms_message' => $sms_alert_message, 'status' => $resp['msg'], 'gateway_response' => $resp['raw'], 'date_created' => date('c'), 'date_executed' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'gateway' => $sms_provider);
                     $db_ext->insertData("{{sms_broadcast_details}}", $params);
                     if ($x_counter == 1) {
                         if (!empty($client_sms) && !empty($client_contact_phone)) {
                             $resp2 = $this->sendSMS($client_contact_phone, $client_sms);
                             $params = array('merchant_id' => $merchant_id, 'broadcast_id' => "999999999", 'client_id' => $order_info['client_id'], 'client_name' => $order_info['full_name'], 'contact_phone' => $client_contact_phone, 'sms_message' => $client_sms, 'status' => $resp['msg'], 'gateway_response' => $resp['raw'], 'date_created' => date('c'), 'date_executed' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'gateway' => $sms_provider);
                             $db_ext->insertData("{{sms_broadcast_details}}", $params);
                         }
                     }
                 }
                 $x_counter++;
             }
         }
     }
 }
Example #14
0
 $params['CANCELURL'] = "http://" . $_SERVER['HTTP_HOST'] . Yii::app()->request->baseUrl . "/store/PaymentOption";
 $params['NOSHIPPING'] = '1';
 $params['LANDINGPAGE'] = 'Billing';
 $params['SOLUTIONTYPE'] = 'Sole';
 $params['CURRENCYCODE'] = Yii::app()->functions->adminCurrencyCode();
 /** add card fee */
 if (Yii::app()->functions->isMerchantCommission($merchant_id)) {
     $card_fee = Yii::app()->functions->getOptionAdmin('admin_paypal_fee');
 } else {
     $card_fee = Yii::app()->functions->getOption('merchant_paypal_fee', $merchant_id);
 }
 if (!empty($card_fee) && $card_fee >= 0.1) {
     $x++;
     $params['L_NAME' . $x] = t("Card Fee");
     $params['L_DESC' . $x] = t("Card Fee");
     $params['L_AMT' . $x] = normalPrettyPrice($card_fee);
     $params['L_QTY' . $x] = 1;
     $params['AMT'] = $params['AMT'] + $card_fee;
 }
 /*dump($params);
   die();*/
 $paypal = new Paypal($paypal_con);
 $paypal->params = $params;
 $paypal->debug = false;
 if ($resp = $paypal->setExpressCheckout()) {
     $insert['token'] = $resp['token'];
     $insert['order_id'] = isIsset($_GET['id']);
     $insert['date_created'] = date('c');
     $insert['ip_address'] = $_SERVER['REMOTE_PORT'];
     $insert['paypal_request'] = json_encode($paypal->params);
     $insert['paypal_response'] = json_encode($resp['resp']);
Example #15
0
 public function VoucherListNew()
 {
     $slug = $this->data['slug'];
     $and = '';
     if (isset($this->data['voucher_owner'])) {
         $stmt = "\n\t\t\t\tSELECT a.*,\n\t\t\t\t(\n\t\t\t\tselect count(*) \n\t\t\t\tfrom\n\t\t\t\t{{order}}\n\t\t\t\twhere\n\t\t\t\tvoucher_code=a.voucher_name\t\t\t\n\t\t\t\t) as total_used\n\t\t\t\tFROM\n\t\t\t\t{{voucher_new}} a\n\t\t\t\tWHERE\n\t\t\t\tvoucher_owner=" . Yii::app()->db->quoteValue($this->data['voucher_owner']) . "\n\t\t\t\tORDER BY voucher_id DESC\n\t\t\t\t";
     } else {
         $merchant_id = Yii::app()->functions->getMerchantID();
         $stmt = "\n\t\t\t\tSELECT a.*,\n\t\t\t\t(\n\t\t\t\tselect count(*) \n\t\t\t\tfrom\n\t\t\t\t{{order}}\n\t\t\t\twhere\n\t\t\t\tvoucher_code=a.voucher_name\t\t\t\n\t\t\t\t) as total_used\n\t\t\t\tFROM\n\t\t\t\t{{voucher_new}} a\n\t\t\t\tWHERE\n\t\t\t\tmerchant_id=" . Yii::app()->db->quoteValue($merchant_id) . "\n\t\t\t\tORDER BY voucher_id DESC\n\t\t\t\t";
     }
     $connection = Yii::app()->db;
     $rows = $connection->createCommand($stmt)->queryAll();
     //dump($rows);
     if (is_array($rows) && count($rows) >= 1) {
         foreach ($rows as $val) {
             $chk = "<input type=\"checkbox\" name=\"row[]\" value=\"{$val['voucher_id']}\" class=\"chk_child\" >";
             $action = "<div class=\"options\">\n    \t    \t\t<a href=\"{$slug}/id/{$val['voucher_id']}\" >" . Yii::t("default", "Edit") . "</a>\n    \t    \t\t<a href=\"javascript:;\" class=\"row_del\" rev=\"{$val['voucher_id']}\" >" . Yii::t("default", "Delete") . "</a>\n    \t    \t\t</div>";
             if ($val['total_used'] > 0) {
                 $used = '<a class="voucher-details" href="javascript:;" data-id="' . $val['voucher_name'] . '">' . $val['total_used'] . '</a>';
             } else {
                 $used = '';
             }
             if ($val['voucher_type'] == "percentage") {
                 $amt = normalPrettyPrice($val['amount']) . " %";
             } else {
                 $amt = normalPrettyPrice($val['amount']);
             }
             $date = FormatDateTime($val['date_created']);
             $feed_data['aaData'][] = array($val['voucher_id'], $val['voucher_name'] . $action, $val['voucher_type'], $amt, FormatDateTime($val['expiration'], false), $used, $date . "<div>" . Yii::t("default", $val['status']) . "</div>");
         }
         $this->otableOutput($feed_data);
     }
     $this->otableNodata();
 }