public function actionCreate()
 {
     if ($_GET["select"] == 1) {
         //print_r($_POST);
         if (!Trucks::checkPlate($_POST["plate"])) {
             $truck = new Trucks();
             // print_r($_POST);
             $truck->plate = MYChtml::check_num($_POST["plate"]);
             /* if (strlen($data[1]) > 4) {$truck->is_conctract = 1; $truck->contract_number = $data[1];} else {$truck->is_conctract = 0; $truck->contract_number = "";}
                if (strlen($data[7]) > 4) {$truck->is_act = 1; $truck->act_number = $data[7];} else {$truck->is_act = 0; $truck->act_number = "";}*/
             $truck->balance_license_fee = (int) $_POST["amount_fee_license"];
             $truck->daily_license_fee = $_POST["weight"];
             $truck->comment = $_POST["comment"];
             $truck->fio = $_POST["fio"];
             if (!$truck->save()) {
                 print_r($truck->getErrors());
             }
         }
         $payment = new Payments();
         $payment->plate = MYChtml::check_num($_POST["plate"]);
         if ($_POST["amount_installation"] > 0) {
             $payment->amount_installation = (int) $_POST["amount_installation"];
         }
         if ($_POST["amount_fee_license"] > 0) {
             $payment->amount_fee_license = (int) $_POST["amount_fee_license"];
         }
         $payment->date = $_POST["date"];
         $payment->comment = $_POST["comment"];
         if (!$payment->save()) {
             print_r($payment->getErrors());
         }
     }
     $this->render('create');
 }
Esempio n. 2
0
 /**
  * 订单退款创建
  */
 public function actionRefundcreate()
 {
     $order_id = $this->post('order_id');
     $refunds_attributes = $this->post('Refunds');
     $refunds_attributes['pay_name'] = Yii::app()->params['pay_app_id'][$refunds_attributes['pay_app_id']];
     $Payments = new Payments();
     $result = $Payments->OrderRefund($order_id, $refunds_attributes);
     echo json_encode($result);
 }
Esempio n. 3
0
 public function processPayment(Payments $payment)
 {
     $user = User::model()->findByPk($payment->user_id);
     if (!$user || $user->balance < $payment->amount) {
         return array('status' => Paysystem::RESULT_ERROR, 'message' => tt('Payment error', 'payment'));
     }
     if ($user->deductBalance($payment->amount) && $payment->complete()) {
         return array('status' => Paysystem::RESULT_OK, 'message' => tt('The payment is successfully completed. The paid service has been activated.', 'payment'));
     }
     return array('status' => Paysystem::RESULT_ERROR, 'message' => tt('Payment error', 'payment'));
 }
Esempio n. 4
0
 public function processPayment(Payments $payment)
 {
     $payment->status = Payments::STATUS_WAITOFFLINE;
     $payment->update(array('status'));
     try {
         $notifier = new Notifier();
         $notifier->raiseEvent('onOfflinePayment', $payment);
     } catch (CHttpException $e) {
     }
     return array('status' => Paysystem::RESULT_OK, 'message' => tt('Thank you! Notification of your payment sent to the administrator.', 'payment'));
 }
