public function epayBgUpdateTransaction($orderid = '', $status = '') { $db_ext = new DbExt(); /*dump($orderid); dump($status);*/ if ($info = $this->barclayTransactionByOrderId($orderid)) { //dump($info); $res = Yii::app()->functions->getMerchantByToken($info['token']); $package_id = $res['package_id']; switch ($info['transaction_type']) { case "renew": case "signup": if ($info['transaction_type'] == "renew") { $package_id = $info['param1']; if ($new_info = Yii::app()->functions->getPackagesById($package_id)) { $res['package_name'] = $new_info['title']; $res['package_price'] = $new_info['price']; if ($new_info['promo_price'] > 0) { $res['package_price'] = $new_info['promo_price']; } } $membership_info = Yii::app()->functions->upgradeMembership($res['merchant_id'], $package_id); $params = array('package_id' => $package_id, 'merchant_id' => $res['merchant_id'], 'price' => $res['package_price'], 'payment_type' => Yii::app()->functions->paymentCode('paysera'), 'membership_expired' => $membership_info['membership_expired'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'PAYPALFULLRESPONSE' => json_encode($_POST), 'TRANSACTIONID' => $orderid, 'TOKEN' => $orderid); } else { $params = array('package_id' => $res['package_id'], 'merchant_id' => $res['merchant_id'], 'price' => $res['package_price'], 'payment_type' => Yii::app()->functions->paymentCode('epaybg'), 'membership_expired' => $res['membership_expired'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'PAYPALFULLRESPONSE' => json_encode($_POST), 'TRANSACTIONID' => $orderid, 'TOKEN' => $orderid); } $params['status'] = strtolower($status); /*dump($params);*/ if (!$this->epayBGIsPaymentExist($orderid)) { $db_ext->insertData("{{package_trans}}", $params); } break; case "order": $params_logs = array('order_id' => $info['token'], 'payment_reference' => $orderid, 'payment_type' => Yii::app()->functions->paymentCode('epaybg'), 'raw_response' => json_encode($_POST), 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR']); if (!$this->epayBgValidatePaymentOrder($info['token'], $orderid)) { $db_ext->insertData("{{payment_order}}", $params_logs); $params_update = array('status' => $status); $db_ext->updateData("{{order}}", $params_update, 'order_id', $info['token']); } break; case "sms_purchase": $payment_reference = $info['orderid']; $stmt_update = "\r\n \t\t\t UPDATE {{sms_package_trans}}\r\n \t\t\t SET status=" . strtolower($this->q($status)) . "\r\n \t\t\t WHERE\r\n \t\t\t payment_reference=" . $this->q($payment_reference) . "\r\n \t\t\t AND\r\n \t\t\t sms_package_id=" . $this->q($info['param1']) . "\r\n \t\t\t "; $db_ext->qry($stmt_update); break; default: //echo 'not found'; break; } } }
public function removeLogo() { if (Yii::app()->functions->isMerchantLogin()) { $DbExt = new DbExt(); $merchant_id = Yii::app()->functions->getMerchantID(); $stmt = "SELECT * FROM\r\n\t\t \t{{option}}\r\n\t\t \tWHERE\r\n\t\t \toption_name='merchant_photo'\r\n\t\t \tAND\r\n\t\t \tmerchant_id='{$merchant_id}'\r\n\t\t \t"; $DbExt->qry($stmt); $this->code = 1; $this->msg = Yii::t("default", "Successful"); } else { $this->msg = Yii::t("default", "ERROR: Your session has expired."); } }
public function alterTable($table = '', $new_field = '') { $DbExt = new DbExt(); $prefix = Yii::app()->db->tablePrefix; $existing_field = ''; if ($res = Yii::app()->functions->checkTableStructure($table)) { foreach ($res as $val) { $existing_field[$val['Field']] = $val['Field']; } foreach ($new_field as $key_new => $val_new) { if (!in_array($key_new, $existing_field)) { echo "Creating field {$key_new} <br/>"; $stmt_alter = "ALTER TABLE " . $prefix . "{$table} ADD {$key_new} " . $new_field[$key_new]; dump($stmt_alter); if ($DbExt->qry($stmt_alter)) { echo "(Done)<br/>"; } else { echo "(Failed)<br/>"; } } else { echo "Field {$key_new} already exist<br/>"; } } } }