public function report()
 {
     //add security to avoid stealing of information
     $user = Auth::user();
     $club = $user->Clubs()->FirstOrFail();
     $type = Input::get('expType');
     $from = date('Ymd', strtotime(Input::get('expFrom')));
     $to = date('Ymd', strtotime(Input::get('expTo')));
     $payments = Payment::where('club_id', '=', $club->id)->with('player')->whereBetween('created_at', array($from, $to))->get();
     $param = array('transaction_type' => 'cc', 'action_type' => 'refund,sale', 'condition' => 'pendingsettlement,complete,failed', 'club' => $club->id, 'start_date' => $from . '000000', 'end_date' => $to . '235959');
     $payment = new Payment();
     $transactions = $payment->ask($param);
     //return $transactions;
     //return json_decode(json_encode($transactions->transaction),true);
     // return View::make('export.lacrosse.accounting.all')
     // ->with('payments',  $transactions->transaction);
     //return json_decode(json_encode($transactions->transaction),true);
     Excel::create('transactions', function ($excel) use($transactions) {
         $excel->sheet('Sheetname', function ($sheet) use($transactions) {
             $sheet->setOrientation('landscape');
             // first row styling and writing content
             $sheet->loadView('export.lacrosse.accounting.all')->with('payments', $transactions->transaction);
         });
     })->download('xlsx');
 }
 public function vaultUpdate($id)
 {
     $user = Auth::user();
     $follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
     $club = Club::find($follow->club_id);
     $validator = Validator::make(Input::all(), Payment::$rules);
     if ($validator->passes()) {
         //validation done prior ajax
         $param = array('customer_vault_id' => $id, 'club' => $club->id, 'ccnumber' => Input::get('card'), 'ccexp' => sprintf('%02s', Input::get('month')) . Input::get('year'), 'cvv' => Input::get('cvv'), 'address1' => Input::get('address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'zip' => Input::get('zip'));
         $payment = new Payment();
         $transaction = $payment->update_customer($param, $user);
         if ($transaction->response == 3 || $transaction->response == 2) {
             $data = array('success' => false, 'error' => $transaction);
             return $data;
         } else {
             //update user customer #
             $user->profile->customer_vault = $transaction->customer_vault_id;
             $user->profile->save();
             //retrived data save from API - See API documentation
             $data = array('success' => true, 'customer' => $transaction->customer_vault_id, 'card' => substr($param['ccnumber'], -4), 'ccexp' => $param['ccexp'], 'zip' => $param['zip']);
             return Redirect::action('AccountController@settings')->with('notice', 'Payment information updated successfully');
         }
     }
     return Redirect::back()->withErrors($validator)->withInput();
     return Redirect::action('AccountController@settings');
 }
Пример #3
0
 /**
  * @param Payment $payment
  * @param CHttpRequest $request
  */
 public function processCheckout(Payment $payment, CHttpRequest $request)
 {
     $settings = $payment->getPaymentSystemSettings();
     $params = ['action' => $request->getParam('action'), 'orderSumAmount' => $request->getParam('orderSumAmount'), 'orderSumCurrencyPaycash' => $request->getParam('orderSumCurrencyPaycash'), 'orderSumBankPaycash' => $request->getParam('orderSumBankPaycash'), 'shopId' => $settings['shopid'], 'invoiceId' => $request->getParam('invoiceId'), 'customerNumber' => $request->getParam('customerNumber'), 'password' => $settings['password']];
     /* @var $order Order */
     $order = Order::model()->findByPk($request->getParam('orderNumber'));
     if ($order === null) {
         $message = Yii::t('YandexMoneyModule.ymoney', 'The order doesn\'t exist.');
         Yii::log($message, CLogger::LEVEL_ERROR);
         $this->showResponse($params, $message, 200);
     }
     if ($order->isPaid()) {
         $message = Yii::t('YandexMoneyModule.ymoney', 'The order #{n} is already payed.', $order->getPrimaryKey());
         Yii::log($message, CLogger::LEVEL_ERROR);
         $this->showResponse($params, $message, 200);
     }
     if ($this->getOrderCheckSum($params) !== $request->getParam('md5')) {
         $message = Yii::t('YandexMoneyModule.ymoney', 'Wrong checksum');
         Yii::log($message, CLogger::LEVEL_ERROR);
         $this->showResponse($params, $message, 200);
     }
     if ((double) $order->getTotalPriceWithDelivery() !== (double) $params['orderSumAmount']) {
         $message = Yii::t('YandexMoneyModule.ymoney', 'Wrong payment amount');
         Yii::log($message, CLogger::LEVEL_ERROR);
         $this->showResponse($params, $message, 200);
     }
     if ($params['action'] === 'checkOrder') {
         $this->showResponse($params);
     }
     if ($params['action'] === 'paymentAviso' && $order->pay($payment)) {
         Yii::log(Yii::t('YandexMoneyModule.ymoney', 'The order #{n} has been payed successfully.', $order->getPrimaryKey()), CLogger::LEVEL_INFO);
         $this->showResponse($params);
     }
 }
Пример #4
0
 public function actionLoad_data()
 {
     $payment = new Payment();
     $data['bank'] = $payment->Get_bank();
     $data['payment'] = $payment->Get_patment();
     $this->renderPartial('//backend/payment/detail', $data);
 }
Пример #5
0
 /**
  * @param Payment $payment
  * @param CHttpRequest $request
  * @return bool
  */
 public function processCheckout(Payment $payment, CHttpRequest $request)
 {
     $amount = $request->getParam('OutSum');
     $orderId = (int) $request->getParam('InvId');
     $crc = strtoupper($request->getParam('SignatureValue'));
     $order = Order::model()->findByPk($orderId);
     if (null === $order) {
         Yii::log(Yii::t('RobokassaModule.robokassa', 'Order with id = {id} not found!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
         return false;
     }
     if ($order->isPaid()) {
         Yii::log(Yii::t('RobokassaModule.robokassa', 'Order with id = {id} already payed!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
         return false;
     }
     $settings = $payment->getPaymentSystemSettings();
     $myCrc = strtoupper(md5("{$amount}:{$orderId}:" . $settings['password2']));
     if ($myCrc !== $crc) {
         Yii::log(Yii::t('RobokassaModule.robokassa', 'Error pay order with id = {id}! Bad crc!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
         return false;
     }
     if ($amount != Yii::app()->money->convert($order->total_price, $payment->currency_id)) {
         Yii::log(Yii::t('RobokassaModule.robokassa', 'Error pay order with id = {id}! Incorrect price!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
         return false;
     }
     if ($order->pay($payment)) {
         Yii::log(Yii::t('RobokassaModule.robokassa', 'Success pay order with id = {id}!', ['{id}' => $orderId]), CLogger::LEVEL_INFO, self::LOG_CATEGORY);
         return true;
     } else {
         Yii::log(Yii::t('RobokassaModule.robokassa', 'Error pay order with id = {id}! Error change status!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
         return false;
     }
 }
Пример #6
0
 static function create_from_pptxn($pptxn_id)
 {
     $t = new PayPalTxn($pptxn_id);
     # if it already has a payment_id, stop here and just return that id
     if ($t->payment_id() > 0) {
         return $t->payment_id();
     }
     $student_id = $t->student_id();
     if ($student_id === false) {
         return false;
     }
     $set = array('student_id' => $student_id, 'created_at' => 'NOW()');
     $money = $t->money();
     $set['currency'] = $money->code;
     $set['millicents'] = $money->millicents;
     $info = $t->infoarray();
     if (!isset($info['item_number'])) {
         return false;
     }
     $d = new Document($info['item_number']);
     if ($d->failed()) {
         return false;
     }
     $set['document_id'] = $d->id;
     $p = new Payment(false);
     $payment_id = $p->add($set);
     $t->set(array('payment_id' => $payment_id));
     return $payment_id;
 }
Пример #7
0
 /**
  * @param string $hostedDataId
  * @param float  $amount
  *
  * @dataProvider dataProvider
  */
 public function testXMLGeneration($hostedDataId, $amount)
 {
     $ccData = new Payment($hostedDataId, $amount);
     $document = new \DOMDocument('1.0', 'UTF-8');
     $xml = $ccData->getXML($document);
     $document->appendChild($xml);
     $elementPayment = $document->getElementsByTagName('ns1:Payment');
     $this->assertEquals(1, $elementPayment->length, 'Expected element Payment not found');
     $children = [];
     /** @var \DOMNode $child */
     foreach ($elementPayment->item(0)->childNodes as $child) {
         $children[$child->nodeName] = $child->nodeValue;
     }
     if ($hostedDataId !== null) {
         $this->assertArrayHasKey('ns1:HostedDataID', $children, 'Expected element HostedDataID not found');
         $this->assertEquals($hostedDataId, $children['ns1:HostedDataID'], 'Hosted data id did not match');
     } else {
         $this->assertArrayNotHasKey('ns1:HostedDataID', $children, 'Unexpected element HostedDataID was found');
     }
     if ($amount !== null) {
         $this->assertArrayHasKey('ns1:ChargeTotal', $children, 'Expected element ChargeTotal not found');
         $this->assertEquals($amount, $children['ns1:ChargeTotal'], 'Charge total did not match');
         $this->assertArrayHasKey('ns1:Currency', $children, 'Expected element Currency not found');
         $this->assertEquals('978', $children['ns1:Currency'], 'Currency did not match');
     } else {
         $this->assertArrayNotHasKey('ns1:ChargeTotal', $children, 'Unexpected element ChargeTotal was found');
         $this->assertArrayNotHasKey('ns1:Currency', $children, 'Unexpected element Currency was found');
     }
 }
 public static function logToReceiptRecords($f)
 {
     $file_db = new PDO('sqlite:' . $f);
     $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $result = $file_db->query('SELECT * FROM transactions;');
     $receiptNO = "";
     foreach ($result as $m) {
         $receiptNo = $m["receiptNo"];
     }
     $receiptlines = ReceiptLine::where('receiptNo', $receiptNo)->get();
     foreach ($receiptlines as $receiptline) {
         ReceiptLine::destroy($receiptline->id);
     }
     $receiptRecords = Receiptrecord::where(['receiptNo' => $receiptNo, 'progress' => '提供済み'])->get();
     foreach ($receiptRecords as $receiptRecord) {
         $receiptRecord->payment_id = $m['payment_id'];
         $receiptRecord->progress = "支払い済み";
         $receiptRecord->save();
     }
     $file_db = new PDO('sqlite:' . $f);
     $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $result = $file_db->query('SELECT * FROM payments;');
     foreach ($result as $m) {
         $payment = new Payment();
         $payment->price = $m["price"];
         $payment->payment = $m["payment"];
         $payment->changes = $m["changes"];
         $payment->time = $m["time"];
         $payment->uuid = $m["uuid"];
         $payment->shopName = $m["shopName"];
         $payment->employeeName = $m["employeeName"];
         $payment->save();
     }
     //        unlink($f);
 }
 static function getCancelLink(Payment $payment)
 {
     $paysys = $this->getDi()->paysystemList->get($payment->paysys_id);
     if ($paysys && $paysys->isRecurring() && ($pay_plugin =& instantiate_plugin('payment', $v['paysys_id'])) && method_exists($pay_plugin, 'get_cancel_link') && ($product = $payment->getProduct(false) && $product->isRecurring())) {
         return $pay_plugin->get_cancel_link($v['payment_id']);
     }
 }
Пример #10
0
 /**
  * @dataProvider isPaymentEnabledDataProvider
  */
 public function testIsPaymentEnabled($groupConfig, $expected)
 {
     $this->_element->setGroup($groupConfig);
     $this->_backendConfig->expects($this->any())->method('getConfigDataValue')->will($this->returnValueMap([[self::CONFIG_PATH_ACTIVE, null, null, '1'], [self::CONFIG_PATH_NOT_ACTIVE, null, null, '0']]));
     $html = $this->_model->render($this->_element);
     $this->assertContains($expected, $html);
 }
Пример #11
0
 public function asyncCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
 {
     //使用通用通知接口
     $notify = new Notify_pub();
     $xml = $GLOBALS['HTTP_RAW_POST_DATA'];
     $notify->saveData($xml);
     //验证签名,并回应微信。
     //对后台通知交互时,如果微信收到商户的应答不是成功或超时,微信认为通知失败,
     //微信会通过一定的策略(如30分钟共8次)定期重新发起通知,
     //尽可能提高通知的成功率,但微信不保证通知最终能成功。
     $payment = new Payment($paymentId);
     $paymentInfo = $payment->getPayment();
     $paymentInfo['partner_key'];
     if ($notify->checkSign($paymentInfo['partner_key']) == FALSE) {
         $notify->setReturnParameter("return_code", "FAIL");
         //返回状态码
         $notify->setReturnParameter("return_msg", "签名失败");
         //返回信息
         echo $notify->returnXml();
     } else {
         $notify->setReturnParameter("return_code", "SUCCESS");
         //设置返回码
         $this->returnXml = $notify->returnXml();
     }
     if ($notify->checkSign($paymentInfo['partner_key']) == TRUE) {
         if ($notify->data["return_code"] == "SUCCESS" && $notify->data["return_code"] == "SUCCESS") {
             $orderNo = $notify->data['out_trade_no'];
             $money = $notify->data['total_fee'] / 100;
             return true;
         }
     }
     return false;
 }
Пример #12
0
 function get_course_cost($user)
 {
     $payment = new Payment();
     $late = new Late();
     $group_status = $this->is_group_user($user);
     if ($group_status == 0) {
         $course_cost_array = $payment->get_personal_course_cost($user->courseid);
         $course_cost = $course_cost_array['cost'];
     } else {
         $participants = $this->get_group_user_num($user);
         $course_cost_array = $payment->get_course_group_discount($user->courseid, $participants);
         $course_cost = $course_cost_array['cost'];
     }
     $tax_status = $payment->is_course_taxable($user->courseid);
     if ($tax_status == 1) {
         $tax = $payment->get_state_taxes($user->state);
     } else {
         $tax = 0;
     }
     // end else
     if ($user->slotid > 0) {
         $apply_delay_fee = $late->is_apply_delay_fee($user->courseid, $user->slotid);
         $late_fee = $late->get_delay_fee($user->courseid);
     }
     $grand_total = $course_cost;
     if ($tax_status == 1) {
         $grand_total = $grand_total + round($course_cost * $tax / 100);
     }
     if ($apply_delay_fee) {
         $grand_total = $grand_total + $late_fee;
     }
     return $grand_total;
 }
 public function testCreateIdentifier()
 {
     $payment = new Payment();
     $payment->write();
     $this->assertNotNull($payment->Identifier);
     $this->assertNotEquals('', $payment->Identifier);
     $this->assertEquals(30, strlen($payment->Identifier));
 }
Пример #14
0
 /**
  * @param Response $response
  * @return OrderInterface
  */
 public function bankReturn(Response $response)
 {
     $this->status = $response->isSuccessful() ? 'paid' : 'error';
     $this->save();
     // log bank return
     $log = new Payment(['user_id' => $this->user_id, 'order_id' => $this->id, 'bank_code' => $response->getAdapter()->adapterTag, 'amount' => $this->due_amount, 'status' => $this->status, 'data_dump' => $response->__toString(), 'created' => new Expression('NOW()')]);
     $log->save();
     return $this;
 }
Пример #15
0
 public function actionLoadpayment()
 {
     $howtoorder = new Howtoorder();
     $payment = new Payment();
     $data['bank'] = $payment->Get_bank();
     $data['payment'] = $payment->Get_patment();
     $data['howtoorder'] = $howtoorder->Get_howto();
     $this->renderPartial('//payment/viewload', $data);
 }
Пример #16
0
 public function total()
 {
     if (!($total = Cache::read('payments_total_' . $this->key, 'expenses'))) {
         $payment = new Payment();
         $total = $payment->find('all', array('fields' => array('sum(value) as total'), 'conditions' => array('or' => array('Payment.user_id' => $this->Authorization->User->id(), 'Payment.team_id' => $this->Authorization->User->Team->id()))));
         Cache::write('payments_total_' . $this->key, $total, 'expenses');
     }
     return isset($total[0][0]) ? round($total[0][0]['total'], 2) : 0;
 }
 public function actionAdmin()
 {
     $model = new Payment('search');
     $model->unsetAttributes();
     if (isset($_GET['Payment'])) {
         $model->setAttributes($_GET['Payment']);
     }
     $this->render('admin', array('model' => $model));
 }
Пример #18
0
 public function executeAdd(sfWebRequest $request)
 {
     $this->forward404Unless($index = $request->getParameter('index'));
     $payment = new Payment();
     $payment->setInvoiceId($request->getParameter('invoice_id'));
     // insert a PaymentForm with csrf protection disabled
     $form = new PaymentForm($payment, array('culture' => $this->getUser()->getCulture()), false);
     $form->getWidgetSchema()->setNameFormat('payments[new_' . $index . '][%s]');
     return $this->renderText('<li><ul><a href="#" class="xit"/>' . $form . '</ul></li>');
 }
Пример #19
0
 function updatePayment($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $payment = new Payment();
     $payment->parseDomDocument($domDoc);
     $ret = $payment->updateRecord();
     return $ret;
 }
Пример #20
0
 function getPayment($paymentID)
 {
     $payment = new Payment();
     $payment->selectRecord($paymentID);
     if (!($domDoc = $payment->getDomDocument())) {
         return false;
     } else {
         $xmlStr = $domDoc->dump_mem(true);
         return $xmlStr;
     }
 }
Пример #21
0
 public function testSetRequestValidData()
 {
     $file = __DIR__ . "/../../resources/confitests.php";
     $config = Config::fromFile($file, 'TEST');
     $payment = new Payment($config);
     $request = new Container();
     $requestData = array('PROVIDER' => 'ProviderTest', 'METHOD' => 'BILLET', 'clientID' => 1, 'value' => 14.9, 'product' => 'livro');
     $request->fromArray($requestData);
     $payment->request($request);
     $this->assertInstanceOf('\\Ecomz\\Payment\\Payment', $payment);
 }
Пример #22
0
        public function actionCustomerdatewisepayments()
{
            $model = new Payment( 'search' );
            $model->unsetAttributes();  // clear any default values
            if ( isset( $_GET['Payment'] ) )
                $model->attributes = $_GET['Payment'];

            $this->render( 'customerdatewisepayments', array(
                'model' => $model,
            ) );
}
Пример #23
0
 function testPaid()
 {
     $this->CI->load->model('payment');
     $payment = new Payment($this->DBI);
     $this->assertTrue($payment->paid('*****@*****.**', array('1_222', '2_3333'), Payment::PAYPAL, 6.5, 'dfsdfsdfsdf'), 'Payment returned true with valid details');
     $paymentID = $payment->getInsertID();
     $this->assertTrue($paymentID, 'Successfully inserted payment with array of keys');
     $payment = new Payment($this->DBI);
     $this->assertTrue($payment->paid('*****@*****.**', '1_222', Payment::PAYPAL, 6.5, 'dfsdfsdfsdf'), 'Payment returned true with valid details');
     $paymentID = $payment->getInsertID();
     $this->assertTrue($paymentID, 'Successfully inserted payment with single key');
 }
 protected function migrateRecord($record)
 {
     $payment = new Payment($record);
     $payment->Status = "Created";
     $payment->ClassName = "Payment";
     $payment->MoneyAmount = $record['AmountAmount'];
     $payment->MoneyCurrency = $record['AmountCurrency'];
     $payment->Gateway = $this->classToGateway($record['ClassName']);
     $statusmap = array('Incomplete' => 'Created', 'Success' => 'Captured', 'Failure' => 'Void', 'Pending' => 'Authorized', '' => 'Created');
     $payment->Status = $statusmap[$record['Status']];
     $payment->write();
     $this->count++;
 }
Пример #25
0
/**
 * Returns the pay page url or the merchant js file.
 * 
 * @param unknown $params        	
 * @param unknown $salt        	
 * @throws Exception
 * @return Ambigous <multitype:number string , multitype:number Ambigous <boolean, string> >
 */
function pay($params, $salt)
{
    if (!is_array($params)) {
        throw new Exception('Pay params is empty');
    }
    if (empty($salt)) {
        throw new Exception('Salt is empty');
    }
    $payment = new Payment($salt);
    $result = $payment->pay($params);
    unset($payment);
    return $result;
}
Пример #26
0
 /**
  * @brief 获取支付插件配置详细信息
  * @param $paymentId int    支付方式id值
  * @param $key       string 插件配置项
  */
 public function getConf($paymentId, $key = '')
 {
     if (empty($this->_config)) {
         $payment = new Payment();
         $payment_cfg = $payment->getPaymentById($paymentId);
         $this->_config = unserialize($payment_cfg['config']);
     }
     if ($key != '' && isset($this->_config[$key])) {
         return $this->_config[$key];
     } else {
         return $this->_config;
     }
 }
Пример #27
0
 function old_testValidateWrongCurrency()
 {
     $o = new Order();
     $o->Currency = 'USD';
     $o->write();
     $p = new Payment();
     $p->Money->setCurrency('EUR');
     //fails here
     $p->Money->setAmount(1.23);
     $p->OrderID = $o->ID;
     $validationResult = $p->validate();
     $this->assertContains('Currency of payment', $validationResult->message());
 }
Пример #28
0
 /**
  * Initialize the object with raw data
  *
  * @param $data
  * @return Payment
  */
 public static function initializeWithRawData($data)
 {
     $item = new Payment();
     if (isset($data['amount'])) {
         $item->setAmount($data['amount']);
     }
     if (isset($data['paid_at'])) {
         $item->setPaidAt(new \DateTime('@' . strtotime($data['paid_at'])));
     }
     if (isset($data['identifier'])) {
         $item->setIdentifier($data['identifier']);
     }
     return $item;
 }
Пример #29
0
 public function init()
 {
     if (isset($_POST['payNewBillPayment'])) {
         $payment = new Payment();
         $payment->cancelSessions();
         unset($_POST['payNewBillPayment']);
     }
     $accounts = new Accounts();
     $accounts->userID = $_SESSION['userID'];
     $_SESSION['accounts'] = $accounts->getAccounts();
     $billers = new Billers();
     $billers->userID = $_SESSION['userID'];
     $_SESSION['billers'] = $billers->getBillers();
 }
 /**
  * Implements PaymentMethodController::execute().
  */
 function execute(\Payment $payment)
 {
     $data =& $payment->context_data['method_data'];
     $redirect = NULL;
     if (!empty($data['redirect'])) {
         $payment->setStatus(new \PaymentStatusItem(PAYMENT_STATUS_PENDING));
         $path = WPS_TEST_PAYMENT_REDIRECT_URL . (int) $payment->pid;
         $redirect = array($path, array());
     } else {
         $payment->setStatus(new \PaymentStatusItem($data['status']));
     }
     if ($redirect) {
         $payment->contextObj->redirect($redirect[0], $redirect[1]);
     }
 }