Esempio n. 5
0
 function process($parameters)
 {
     $payments = new Payments();
     if (!$payments->checkLogin()) {
         $this->redirect('error');
     }
     //if empty parameter, add there current user
     if (isset($parameters[0])) {
         $userId = $parameters[0];
     } else {
         $userId = $_SESSION['id_user'];
     }
     if ($userId != $_SESSION['id_user'] && !$payments->checkIfIsAdminOfUser($_SESSION['id_user'], $userId)) {
         $this->redirect('error');
     }
     $data = $payments->getUserData($userId);
     //actualize old payments
     $resultMessages = $payments->actualizePayments($data['payments']);
     //create new payments
     $payments->makeNewPayments($data['user'], $data['tariff'], $this->language);
     $this->messages = array_merge($this->messages, $resultMessages);
     //get new data for user view
     $data = $payments->getUserData($userId);
     $data['payments'] = $payments->cleanupUserPayments($data['payments'], $this->language);
     //display non-active user
     if (!$data['user']['active']) {
         $this->messages[] = ['s' => 'info', 'cs' => 'Neaktivní uživatel - nové faktury se negenerují', 'en' => 'Inactive user - new invoices are not generated'];
     }
     $this->data['tariff'] = $data['tariff'];
     $this->data['user'] = $data['user'];
     $this->data['payments'] = $data['payments'];
     $this->header['title'] = ['cs' => 'Přehled plateb', 'en' => 'Payments overview'];
     //TODO add nice sliding JS invoice detail directly into view
     $this->view = 'payments';
 }
 public function autoExecutePayments()
 {
     //Status 2 orders are confirmed orders ready to collect payment.
     //This status change automatically whenever the payment is approved by the customer
     $db = new clsDBdbConnection();
     $sql = "select id from orders where status_id = 2";
     $db->query($sql);
     $payments = new Payments();
     while ($db->next_record()) {
         $orderid = (int) $db->f("id");
         $payments->executePayment($orderid);
     }
     $db->close();
     return true;
 }
Esempio n. 7
0
 public function checkPaymentStatus()
 {
     $payments = (array) json_decode(Payments::i()->getPayments());
     $pending = (array) $payments['pending'];
     foreach ($pending as $payment) {
         $response = (array) $this->block_io->get_address_balance(array('addresses' => base64_decode($payment->token)));
         if ($response['status'] == "success") {
             $data = (array) $response['data'];
             foreach ((array) $data['balances'] as $balance) {
                 if ($balance->address == base64_decode($payment->token) && $balance->label == $payment->payerid) {
                     if (round($balance->available_balance, 8) >= round($payment->amount, 8)) {
                         $update = DBManager::i()->update("sf_purchases", array("pending" => 0), array("token" => $payment->token));
                         if ($update) {
                             $_SESSION['shopping-cart'] = base64_encode("{}");
                             DbManager::i()->update("sf_carts", array("cart" => $_SESSION['shopping-cart']), array("userid" => $_SESSION['userid']));
                             return array("result" => "success", "resultMessage" => "Payment received! Refreshing your payments...");
                         } else {
                             throw new Exception("Could not update Purchase. Please try again later");
                         }
                     } else {
                         throw new Exception("Paid amount is not enough. Need " . round($payment->amount - $balance->available_balance, 8) . " more Bitcoins", 1212);
                     }
                     break;
                 } else {
                     throw new Exception("Balance Address: " . $balance->address . " NOT EQUAL TO payment address: " . $payment->address . " and balance label: " . $balance->label . " NOT EQUAL to payment label" . $payment->payerid);
                 }
             }
         } else {
             throw new Exception("Could not get address balance for address");
         }
     }
 }
Esempio n. 8
0
 public function postDelete()
 {
     $id = Input::get('id');
     $delsch = Payments::find($id);
     $delsch->delete();
     return 1;
 }
Esempio n. 9
0
 public function actionLoad()
 {
     Payments::model()->deleteAll();
     Trucks::model()->deleteAll();
     ZReport::model()->deleteAll();
     $this->render("load");
 }
Esempio n. 10
0
 public static function add($paymetID, $amount, $is_success, $pay_type, $veh_id)
 {
     $companyId = $_SESSION['user']['company'];
     $userId = $_SESSION['user']['id'];
     $db = new Connection();
     $conn = $db->connect();
     $paytime = $db->getTimeNow();
     if ($pay_type == 2) {
         $paid_amount = 0;
         $act_date = $paytime;
     } else {
         $act_date = Payments::getVehicleActivationDateFromDB($veh_id);
         $paid_amount = Payments::getPreviousPaymentForVehicle($veh_id, $companyId);
     }
     $total_amount = DEF_MEM_AMOUNT;
     $paid_amount += $amount;
     $paid_per = 100 - ($total_amount - $paid_amount) / $total_amount * 100;
     $rest_amount = $total_amount - $paid_amount;
     $sql = "INSERT INTO `payments`(`amount`, `company_id`, `user_id`, `timestamp`, `is_success`, `pay_type`, `rest_amount`, `paid_perc`, `paid_amount`, `vehicle_id`, `total_amount`, `veh_activation_date`, `paymentId`) VALUES ('{$amount}','{$companyId}','{$userId}','{$paytime}','{$is_success}','{$pay_type}','{$rest_amount}','{$paid_per}','{$paid_amount}', '{$veh_id}', '{$total_amount}', '{$act_date}', '{$paymetID}')";
     if (mysqli_query($conn, $sql)) {
         return true;
     } else {
         return mysqli_error($conn);
     }
     return false;
 }
