本文整理汇总了PHP中Payment::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::create方法的具体用法?PHP Payment::create怎么用?PHP Payment::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendPayment
public function sendPayment()
{
$data = array();
// if ($x = Booking::find(Booking::max('id'))) {
// $data['reference_number'] = ++$x->reference_number;
// } else {
// $data['reference_number'] = 10000000;
// }
// $reference_number = $data['reference_number'];
$data = array('details' => 'thilina', 'ip_address' => $_SERVER['REMOTE_ADDR'], 'amount' => 0.1, 'payment_status' => 0, 'my_booking' => 2);
$reserv_id = Payment::create($data);
$data_tab_HSBC_payment = array('currency' => 'USD');
$tab_HSBC_payment_id = HsbcPayment::create($data_tab_HSBC_payment);
$stamp = strtotime("now");
$payment_id = Payment::orderBy('created_at', 'desc')->first()->id;
$orderid = "{$stamp}" . 'B' . "{$payment_id}";
$last_res_resid = str_replace(".", "", $orderid);
$hsbc_id = HsbcPayment::orderBy('created_at', 'desc')->first()->id;
$hsbc_payment_id_pre = "{$stamp}" . 'HSBC' . "{$hsbc_id}";
$hsbc_payment_id = str_replace(".", "", $hsbc_payment_id_pre);
if ($last_res_resid) {
$payment = DB::table('payments')->where('id', $payment_id)->update(array('reference_number' => $last_res_resid, 'HSBC_payment_id' => $hsbc_payment_id));
$data_tab_HSBC_payment = DB::table('hsbc_payments')->where('id', $hsbc_id)->update(array('HSBC_payment_id' => $hsbc_payment_id));
}
$amount = Input::get('amount');
Session::put('payment_amount', $amount);
// $hsbc_payment_id = 1000;
$currency = 'USD';
$total_price_all_hsbc = 0.1 * 100;
// $last_res_resid = 101;
//dd($hsbc_payment_id.'/'.$currency.'/'.$total_price_all_hsbc.'/'.$last_res_resid);
HsbcPayment::goto_hsbc_gateway($hsbc_payment_id, $currency, $total_price_all_hsbc, $last_res_resid);
}
示例2: store
/**
* Store a newly created payment in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Payment::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
if (Input::hasFile('attachment')) {
$no = Payment::max('id') + 1;
$noinvoice = 'AT' . date('Ymd') . $no;
$uploaded_file = Input::file('attachment');
$extension = $uploaded_file->getClientOriginalExtension();
$filename = Sentry::getUser()->first_name . '.' . $extension;
$destinationPath = public_path() . DIRECTORY_SEPARATOR . 'uploads/payments';
$uploaded_file->move($destinationPath, $filename);
// 25
$data['noinvoice'] = $noinvoice;
$data['attachment'] = $filename;
$data['school'] = Sentry::getUser()->first_name;
$data['year'] = date('Y');
$data['verifikasi'] = 0;
$data['user_id'] = Sentry::getUser()->id;
Payment::create($data);
return Redirect::to('user/cost')->with("successMessage", "Konfirmasi Pembayaran berhasil dimasukkan");
}
}
示例3: addNew
public function addNew()
{
//verify the user input and create account
$validator = Validator::make(Input::all(), array('Amount' => 'required|numeric'));
if ($validator->fails()) {
return Redirect::route('withdraw-get')->withErrors($validator)->withInput();
} else {
$amount = Input::get('Amount');
$todaysdate = date("Y-m-d");
$totalvisits = Link::where('username', '=', Auth::user()->username)->where('active', '=', TRUE)->sum('clicks');
$totalearned = $totalvisits * 0.1;
$withdrawn = Payment::where('user_id', '=', Auth::user()->id)->sum('amount');
$balance = $totalearned - $withdrawn;
if ($amount <= $balance) {
if ($amount >= 500) {
//register the new user
$newwithdrawal = Payment::create(array('user_id' => Auth::user()->id, 'amount' => $amount, 'withdrawal_date' => $todaysdate, 'paid' => FALSE));
if ($newwithdrawal) {
return Redirect::route('withdraw-get')->with('global', 'Success! Your Withdrawal request is being processed.');
}
} else {
return Redirect::route('withdraw-get')->with('global', 'Failed!! You are allowed to withdraw a minimum of Ksh 500.')->withInput();
}
} else {
return Redirect::route('withdraw-get')->with('global', 'Failed!! The amount exceeds your balance.')->withInput();
}
}
}
示例4: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Payment::create([]);
}
}
示例5: testAuthorizedPaymentCreatesCustomer
public function testAuthorizedPaymentCreatesCustomer()
{
$this->mockResponse($this->success_authorize_with_customer_response());
$params = array('card_number' => '4000000000000002', 'expiration_month' => '01', 'expiration_year' => date('Y') + 1, 'cvv' => '123', 'holder_name' => 'John Doe', 'amount' => 100, 'create_customer' => true, 'capture' => false);
$payment = Payment::create($params);
$this->assertPaymentProperties($payment);
$this->assertObjectHasAttribute('customer', $payment);
}
示例6: store
/**
* Store a newly created payment in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Payment::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Payment::create($data);
return Redirect::route('payments.index');
}
示例7: testPaymentCreate
public function testPaymentCreate()
{
$this->mockResponse($this->success_payment_create_response());
$params = array('card_number' => '4111111111111111', 'expiration_month' => '01', 'expiration_year' => date('Y') + 1, 'cvv' => '123', 'holder_name' => 'John Doe', 'amount' => 100);
$payment = Payment::create($params);
$this->assertObjectHasAttribute('token', $payment);
$this->assertObjectHasAttribute('status', $payment);
$this->assertObjectHasAttribute('amount', $payment);
$this->assertObjectHasAttribute('fee_amount', $payment);
}
示例8: setUp
public function setUp()
{
parent::setUp();
Payment::config()->allowed_gateways = array('PayPal_Express', 'PaymentExpress_PxPay', 'Manual', 'Dummy');
Payment::config()->parameters = array('PaymentExpress_PxPay' => array('username' => 'EXAMPLEUSER', 'password' => '235llgwxle4tol23l'));
//set up a payment here to make tests shorter
$this->payment = Payment::create()->setGateway("Dummy")->setAmount(1222)->setCurrency("GBP");
PaymentService::set_http_client($this->getHttpClient());
PaymentService::set_http_request($this->getHttpRequest());
}
示例9: post_process
public function post_process()
{
Log::write('PayPal', 'Trying to process IPN');
Bundle::start('paypal-ipn');
$listener = new IpnListener();
// $listener->use_sandbox = true;
try {
$listener->requirePostMethod();
$verified = $listener->processIpn();
} catch (Exception $e) {
Log::info($e->getMessage());
}
if ($verified) {
Log::write('PayPal', 'IPN payment looks verified');
$data = Input::get();
$settings = IniHandle::readini();
if (!in_array($data['payment_status'], array('Completed', 'COMPLETED', 'completed'))) {
Log::write('PayPal', 'payment not completed');
return View::make('msg.error')->with('error', 'PayPal: payment not completed');
}
if (strtolower($data['receiver_email']) != strtolower($settings['ppemail'])) {
Log::write('PayPal', 'receive email not same as set in settings. Settings: ' . $settings['ppemail'] . ' ||| PayPal email: ' . $data['receiver_email']);
return View::make('msg.error')->with('error', 'PayPal: receive email not same as set in settings');
}
if (Payment::where('transaction_id', '=', $data['txn_id'])->count() != 0) {
Log::write('PayPal', 'transaction ID already exists');
return View::make('msg.error')->with('error', 'PayPal: transaction ID already exists');
}
if (strtolower($data['mc_currency']) != strtolower($settings['ppcurrency'])) {
Log::write('PayPal', 'Currencies do not match');
return View::make('msg.error')->with('error', 'PayPal: currencies do not match');
}
Log::write('PayPal', 'Got past all PLAN controller checks now going into CUSTOM');
if (strtolower($data['custom']) == 'plan') {
$result = Payment::verifyPlan($data);
if (!$result) {
return $result;
}
} elseif (strtolower($data['custom']) == 'blacklist_skype' || strtolower($data['custom']) == 'blacklist_ip') {
$result = Payment::verifyBlacklist($data);
if (!$result) {
return $result;
}
} else {
Log::write('PayPal', 'Custom not found, can\'t verify anything');
return View::make('msg.error')->with('error', 'Fraudulent payment?');
}
Log::write('PayPal', 'Now trying to add Payment info to DB');
$payment = Payment::create(array('user_id' => $data['option_selection1'], 'token' => $data['ipn_track_id'], 'date' => date('Y-m-d H:i:s', time()), 'ack' => $data['payment_status'], 'transaction_id' => $data['txn_id'], 'amount' => $data['mc_gross'], 'paypal_fee' => $data['mc_fee'], 'status' => $data['payment_status'], 'description' => $data['custom']));
Log::write('PayPal', 'Successful payment, DB id: ' . $payment->id);
} else {
Log::write('PayPal', 'IPN listener returns false on check');
}
return 'handled';
}
示例10: createPayment
/**
* create payment for order
*
* @param string $success_url Url of page to display after successful payment
* @param string $cancel_url Url of page to display after canceled payment
* @param string $subject Subject of the payment
*
* @return Payment
*/
public function createPayment($success_url, $cancel_url, $subject = null)
{
$paymentdata = new PaypalPaymentData();
$paymentdata->subject = is_null($subject) ? 'Order #' . $this->getId() : $subject;
$paymentdata->cancel_url = $cancel_url;
$paymentdata->return_url = $success_url;
$payment = Payment::create($this->getGrossSum('de'), 'EUR', $paymentdata);
$payment->setOrder($this);
$payment->save();
return $payment;
}
示例11: submit
public function submit($data, $form)
{
$invoice = new PaymentPage_Invoice();
$invoice->write();
$form->saveInto($invoice);
$payment = Payment::create()->init($data['Gateway'], $invoice->Amount, $this->Currency)->setReturnUrl($this->Link('complete') . "?invoice=" . $invoice->ID)->setCancelUrl($this->Link() . "?message=payment cancelled");
$payment->write();
$invoice->ParentID = $this->ID;
$invoice->PaymentID = $payment->ID;
$invoice->write();
$payment->purchase($form->getData())->redirect();
}
示例12: createPayment
/**
* create payment for order
* @return Payment
*/
public function createPayment($action)
{
sfContext::getInstance()->getLogger()->log('Zahlung wird angelegt', 6);
$paymentdata = new PaypalPaymentData();
$paymentdata->subject = 'Test Payment #' . $this->getId();
$paymentdata->cancel_url = $action->generateUrl('timpany_cart', array(), true);
$paymentdata->return_url = $action->generateUrl('payment_approve', array(), true);
$payment = Payment::create($this->getGrossSum('de'), 'EUR', $paymentdata);
$payment->setOrder($this);
$payment->save();
return $payment;
}
示例13: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->info('Started...');
Subscription::chunk(200, function ($subscriptions) {
$accepted = 0;
$declined = 0;
$client = new Paylane\PayLaneRestClient('adubiel', 'dru9pra2');
foreach ($subscriptions as $subscription) {
$expiration = Carbon::createFromTimeStamp(strtotime($subscription->expires_at));
if ($expiration->isToday() || $expiration->isPast()) {
$sale = $subscription->payment()->orderBy('id', 'desc')->where('is_success', '=', 1)->orWhere('is_success', '=', 2)->first();
if ($sale->is_success == 2) {
$resale_params = array('id_authorization' => $sale->sale_id, 'amount' => 149.0, 'currency' => 'PLN', 'description' => 'Subskrypcja Hasztag.info');
$status = $client->resaleByAuthorization($resale_params);
} else {
if ($sale->is_success == 1) {
$params = array('id_sale' => $sale->sale_id, 'amount' => 149.0, 'currency' => 'PLN', 'description' => 'Subskrypcja Hasztag.info');
$status = $client->resaleBySale($params);
}
}
if ($client->isSuccess()) {
$accepted++;
$payment = Payment::create(array('user_id' => $subscription->user_id, 'subscription_id' => $subscription->id, 'sale_id' => $status['id_sale']));
$subscription->expires_at = Carbon::now()->addDays(30);
$subscription->is_active = 1;
$subscription->save();
$user = User::find($subscription->user_id);
$user->level = 2;
$user->save();
$configs = BoardConfig::where('user_id', '=', $subscription->user_id)->get();
if ($configs->count() > 0) {
foreach ($configs as $config) {
$config->is_active = 1;
$config->save();
}
}
EmailNotification::where('subscription_id', '=', $subscription->id)->delete();
$faktura = $subscription->company_id == 0 ? false : true;
Event::fire('invoice.email', array($subscription->user_id, $subscription->id, $payment->id, $faktura));
} else {
$declined++;
$payment = Payment::create(array('user_id' => $subscription->user_id, 'subscription_id' => $subscription->id, 'is_success' => 0, 'sale_id' => $status['error']['error_number']));
Event::fire('deactivate.subscription', array($subscription->id, $payment->created_at));
}
}
}
$this->info('Accepted:' . $accepted);
$this->info('Declined:' . $declined);
});
$this->info('Done');
}
示例14: testIndex
public function testIndex()
{
$controller = $this->getController();
//default is dataform
$output = $controller->index();
$this->assertInstanceOf("Form", $output['Form']);
$this->assertEquals("GatewaySelectForm", $output['Form']->getName());
//start a payment
$newpayment = Payment::create()->init("Dummy", 100, "NZD");
$controller->getPayable()->Payments()->add($newpayment);
//index switches to data form
$output = $controller->index();
$this->assertInstanceOf("Form", $output['Form']);
$this->assertEquals("GatewayDataForm", $output['Form']->getName());
}
示例15: executeIndex
/**
* The initial action where the amount which should be processed by PayPal is
* determined.
*
* @param sfWebRequest $request
* @return void
*/
public function executeIndex(sfWebRequest $request)
{
$this->approvedPayments = Doctrine_Core::getTable('Payment')->createQuery('p')->leftJoin('p.Transactions t')->leftJoin('p.DataContainer d')->where('p.state = ? OR p.state = ?', array(Payment::STATE_APPROVED, Payment::STATE_DEPOSITING))->execute();
$this->form = new mySimpleAmountForm();
if ($request->hasParameter('simpleAmountForm')) {
$this->form->bind($request->getParameter('simpleAmountForm'));
if ($this->form->isValid()) {
$data = new PaypalPaymentData();
$data->subject = 'Test Payment #ABC344';
$payment = Payment::create($this->form->getValue('amount'), $this->form->getValue('currency'), $data);
$data->cancel_url = $this->context->getController()->genUrl(array('module' => 'paypalDemo', 'action' => 'cancelPayment', 'reference' => $payment->id), true);
$data->return_url = $this->context->getController()->genUrl(array('module' => 'paypalDemo', 'action' => 'completePayment', 'reference' => $payment->id), true);
$data->save();
$this->redirect('paypalDemo/completePayment?reference=' . $payment->id);
}
}
}