示例#1
0
文件: Paypal.php 项目: nabble/ajde
 public function getRedirectParams($description = null)
 {
     $transaction = $this->getTransaction();
     // NOOOO.. THE UGLY HACKING
     $return = config('app.rootUrl') . 'presale/transaction:complete';
     $method = $transaction->shipment_method;
     if ($method == 'presale-remainder') {
         $return = config('app.rootUrl') . 'presale/transaction:confirm_complete';
     }
     return ['cmd' => '_xclick', 'business' => config('shop.transaction.paypal.account'), 'notify_url' => config('app.rootUrl') . $this->returnRoute . 'paypal' . $this->getMethod() . '.html', 'bn' => config('app.id') . '_BuyNow_WPS_' . strtoupper(Ajde_Lang::getInstance()->getShortLang()), 'amount' => $transaction->payment_amount, 'item_name' => issetor($description, config('app.title') . ': ' . Ajde_Component_String::makePlural($transaction->shipment_itemsqty, 'item')), 'quantity' => 1, 'address_ override' => 1, 'address1' => $transaction->shipment_address, 'zip' => $transaction->shipment_zipcode, 'city' => $transaction->shipment_city, 'state' => $transaction->shipment_region, 'country' => $transaction->shipment_country, 'email' => $transaction->email, 'first_name' => $transaction->name, 'currency_code' => config('shop.currency.code'), 'custom' => $transaction->secret, 'no_shipping' => 1, 'no_note' => 1, 'return' => $return, 'rm' => 1];
 }
示例#2
0
文件: Mollie.php 项目: nabble/ajde
 public function getRedirectUrl($description = null)
 {
     $transaction = $this->getTransaction();
     $mollie = new Mollie_API_Client();
     $mollie->setApiKey($this->getApiKey());
     $order_id = $transaction->secret;
     $data = ['amount' => $transaction->payment_amount, 'description' => isset($description) ? $description : config('app.title') . ': ' . Ajde_Component_String::makePlural($transaction->shipment_itemsqty, 'item'), 'redirectUrl' => config('app.rootUrl') . $this->returnRoute . 'mollie_' . $this->getMethod() . '.html?order_id=' . $order_id, 'method' => $this->getMethod(), 'metadata' => ['order_id' => $order_id]];
     $payment = $mollie->payments->create($data);
     // save details
     $transaction->payment_providerid = $payment->id;
     $transaction->save();
     $url = $payment->getPaymentUrl();
     return $this->ping($url) ? $url : false;
 }
示例#3
0
 public function markPaidJson()
 {
     $id = Ajde::app()->getRequest()->getPostParam('id', false);
     $transaction = new TransactionModel();
     if (!is_array($id)) {
         $id = [$id];
     }
     $c = 0;
     foreach ($id as $elm) {
         $transaction->loadByPK($elm);
         if ($transaction->payment_status !== 'completed') {
             $transaction->paid();
             $c++;
         }
     }
     return ['success' => true, 'message' => Ajde_Component_String::makePlural($c, 'transaction') . ' marked as paid'];
 }
示例#4
0
文件: Wedeal.php 项目: nabble/ajde
 public function getRedirectUrl($description = null)
 {
     $transaction = $this->getTransaction();
     $request = ['type' => 'transaction', 'transactionreq' => ['username' => config('shop.transaction.wedeal.username'), 'password' => config('shop.transaction.wedeal.password'), 'reference' => $transaction->secret, 'description' => config('app.id') . ': ' . Ajde_Component_String::makePlural($transaction->shipment_itemsqty, 'item'), 'amount' => str_replace('.', ',', (string) $transaction->payment_amount), 'methodcode' => '0101', 'maxcount' => '1', 'test' => $this->isSandbox() ? 'true' : 'false', 'successurl' => config('app.rootUrl') . 'shop/transaction:callback/wedeal.html', 'failurl' => config('app.rootUrl') . 'shop/transaction:callback/wedeal.html']];
     $res = $this->sendRequest($request, true);
     if ($res['success'] === true) {
         $url = $res['response'];
         if (substr($url, 0, 7) === 'http://' || substr($url, 0, 8) === 'https://') {
             return $this->ping($url) ? $res['response'] : false;
         } else {
             Ajde_Log::log('Wedeal::getRedirectUrl() returned no URL but: ' . $res['response']);
             return false;
         }
     } else {
         Ajde_Log::log('Wedeal::getRedirectUrl() returned no URL but: ' . $res['response']);
         return false;
     }
 }