Esempio n. 11
0
 public function index()
 {
     $payments = Payments::orderBy('paid_on', 'desc')->get();
     // \Auth::user()->name; //get name of Auth user
     // $expenses = Expense::leftJoin('projects', 'expenses.project_id', '=', 'projects.id')->get();
     return view('payments.index', compact('payments'));
 }
Esempio n. 12
0
 public static function addBalanceAndInstatllFee($amountBalanceFee, $amountInstallFee, $plate, $date = false)
 {
     $payment = new Payments();
     $payment->plate = $plate;
     $payment->amount_fee_license = $amountBalanceFee;
     $payment->amount_installation = $amountInstallFee;
     if ($date) {
         $payment->date = $date;
     } else {
         $payment->date = new CDbExpression('NOW()');
     }
     if ($payment->save()) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * Show invoicing dashboard
  *
  * @param void
  * @return null
  */
 function index()
 {
     $per_page = 30;
     $page = (int) $this->request->get('page');
     if ($page < 1) {
         $page = 1;
     }
     // if
     list($payments, $pagination) = Payments::paginateAll($page, $per_page);
     $this->smarty->assign(array('payments' => $payments, 'pagination' => $pagination));
 }
Esempio n. 14
0
 public function actionConfirm($id)
 {
     $payment = Payments::model()->findByPk($id);
     if ($payment) {
         $payment->complete();
     }
     if (!Yii::app()->request->isAjaxRequest) {
         $this->redirect(array('admin'));
     }
     Yii::app()->end();
 }
Esempio n. 15
0
 public function actionSaveAddFee()
 {
     $dates = $_GET["dates"];
     $amountAddFee = $_GET["amountAddFee"];
     $plate = $_GET["plateAddFee"];
     if (Payments::addBalanceFee($amountAddFee, $plate, $dates)) {
         echo "good";
     } else {
         echo "bad";
     }
 }
Esempio n. 16
0
 public function getResultsByCustomerId($id, $cc = true)
 {
     if (!$id) {
         return array();
     }
     $db = self::$_msql = SafeMySQL::getInstance();
     $sql = "SELECT\n\t\t\tp.`payment_id`,\n\t\t\tp.`customer_id`,\n\t\t\tp.`method_id`,\n\t\t\tp.`num1`,\n\t\t\tp.`num2`,\n\t\t\tp.`num3`,\n\t\t\tp.`num4`,\n\t\t\tp.`txt1`,\n\t\t\tp.`txt2`,\n\t\t\tp.`txt3`,\n\t\t\tp.`txt4`";
     $sql .= $cc ? " , p.`note1`" : '';
     $sql .= "FROM `payments` as p\n\t\t\tWHERE p.`customer_id`=?i";
     $sqlParse = $db->parse($sql, $id);
     return $this->getSqlParse($sqlParse);
 }
Esempio n. 17
0
 /**
  * Model definition.
  */
 function define()
 {
     // Fields.
     $this->fields = array('id', 'ref', 'account_id', 'order_id', 'method', 'action', 'amount', 'status', 'reason', 'date_created', 'date_updated', 'status' => function ($payment) {
         return Payments::get_status($payment);
     }, 'account' => function ($payment) {
         return get("/accounts/{$payment['account_id']}");
     }, 'order' => function ($payment) {
         return get("/orders/{$payment['order_id']}");
     });
     // Search fields.
     $this->search_fields = array('id', 'ref', 'reason');
     // Optional reference key.
     $this->slug_pk = 'ref';
     // Indexes.
     $this->indexes = array('id' => 'unique', 'ref');
     // Validate.
     $this->validate = array('required' => array('account_id', 'order_id', 'method', 'action', 'billing', 'amount', 'reason', 'status'), 'amount', 'unique' => array());
     // Event binds.
     $this->binds = array('POST' => function ($event, $model) {
         $data =& $event['data'];
         if ($order = get("/orders/{$data['order_id']}")) {
             // Default data from order.
             $data['account_id'] = $order['account_id'];
             $data['method'] = $data['method'] ?: $order['billing']['method'];
             $data['action'] = $data['action'] ?: "charge";
         } else {
             $model->error('Order #' . $data['order_id'] . ' not found', 'order_id');
         }
         // Payment data invalid?
         if (!$model->validate($data)) {
             // Prevent further processing.
             return false;
         }
         // Method/action case insensitive.
         $data['method'] = strtolower($data['method']);
         $data['action'] = strtolower($data['action']);
         // Get default status.
         $data['status'] = Payments::get_status($data);
         // Process default methods (i.e. cash, account credit, invoice).
         try {
             $data = Payments::process_default_methods($data);
         } catch (Exception $e) {
             $model->error($e->getMessage(), 'method');
             return false;
         }
     }, 'validate:amount' => function ($value, $field, $params, $model) {
         if ($value == 0) {
             $model->error('invalid', 'amount');
         }
     });
 }
 function process($parameters)
 {
     $payments = new Payments();
     $userIds = $payments->getUsersIds();
     foreach ($userIds as $uId) {
         $data = $payments->getUserData($uId);
         //create new payments
         $payments->makeNewPayments($data['user'], $data['tariff'], $this->language);
         //actualize old payments
         $payments->actualizePayments($data['payments']);
         //check for expired invoices
         $expiredPayments = $payments->getExpiredPayments(TOLERANCE_TIME_ON_SENDING_REMINDING_EMAILS);
     }
     header("HTTP/1.0 204 No Content");
     die;
 }
Esempio n. 19
0
 public function createAction()
 {
     $model = new Pixelrate();
     if (isset($_POST['get_peyment_method'])) {
         AF::setJsonHeaders('json');
         $paymentType = AF::get($_POST, 'payment_type', 0);
         $paymentMethods = Payments::methods($paymentType);
         if ($paymentMethods) {
             Message::echoJsonSuccess(array('message' => $paymentMethods));
         } else {
             Message::echoJsonError(__('incorrect_payment_type'));
         }
     }
     $this->performAjaxValidation($model);
     // Uncomment the following line if AJAX validation is needed
     if (isset($_POST['model']) && $_POST['model'] == 'pixelrates') {
         if (!isset($_POST['default'])) {
             if (!isset($_POST['aff_id']) || empty($_POST['aff_id'])) {
                 Message::echoJson('error', array('errors' => array('aff_id' => 'No empty')));
             }
         }
         $model->fillFromArray($_POST);
         $model->user_id_created = $this->user->user_id;
         $model->user_id_updated = $this->user->user_id;
         $model->updated = 'NOW():sql';
         $model->created = 'NOW():sql';
         $model->model_uset_id = $this->user->user_id;
         if ($model->save()) {
             Message::echoJsonSuccess();
         } else {
             Message::echoJsonError(__('pixelrate_not_created') . ' ' . $model->errors2string);
         }
         die;
     }
     $this->addToPageTitle('Create pixel rates');
     $this->render('create', array('model' => $model));
 }
Esempio n. 20
0
 public function loadModel($id)
 {
     $model = Payments::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 21
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $model = $this->loadModel($id);
         if (Payments::model()->count('order_id=' . $id) !== 0) {
             $transaction = Yii::app()->db->beginTransaction();
             try {
                 Contracts::model()->deleteAll('order_id=' . $id);
                 Acts::model()->deleteAll('order_id=' . $id);
                 Invoices::model()->deleteAll('order_id=' . $id);
                 InvoicesFkt::model()->deleteAll('order_id=' . $id);
                 Works::model()->deleteAll('order_id=' . $id);
                 $msg = 'Заказ #' . $model->id . ' - ' . $model->name . ' для ' . $model->client->name . ' и документы по нему удалёны';
                 $model->delete();
                 $transaction->commit();
                 Yii::app()->user->setFlash('success', $msg);
                 Yii::app()->logger->write($msg);
             } catch (Exception $e) {
                 $transaction->rollBack();
                 $msg = 'Заказ #' . $model->id . ' - ' . $model->name . ' для ' . $model->client->name . ' - удаление не удалось';
                 Yii::app()->user->setFlash('error', $msg);
                 Yii::app()->logger->write($msg);
             }
         } else {
             $msg = 'Заказ #' . $model->id . ' - ' . $model->name . ' для ' . $model->client->name . ' - удаление невозможно. По этому заказу уже были проведены платежи';
             Yii::app()->user->setFlash('notice', $msg);
             Yii::app()->logger->write($msg);
         }
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
 public static function generateClientToken()
 {
     return parent::_POST("/integrations/braintree/clientToken");
 }
Esempio n. 23
0
 /**
  * CallBack
  * This function is called by the bank server in order to confirm the transaction previously executed
  * @param $response from the Gateway Server
  * @return boolean
  */
 public function CallBack($response)
 {
     $bank = self::getModule();
     $url = $bank['test_mode'] ? $bank['url_test'] : $bank['url_official'];
     // Resend all the variables to paypal to confirm the receipt message
     $result = self::processIPN($response);
     if (!empty($response['custom'])) {
         // Get the orderid back from the bank post variables
         $orderid = trim($response['custom']);
         if (!empty($orderid) && is_numeric($orderid)) {
             //check the ipn result received back from paypal
             if ($result) {
                 Orders::Complete($orderid, true);
                 // Complete the order information and it executes all the tasks to do
                 Payments::confirm($orderid, true);
                 // Set the payment confirm
             } else {
                 Payments::confirm($orderid, false);
             }
         }
     }
     die;
 }
Esempio n. 24
0
 /**
  * print the order
  *
  * @param unknown_type $invoiceid
  */
 public static function pdf($order_id, $show = true, $force = false, $path = "/documents/orders/")
 {
     $taxpercent = "";
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     if (!is_numeric($order_id)) {
         return false;
     }
     $pdf = new Shineisp_Commons_PdfOrder();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $payments = Payments::findbyorderid($order_id, null, true);
     $order = self::getAllInfo($order_id, null, true);
     // Set the name of the file
     $filename = $order[0]['order_date'] . " - " . $order[0]['order_id'] . ".pdf";
     $database['header']['label'] = $translator->translate('Order No.') . " " . $order[0]['order_number'] . " - " . Shineisp_Commons_Utilities::formatDateOut($order[0]['order_date']);
     $database['columns'][] = array("value" => $translator->translate("SKU"), "size" => 40);
     $database['columns'][] = array("value" => $translator->translate("Description"));
     $database['columns'][] = array("value" => $translator->translate("Qty"), "size" => 30, "align" => "center");
     $database['columns'][] = array("value" => $translator->translate("Unit"), "size" => 30);
     $database['columns'][] = array("value" => $translator->translate("Tax Free Price"), "size" => 60, "align" => "right");
     $database['columns'][] = array("value" => $translator->translate("Discount"), "size" => 60, "align" => "right");
     $database['columns'][] = array("value" => $translator->translate("Setup fee"), "size" => 60, "align" => "right");
     $database['columns'][] = array("value" => $translator->translate("Tax %"), "size" => 40, "align" => "center");
     $database['columns'][] = array("value" => $translator->translate("Total"), "size" => 50, "align" => "right");
     if (isset($order[0])) {
         $orderinfo['order_number'] = !empty($order[0]['order_number']) ? $order[0]['order_number'] : self::formatOrderId($order[0]['order_id']);
         $orderinfo['invoice_id'] = "";
         $orderinfo['date'] = Shineisp_Commons_Utilities::formatDateOut($order[0]['order_date']);
         //if customer comes from reseller
         if ($order[0]['Customers']['parent_id']) {
             $isTaxFree = Customers::isTaxFree($order[0]['Customers']['parent_id']);
             $isVATFree = Customers::isVATFree($order[0]['Customers']['parent_id']);
             $invoice_dest = Customers::getAllInfo($order[0]['Customers']['parent_id'], 'c.*, a.*');
             $orderinfo['customer']['customer_id'] = $invoice_dest['customer_id'];
             $orderinfo['customer']['company'] = $invoice_dest['company'];
             $orderinfo['customer']['firstname'] = $invoice_dest['firstname'];
             $orderinfo['customer']['lastname'] = $invoice_dest['lastname'];
             $orderinfo['customer']['vat'] = $invoice_dest['vat'];
             $orderinfo['customer']['taxpayernumber'] = $invoice_dest['taxpayernumber'];
             $orderinfo['customer']['email'] = $invoice_dest['email'];
             if (isset($invoice_dest['Addresses'][0])) {
                 $orderinfo['customer']['address'] = $invoice_dest['Addresses'][0]['address'];
                 $orderinfo['customer']['city'] = $invoice_dest['Addresses'][0]['city'];
                 $orderinfo['customer']['code'] = $invoice_dest['Addresses'][0]['code'];
                 $orderinfo['customer']['country'] = !empty($invoice_dest['Addresses'][0]['Countries']['name']) ? $invoice_dest['Addresses'][0]['Countries']['name'] : "";
             }
         } else {
             $isTaxFree = Customers::isTaxFree($order[0]['Customers']['customer_id']);
             $isVATFree = Customers::isVATFree($order[0]['Customers']['customer_id']);
             $orderinfo['customer']['customer_id'] = $order[0]['Customers']['customer_id'];
             $orderinfo['customer']['company'] = $order[0]['Customers']['company'];
             $orderinfo['customer']['firstname'] = $order[0]['Customers']['firstname'];
             $orderinfo['customer']['lastname'] = $order[0]['Customers']['lastname'];
             $orderinfo['customer']['vat'] = $order[0]['Customers']['vat'];
             $orderinfo['customer']['taxpayernumber'] = $order[0]['Customers']['taxpayernumber'];
             $orderinfo['customer']['email'] = $order[0]['Customers']['email'];
             if (isset($order[0]['Customers']['Addresses'][0])) {
                 $orderinfo['customer']['address'] = $order[0]['Customers']['Addresses'][0]['address'];
                 $orderinfo['customer']['city'] = $order[0]['Customers']['Addresses'][0]['city'];
                 $orderinfo['customer']['code'] = $order[0]['Customers']['Addresses'][0]['code'];
                 $orderinfo['customer']['country'] = $order[0]['Customers']['Addresses'][0]['Countries']['name'];
             }
         }
         if (count($payments) > 0) {
             $orderinfo['payment_date'] = Shineisp_Commons_Utilities::formatDateOut($payments[0]['paymentdate']);
             $orderinfo['payment_mode'] = $payments[0]['Banks']['name'];
             $orderinfo['payment_description'] = $payments[0]['description'];
             $orderinfo['payment_transaction_id'] = $payments[0]['reference'];
         }
         $orderinfo['invoice_id'] = "";
         $orderinfo['company']['name'] = $order[0]['Isp']['company'];
         $orderinfo['company']['manager'] = $order[0]['Isp']['manager'];
         $orderinfo['company']['vat'] = $order[0]['Isp']['vatnumber'];
         $orderinfo['company']['bankname'] = $order[0]['Isp']['bankname'];
         $orderinfo['company']['iban'] = $order[0]['Isp']['iban'];
         $orderinfo['company']['bic'] = $order[0]['Isp']['bic'];
         $orderinfo['company']['address'] = $order[0]['Isp']['address'];
         $orderinfo['company']['zip'] = $order[0]['Isp']['zip'];
         $orderinfo['company']['city'] = $order[0]['Isp']['city'];
         $orderinfo['company']['country'] = $order[0]['Isp']['country'];
         $orderinfo['company']['telephone'] = $order[0]['Isp']['telephone'];
         $orderinfo['company']['fax'] = $order[0]['Isp']['fax'];
         $orderinfo['company']['website'] = $order[0]['Isp']['website'];
         $orderinfo['company']['email'] = $order[0]['Isp']['email'];
         $orderinfo['company']['slogan'] = $order[0]['Isp']['slogan'];
         $orderinfo['company']['custom1'] = $order[0]['Isp']['custom1'];
         $orderinfo['company']['custom2'] = $order[0]['Isp']['custom2'];
         $orderinfo['company']['custom3'] = $order[0]['Isp']['custom3'];
         if ($order[0]['status_id'] == Statuses::id("tobepaid", "orders")) {
             // To be payed
             $orderinfo['ribbon']['text'] = $translator->translate("To be Paid");
             $orderinfo['ribbon']['color'] = "#D60000";
             $orderinfo['ribbon']['border-color'] = "#BD0000";
         } elseif ($order[0]['status_id'] == Statuses::id("complete", "orders")) {
             // Complete
             $orderinfo['ribbon']['text'] = $translator->translate("Paid");
             $orderinfo['ribbon']['color'] = "#009926";
             $orderinfo['ribbon']['border-color'] = "#00661A";
         } else {
             $orderinfo['ribbon']['text'] = $translator->translate(Statuses::getLabel($order[0]['status_id']));
             $orderinfo['ribbon']['color'] = "#FFCC33";
             $orderinfo['ribbon']['border-color'] = "#E6AC00";
         }
         $orderinfo['subtotal'] = $order[0]['total'];
         $orderinfo['grandtotal'] = $order[0]['grandtotal'];
         $orderinfo['vat'] = $order[0]['vat'];
         $orderinfo['delivery'] = 0;
         $database['records'] = $orderinfo;
         foreach ($order[0]['OrdersItems'] as $item) {
             $price = $item['price'] * $item['quantity'] + $item['setupfee'];
             $tax = Taxes::getTaxbyProductID($item['product_id']);
             if ($tax['percentage'] > 0) {
                 $rowtotal = $price * (100 + $tax['percentage']) / 100;
             } else {
                 $rowtotal = $price;
             }
             if (!$isTaxFree && !$isVATFree) {
                 $taxes = Taxes::getTaxbyProductID($item['product_id']);
                 if (!empty($taxes['percentage'])) {
                     $taxpercent = $taxes['percentage'];
                 }
             }
             if (!empty($item['discount'])) {
                 $item['discount'] = $item['discount'] . "%";
             }
             $database['records'][] = array($item['Products']['sku'], $item['description'], $item['quantity'], $translator->translate('nr'), $item['price'], $item['discount'], $item['setupfee'], $taxpercent, $rowtotal);
         }
         if (isset($order[0])) {
             $pdf->CreatePDF($database, $filename, $show, $path, $force);
             // Execute a custom event
             self::events()->trigger('orders_pdf_created', "Orders", array('file' => "{$path}/{$filename}"));
             return $path . $filename;
         }
     }
     return false;
 }
Esempio n. 25
0
<?php

//show code
highlight_file("/info/payment_find.php");
?>
<br />
------------------------------------------------------------------------------------------------------------
<br />

<?php 
/* High Level call */
require_once '../lib/Nimble/base/NimbleAPI.php';
$params = array('clientId' => '729DFCD7A2B4643A0DA3D4A7E537FC6E', 'clientSecret' => 'jg26cI3O1mB0$eR&fo6a2TWPmq&gyQoUOG6tClO%VE*N$SN9xX27@R4CTqi*$4EO', 'mode' => 'demo');
$IdPayment = 541;
$NimbleApi = new NimbleAPI($params);
$p = new Payments();
$response = $p->FindPaymentClient($NimbleApi, $IdPayment);
?>
--------------
<?php 
/* Low Level call */
$NimbleApi = new NimbleAPI($params);
$NimbleApi->uri = ConfigSDK::NIMBLE_API_BASE_URL . 'payments/' . $IdPayment;
$NimbleApi->method = 'GET';
$response2 = $NimbleApi->rest_api_call();
?>

<br /><pre>
Response: (var_dump($response))
<?php 
var_dump($response);
Esempio n. 26
0
<?php

require_once './classes/Payments.php';
$payments = new Payments(0);
$paymentid = $_POST['paymentid'];
$amount = $_POST['amount'];
$list = $payments->make_refund($paymentid, $amount);
echo $list;
Esempio n. 27
0
    /**
     * Add document to binder
     * @param $docId
     */
    public static function addDocumentToBinder($docId)
    {
        $document = Documents::model()->findByPk($docId);
        if ($document) {
            $year = substr($document->Created, 0, 4);
            Storages::createProjectStorages($document->Project_ID, $year);
            $subsectionId = 0;
            if ($document->Document_Type == Documents::PM) {
                $payment = Payments::model()->findByAttributes(array(
                    'Document_ID' => $docId,
                ));
                $year = substr($payment->Payment_Check_Date, 0, 4);
                $subsectionId = Sections::createLogBinder($document->Project_ID, $document->Document_Type, $year);
            } elseif ($document->Document_Type == Documents::PO) {
                $po = Pos::model()->findByAttributes(array(
                    'Document_ID' => $docId,
                ));
                $year = substr($po->PO_Date, 0, 4);
                $subsectionId = Sections::createLogBinder($document->Project_ID, $document->Document_Type, $year);
                if ($po->PO_Backup_Document_ID != 0) {
                    $bu = LibraryDocs::model()->findByAttributes(array(
                        'Document_ID' => $po->PO_Backup_Document_ID,
                        'Subsection_ID' => $subsectionId,
                    ));
                    if (!$bu) {
                        $libDoc = new LibraryDocs();
                        $libDoc->Document_ID = $po->PO_Backup_Document_ID;
                        $libDoc->Subsection_ID = $subsectionId;
                        $libDoc->Access_Type = Storages::HAS_ACCESS;
                        $libDoc->Sort_Numb = 0;
                        if ($libDoc->validate()) {
                            $libDoc->save();
                        }
                    }
                }
            }

            $libDoc = LibraryDocs::model()->findByAttributes(array(
                'Document_ID' => $docId,
                'Subsection_ID' => $subsectionId,
            ));

            if (!$libDoc) {
                $libDoc = new LibraryDocs();
                $libDoc->Document_ID = $docId;
                $libDoc->Subsection_ID = $subsectionId;
                $libDoc->Access_Type = Storages::HAS_ACCESS;
                $libDoc->Sort_Numb = 0;
                if ($libDoc->validate()) {
                    $libDoc->save();
                }
            }

            LibraryDocs::sortDocumentsInSubsection($subsectionId);
        }
    }
Esempio n. 28
0
<?php

require_once './classes/Payments.php';
//print_r($_POST);
//echo "<br>";
$page = $_POST['id'];
$payment_type = $_POST['payments_type'];
$payment = new Payments($payment_type);
$list = $payment->get_payment_item($page, $payment_type);
echo $list;
Esempio n. 29
0
<?php

require_once './classes/Payments.php';
$payment = new Payments();
$list = $payment->get_renew_fee_page();
echo $list;
Esempio n. 30
0
 /**
  * Static function to send a transaction to multiple recipients in the same transaction.
  *
  * @param string $wallet_id Wallet Identifier used to Login
  * @param string $main_password Your Main My wallet password
  * @param string $from Send from a specific Bitcoin Address
  * @param array $recipients Bitcoin Addresses as keys and the amounts to send as values
  * @param float $amount Amount to send in satoshi
  * @param bool $shared "true" or "false" indicating whether the transaction should be sent through a shared wallet. Fees apply.
  * @param string $fee Transaction fee value in satoshi (Must be greater than default fee)
  * @param string $note A public note to include with the transaction (Optional)
  * @param string $second_password Your second My Wallet password if double encryption is enabled
  * @return string
  */
 public static function PayToMany($wallet_id, $main_password, $from, array $recipients, $amount, $shared = false, $fee = "", $note = "", $second_password = "")
 {
     $instance = new Payments($wallet_id, $main_password);
     return $instance->send($from, $recipients, $amount, $shared, $fee, $note, $second_password);
 }