예제 #1
0
    	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();
        if ($response->approved) {
            $resp_transaction = $response->transaction_id;
            $params = array('merchant_id' => Yii::app()->functions->getMerchantID(), '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($response), 'status' => "paid", 'payment_reference' => $resp_transaction);
            if ($db_ext->insertData("{{sms_package_trans}}", $params)) {
                header('Location: ' . Yii::app()->request->baseUrl . "/merchant/smsReceipt/id/" . Yii::app()->db->getLastInsertID());
            } else {
                $error = Yii::t("default", "ERROR: Cannot insert record.");
            }
        } else {
            $error = $response->response_reason_text;
        }
    }
} else {
    $error = Yii::t("default", "Sorry but we cannot find what your are looking for.");
}
?>
<div class="page-right-sidebar payment-option-page">
  <div class="main">  
  
예제 #2
0
} else {
    $error = Yii::t("default", "Sorry but we cannot find what your are looking for.");
}
if (isset($_POST)) {
    if (is_array($_POST) && count($_POST) >= 1) {
        $step2 = true;
        $token = isset($_POST['stripeToken']) ? $_POST['stripeToken'] : '';
        try {
            $customer = Stripe_Customer::create(array('email' => isset($_POST['stripeEmail']) ? $_POST['stripeEmail'] : '', 'card' => $token));
            $charge = Stripe_Charge::create(array('customer' => $customer->id, 'amount' => $amount_to_pay, 'currency' => Yii::app()->functions->adminCurrencyCode()));
            $chargeArray = $charge->__toArray(true);
            /*dump("pay ->".$chargeArray['paid']);
              echo json_encode($chargeArray);*/
            $db_ext = new DbExt();
            $params_logs = array('order_id' => $_GET['id'], 'payment_type' => "stp", 'raw_response' => json_encode($chargeArray), 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR']);
            $db_ext->insertData("{{payment_order}}", $params_logs);
            $params_update = array('status' => 'paid');
            $db_ext->updateData("{{order}}", $params_update, 'order_id', $_GET['id']);
            header('Location: ' . Yii::app()->request->baseUrl . "/store/receipt/id/" . $_GET['id']);
        } catch (Exception $e) {
            $error = $e;
        }
    }
}
?>
<div class="page-right-sidebar payment-option-page">
  <div class="main">  
  <?php 
if (!empty($error)) {
    ?>
  <p class="uk-text-danger"><?php 
예제 #3
0
 public function SMSbankDepositVerification()
 {
     if (isset($this->data['photo'])) {
         $req = array('ref' => t("reference number is required"));
     } else {
         $req = array('branch_code' => t("branch code is required"), 'date_of_deposit' => t("date of deposit is required"), 'time_of_deposit' => t("time of deposit is required"), 'amount' => t("amount is required"));
     }
     $Validator = new Validator();
     $Validator->required($req, $this->data);
     if ($Validator->validate()) {
         $DbExt = new DbExt();
         if ($res = Yii::app()->functions->mercadoGetPayment($this->data['ref'])) {
             $params = array('merchant_id' => $res[0]['merchant_id'], 'branch_code' => $this->data['branch_code'], 'date_of_deposit' => $this->data['date_of_deposit'], 'time_of_deposit' => $this->data['time_of_deposit'], 'amount' => $this->data['amount'], 'scanphoto' => isset($this->data['photo']) ? $this->data['photo'] : '', 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'transaction_type' => "sms_purchase");
             if ($DbExt->insertData("{{bank_deposit}}", $params)) {
                 $this->code = 1;
                 $this->msg = Yii::t("default", "Thank you. Your information has been receive please wait 1 or 2 days to verify your payment.");
                 /*send email to admin owner*/
                 $from = 'no-reply@' . $_SERVER['HTTP_HOST'];
                 $subject = Yii::t("default", "New Bank Deposit");
                 $to = Yii::app()->functions->getOptionAdmin('website_contact_email');
                 $tpl = EmailTPL::bankDepositedReceive();
                 if (!empty($to)) {
                     Yii::app()->functions->sendEmail($to, $from, $subject, $tpl);
                 }
             } else {
                 $this->msg = Yii::t("default", "Something went wrong during processing your request. Please try again later.");
             }
         } else {
             $this->msg = Yii::t("default", "Reference number not found");
         }
     } else {
         $this->msg = $Validator->getErrorAsHTML();
     }
 }
    if (is_array($_POST) && count($_POST) >= 1) {
        $step2 = true;
        $token = isset($_POST['stripeToken']) ? $_POST['stripeToken'] : '';
        try {
            $customer = Stripe_Customer::create(array('email' => isset($_POST['stripeEmail']) ? $_POST['stripeEmail'] : '', 'card' => $token));
            $charge = Stripe_Charge::create(array('customer' => $customer->id, 'amount' => $amount_to_pay, 'currency' => Yii::app()->functions->adminCurrencyCode()));
            $chargeArray = $charge->__toArray(true);
            $db_ext = new DbExt();
            $params_logs = array('package_id' => $data['package_id'], 'merchant_id' => $data['merchant_id'], 'price' => $data['package_price'], 'payment_type' => $payment_code, 'membership_expired' => $data['membership_expired'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'PAYPALFULLRESPONSE' => json_encode($chargeArray));
            if (isset($_GET['renew'])) {
                $membership_info = Yii::app()->functions->upgradeMembership($data['merchant_id'], $package_id);
                $params_logs['membership_expired'] = $membership_info['membership_expired'];
                $params_update = array('package_id' => $package_id, 'package_price' => $membership_info['package_price'], 'membership_expired' => $membership_info['membership_expired'], 'status' => 'active');
                $db_ext->updateData("{{merchant}}", $params_update, 'merchant_id', $data['merchant_id']);
            }
            $db_ext->insertData("{{package_trans}}", $params_logs);
            $db_ext->updateData("{{merchant}}", array('payment_steps' => 3, 'membership_purchase_date' => date('c')), 'merchant_id', $data['merchant_id']);
            if (isset($_GET['renew'])) {
                header('Location: ' . Yii::app()->request->baseUrl . "/store/renewSuccesful");
            } else {
                header('Location: ' . Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step4/token/{$my_token}");
            }
        } catch (Exception $e) {
            $error = $e;
        }
    }
}
?>
<div class="page-right-sidebar payment-option-page">
  <div class="main">  
  <?php 
예제 #5
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('');
 }
예제 #6
0
 public function actionPaymentbcy()
 {
     $db_ext = new DbExt();
     $data = $_GET;
     //dump($data);
     if (isset($data['orderID'])) {
         if ($res = Yii::app()->functions->barclayGetTransaction($data['orderID'])) {
             //dump($res);
             if ($data['do'] == "accept") {
                 switch ($res['transaction_type']) {
                     case "order":
                         $order_id = $res['token'];
                         $order_info = Yii::app()->functions->getOrder($order_id);
                         $db_ext = new DbExt();
                         $params_logs = array('order_id' => $order_id, 'payment_type' => "bcy", 'raw_response' => json_encode($data), 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_reference' => $data['PAYID']);
                         $db_ext->insertData("{{payment_order}}", $params_logs);
                         $params_update = array('status' => 'paid');
                         $db_ext->updateData("{{order}}", $params_update, 'order_id', $order_id);
                         header('Location: ' . Yii::app()->request->baseUrl . "/store/receipt/id/" . $order_id);
                         die;
                         break;
                     case "renew":
                     case "signup":
                         $my_token = $res['token'];
                         $token_details = Yii::app()->functions->getMerchantByToken($res['token']);
                         if ($res['transaction_type'] == "renew") {
                             $package_id = $token_details['package_id'];
                             if ($new_info = Yii::app()->functions->getPackagesById($package_id)) {
                                 $token_details['package_name'] = $new_info['title'];
                                 $token_details['package_price'] = $new_info['price'];
                                 if ($new_info['promo_price'] > 0) {
                                     $token_details['package_price'] = $new_info['promo_price'];
                                 }
                             }
                             $membership_info = Yii::app()->functions->upgradeMembership($token_details['merchant_id'], $package_id);
                             $params = array('package_id' => $package_id, 'merchant_id' => $token_details['merchant_id'], 'price' => $token_details['package_price'], 'payment_type' => Yii::app()->functions->paymentCode('barclay'), 'membership_expired' => $membership_info['membership_expired'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'PAYPALFULLRESPONSE' => json_encode($data), 'TRANSACTIONID' => $data['PAYID'], 'TOKEN' => $data['PAYID']);
                         } else {
                             $params = array('package_id' => $token_details['package_id'], 'merchant_id' => $token_details['merchant_id'], 'price' => $token_details['package_price'], 'payment_type' => Yii::app()->functions->paymentCode('barclay'), 'membership_expired' => $token_details['membership_expired'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'PAYPALFULLRESPONSE' => json_encode($data), 'TRANSACTIONID' => $data['PAYID'], 'TOKEN' => $data['PAYID']);
                         }
                         if ($data['STATUS'] == 5 || $data['STATUS'] == 9) {
                             $params['status'] = 'paid';
                         }
                         $db_ext->insertData("{{package_trans}}", $params);
                         $db_ext->updateData("{{merchant}}", array('payment_steps' => 3, 'membership_purchase_date' => date('c')), 'merchant_id', $token_details['merchant_id']);
                         if ($res['transaction_type'] == "renew") {
                             header('Location: ' . Yii::app()->request->baseUrl . "/store/renewSuccesful");
                         } else {
                             header('Location: ' . Yii::app()->request->baseUrl . "/store/merchantSignup/Do/step4/token/{$my_token}");
                         }
                         die;
                         break;
                     default:
                         break;
                 }
             } elseif ($data['do'] == "decline") {
                 $this->render("error", array('message' => t("Your payment has been decline")));
             } elseif ($data['do'] == "exception") {
                 $this->render("error", array('message' => t("Your Payment transactions is uncertain")));
             } elseif ($data['do'] == "cancel") {
                 $this->render("error", array('message' => t("Your transaction has been cancelled")));
             } else {
                 $this->render("error", array('message' => t("Unknow request")));
             }
         } else {
             $this->render("error", array('message' => t("Cannot find order id")));
         }
     } else {
         $this->render("error", array('message' => t("Something went wrong")));
     }
 }
예제 #7
0
 public function sendVerificationCode($mobile = '', $code = '')
 {
     $msg = t("Your verificatio code is") . " " . $code;
     if ($res = $this->sendSMS($mobile, $msg)) {
         $params = array('contact_phone' => $mobile, 'sms_message' => $msg, 'status' => isset($res['msg']) ? $res['msg'] : '', 'gateway_response' => isset($res['raw']) ? $res['raw'] : '', 'gateway' => $res['sms_provider'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR']);
         $DbExt = new DbExt();
         $DbExt->insertData("{{sms_broadcast_details}}", $params);
         return true;
     }
     return false;
 }
예제 #8
0
$db_ext = new DbExt();
$msg = '';
$error = '';
if (isset($_POST) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $filename = $_FILES['file']['name'];
    if (preg_match("/.csv/i", $filename)) {
        ini_set('auto_detect_line_endings', TRUE);
        $handle = fopen($_FILES['file']['tmp_name'], "r");
        $x = 1;
        while (($data = @fgetcsv($handle)) !== FALSE) {
            echo "<p class=\"non-indent uk-text-primary\">" . t("Processing line") . " ({$x})<br/></p>";
            if (count($data) >= 11) {
                $params = array('restaurant_name' => $data[0], 'restaurant_phone' => $data[1], 'contact_name' => $data[2], 'contact_phone' => $data[3], 'contact_email' => $data[4], 'country_code' => $data[5], 'street' => $data[6], 'city' => $data[7], 'state' => $data[8], 'post_code' => $data[9], 'status' => $data[10], 'username' => $data[4], 'password' => md5(isset($data[11]) ? $data[11] : Yii::app()->functions->generateCode()), 'restaurant_slug' => Yii::app()->functions->createSlug($data[0]), 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR']);
                echo "<p class=\"indent uk-text-primary\">" . t("Saving merchant") . "...</p>";
                if (!Yii::app()->functions->isMerchantExist($data[4])) {
                    if ($db_ext->insertData("{{merchant}}", $params)) {
                        echo "<p class=\"indent uk-text-primary\">" . t("Successful") . "...</p>";
                    } else {
                        echo "<p class=\"indent uk-text-danger\">" . t("Failed") . "...</p>";
                    }
                } else {
                    echo "<p class=\"indent uk-text-danger\">" . t("Email address already exist") . " <br/></p>";
                }
            } else {
                echo "<p class=\"indent uk-text-danger\">" . t("Error on line" . " " . $x) . " <br/></p>";
            }
            $x++;
        }
        ini_set('auto_detect_line_endings', FALSE);
    } else {
        $msg = t("Please upload a valid CSV file");