Example #1
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();
     }
 }