本文整理汇总了PHP中Payment类的典型用法代码示例。如果您正苦于以下问题:PHP Payment类的具体用法?PHP Payment怎么用?PHP Payment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Payment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report
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');
}
示例2: vaultUpdate
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: processCheckout
/**
* @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: actionLoad_data
public function actionLoad_data()
{
$payment = new Payment();
$data['bank'] = $payment->Get_bank();
$data['payment'] = $payment->Get_patment();
$this->renderPartial('//backend/payment/detail', $data);
}
示例5: processCheckout
/**
* @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: create_from_pptxn
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: testXMLGeneration
/**
* @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');
}
}
示例8: logToReceiptRecords
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);
}
示例9: getCancelLink
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: asyncCallback
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;
}
示例11: get_course_cost
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;
}
示例12: testCreateIdentifier
public function testCreateIdentifier()
{
$payment = new Payment();
$payment->write();
$this->assertNotNull($payment->Identifier);
$this->assertNotEquals('', $payment->Identifier);
$this->assertEquals(30, strlen($payment->Identifier));
}
示例13: bankReturn
/**
* @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;
}
示例14: actionLoadpayment
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);
}
示例15: total
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;
}