示例#5
0
 public function getRedirectUrl()
 {
     $transaction = $this->getTransaction();
     $total = (string) $total;
     $total = str_replace(".", ",", $total);
     $request = array("type" => "transaction", "transactionreq" => array("username" => Config::get('shopWedealUsername'), "password" => Config::get('shopWedealPassword'), "reference" => $transaction->secret, "description" => Config::get('ident') . ': ' . Ajde_Component_String::makePlural($transaction->shipment_itemsqty, 'item'), "amount" => str_replace(".", ",", (string) $transaction->payment_amount), "methodcode" => "0101", "maxcount" => "1", "test" => $this->isSandbox() ? "true" : "false", "successurl" => 'http://' . Config::get('site_root') . 'shop/transaction:callback/wedeal.html', "failurl" => 'http://' . Config::get('site_root') . 'shop/transaction:callback/wedeal.html'));
     $res = $this->sendRequest($request, true);
     if ($res['success'] === true) {
         $url = $res['response'];
         if (substr($url, 0, 7) === 'http://' || substr($url, 0, 8) === 'https://') {
             return $this->ping($url) ? $res['response'] : false;
         } else {
             Ajde_Log::log("Wedeal::getRedirectUrl() returned no URL but: " . $res['response']);
             return false;
         }
     } else {
         Ajde_Log::log("Wedeal::getRedirectUrl() returned no URL but: " . $res['response']);
         return false;
     }
 }
示例#6
0
 private function delete($crudId, $id)
 {
     $session = new Ajde_Session('AC.Crud');
     $crud = $session->getModel($crudId);
     $model = $crud->getModel();
     if (!is_array($id)) {
         $id = [$id];
     }
     $success = true;
     $deleted = 0;
     foreach ($id as $elm) {
         $model->loadByPK($elm);
         if ($result = $model->delete()) {
             $deleted++;
         }
         $success = $success * $result;
     }
     return ['operation' => 'delete', 'success' => (bool) $success, 'message' => Ajde_Component_String::makePlural($deleted, 'record') . ' deleted'];
 }
示例#7
0
 public function getRedirectParams()
 {
     $transaction = $this->getTransaction();
     return array('cmd' => '_xclick', 'business' => Config::get('shopPaypalAccount'), 'notify_url' => 'http://' . Config::get('site_root') . 'shop/transaction:callback/paypal.html', 'bn' => Config::get('ident') . '_BuyNow_WPS_' . strtoupper(Ajde_Lang::getInstance()->getShortLang()), 'amount' => $transaction->payment_amount, 'item_name' => Config::get('ident') . ': ' . Ajde_Component_String::makePlural($transaction->shipment_itemsqty, 'item'), 'quantity' => 1, 'address_ override' => 1, 'address1' => $transaction->shipment_address, 'zip' => $transaction->shipment_zipcode, 'city' => $transaction->shipment_city, 'state' => $transaction->shipment_region, 'country' => $transaction->shipment_country, 'email' => $transaction->email, 'first_name' => $transaction->name, 'currency_code' => Config::get('currencyCode'), 'custom' => $transaction->secret, 'no_shipping' => 1, 'no_note' => 1, 'return' => 'http://' . Config::get('site_root') . 'shop/transaction:complete', 'rm' => 1);
 }
 public function delete($crudId, $id)
 {
     $session = new Ajde_Session('AC.Crud');
     $crud = $session->getModel($crudId);
     $model = $crud->getModel();
     if (!is_array($id)) {
         $id = array($id);
     }
     $success = true;
     foreach ($id as $elm) {
         $model->loadByPK($elm);
         $success = $success * $model->delete();
     }
     return array('operation' => 'delete', 'success' => (bool) $success, 'message' => Ajde_Component_String::makePlural(count($id), 'record') . ' deleted');
 }
示例#9
0
 public function typeBtnJson()
 {
     $value = Ajde::app()->getRequest()->getPostParam('type');
     $id = Ajde::app()->getRequest()->getPostParam('id', false);
     $model = new MediaModel();
     if (!is_array($id)) {
         $id = [$id];
     }
     foreach ($id as $elm) {
         $model->loadByPK($elm);
         $model->set('mediatype', $value);
         $model->save();
     }
     return ['success' => true, 'message' => Ajde_Component_String::makePlural(count($id), 'media') . ' changed'];
 }