/** * Execute the configured controller actions * Example: * http://localhost/index.php/cron/run/config/cleanupdb */ public function actionTouch() { if (ERunActions::runBackground()) { $config = isset($_GET['config']) ? $_GET['config'] : null; $this->_runActions($config); } }
public function actionStep2() { // require_once(Yii::getPathOfAlias('application.components.Paypal') . '/autoload.php'); $this->layoutPath = Yii::getPathOfAlias('webroot') . "/themes/classic/views/layouts"; $this->layout = 'nonPrepare'; $this->checkSession(2); $request = Yii::app()->request; if ($request->isPostRequest && isset($_POST)) { try { $this->card_number = $this->getPostFilter('card_number'); $this->card_holder_name = $this->getPostFilter('card_holder_name'); $this->expiry_year = $this->getPostFilter('expiry_year'); $this->expiry_month = $this->getPostFilter('expiry_month'); $this->cvc = $this->getPostFilter('cvc'); $this->first_name = $this->getPostFilter('first_name'); $this->last_name = $this->getPostFilter('last_name'); $this->bill_city = $this->getPostFilter('bill_city'); $this->bill_address = $this->getPostFilter('bill_address'); $this->bill_country = $this->getPostFilter('bill_country'); $this->bill_postcode = $this->getPostFilter('bill_postcode'); $apiContext = new \PayPal\Rest\ApiContext(new \PayPal\Auth\OAuthTokenCredential("AZxYt_EVUMu9xXO0DHBHn4KGUVx6UMIdQKAb7QeCek609Zo3lFCAIfIKs29-T4PL66cSoN6189SfoACj", "ELebkFS3jmn9CNu4PF1t8OWaIsHASMDalHKp9x1dwEo0KmeKo582SfeVIC3CC99tmin7NoJZp00jI2Oc")); $addr = new \PayPal\Api\Address(); $addr->setLine1($this->bill_address); $addr->setCity($this->bill_city); $addr->setCountryCode($this->bill_country); $addr->setPostalCode($this->bill_postcode); $addr->setState('OH'); $card = new \PayPal\Api\CreditCard(); $card->setNumber($this->card_number); $card->setType('visa'); $card->setExpireMonth($this->expiry_month); $card->setExpireYear($this->expiry_year); $card->setCvv2($this->cvc); $card->setFirstName($this->first_name); $card->setLastName($this->last_name); $card->setBillingAddress($addr); $fi = new \PayPal\Api\FundingInstrument(); $fi->setCreditCard($card); $payer = new \PayPal\Api\Payer(); $payer->setPaymentMethod('credit_card'); $payer->setFundingInstruments(array($fi)); $amount = new \PayPal\Api\Amount(); $amount->setCurrency('USD'); $amount->setTotal('0.12'); $transaction = new \PayPal\Api\Transaction(); $transaction->setAmount($amount); $transaction->setDescription('This is the payment transaction description.'); $redirectUrls = new \PayPal\Api\RedirectUrls(); $redirectUrls->setReturnUrl(Yii::app()->createAbsoluteUrl('bookService/step3' . '?success=true'))->setCancelUrl(Yii::app()->createAbsoluteUrl('bookService/step3' . '?success=false')); $payment = new \PayPal\Api\Payment(); $payment->setIntent('sale'); $payment->setPayer($payer); $payment->setTransactions(array($transaction)); try { $res = $payment->create($apiContext); } catch (PayPal\Exception\PayPalConnectionException $e) { echo $e->getData(); // This will print a JSON which has specific details about the error. // exit(1); } $this->nextStep(3); if (ERunActions::runBackground()) { $this->SendMailConfirm(); } // die(); $this->redirectStep(3); } catch (exception $e) { var_dump($e->getMessage()); } } $this->render('step2'); }
public function actionBackgroundmsg($phone_nos,$msg) { $count = count($phone_nos); Yii::import('application.extensions.runactions.components.ERunActions'); //require_once "Mail.php"; if (ERunActions::runBackground()) { $output = implode(",",$phone_nos); $smsobj=new SmsApi; $r=$smsobj->sendsms($output,$msg); if(preg_match('/alert_/',$r)) echo 'sent'; } else { $this->redirect(array('admin')); } }
public function action_do_sync_Images() { if (ERunActions::runBackground()) { //do all the stuff that should work in background $s3 = new A2s3(); $query = "select id, nombre from aud_imagenes where aws = 0 "; $dataQuery = Yii::app()->db->createCommand($query)->queryAll(); foreach ($dataQuery as $key => $value) { $url = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->baseUrl . "/uploads/" . $value["nombre"]; $response = $s3->putObject(array('Bucket' => '54Mmggroup', 'Key' => $value["nombre"], 'SourceFile' => $url)); $query = "update aud_imagenes set aws = 1 where id = {$value['id']}"; Yii::app()->db->createCommand($query)->execute(); } } }