本文整理汇总了PHP中Paypal::process方法的典型用法代码示例。如果您正苦于以下问题:PHP Paypal::process方法的具体用法?PHP Paypal::process怎么用?PHP Paypal::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paypal
的用法示例。
在下文中一共展示了Paypal::process方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirm
public function confirm()
{
access::verify_csrf();
$form = $this->getCheckoutForm();
$valid = $form->validate();
if ($valid) {
$basket = Session_Basket::get();
if (!isset($basket->contents) || count($basket->contents) == 0) {
self::view_basket();
return;
}
/* changed order for nl_NL */
$basket->title = $form->contact->title->value;
$basket->initials = $form->contact->initials->value;
$basket->insertion = $form->contact->insertion->value;
$basket->name = $form->contact->fullname->value;
$basket->street = $form->contact->street->value;
$basket->house = $form->contact->house->value;
$basket->postcode = $form->contact->postcode->value;
$basket->town = $form->contact->town->value;
$basket->suburb = $form->contact->suburb->value;
$basket->email = $form->contact->email->value;
$basket->phone = $form->contact->phone->value;
$basket->childname = $form->contact->childname->value;
$basket->childgroup = $form->contact->childgroup->value;
$basket->comments = $form->contact->comments->value;
$basket->agreeterms = $form->contact->agreeterms->value;
$paypal = $form->contact->paypal->value == "true";
$template = new Theme_View("page.html", "basket");
// NOT USED ===============================
if ($paypal) {
// create a prelimary order
$order = basket::createOrder($basket, Order_Model::PAYMENT_PAYPAL);
$paypal = new Paypal();
// create the order first
$view = new View("paypal_redirect.html");
$view->form = $paypal->process($basket, url::site("basket/paypal_complete/{$order->id}", "http"), url::site("basket/paypal_cancel/{$order->id}", "http"), url::site("basket/paypal_ipn/{$order->id}", "http"));
$template->content = $view;
print $template;
// redirect to paypal
// NOT USED END ===============================
} else {
$form = new Forge("basket/complete", "", "post", array("id" => "confirm", "name" => "confirm"));
$view = new View("confirm_order.html");
$view->basket = $basket;
$template->content = $view;
$view->form = $form;
print $template;
}
} else {
die("Invalid confirmation!");
}
}
示例2: complete
public function complete()
{
access::verify_csrf();
$basket = Session_Basket::get();
if (!isset($basket->contents) || count($basket->contents) == 0) {
self::view_basket();
return;
}
$paypal = $basket->paypal;
if ($paypal) {
//paypal payment
$template = new Theme_View("page.html", "basket", "confirm");
// create a preliminary order
$order = basket_plus::createOrder($basket, Bp_Order_Model::PAYMENT_PAYPAL);
bp_order_log::log($order, Bp_Order_Log_Model::ORDERED);
// send e-mails to customer and internal order handling
basket_plus::send_order($order);
// paypal stuff
$paypal_payment = new Paypal();
$view = new View("paypal_redirect.html");
// here the functions to call after paypal processing are defined;
// function 'process' redirects to the PayPal site (see library Paypal)
$view->form = $paypal_payment->process($basket, url::site("basket_plus/paypal_complete/{$order->id}", "http"), url::site("basket_plus/paypal_cancel/{$order->id}", "http"), url::site("basket_plus/paypal_ipn/{$order->id}", "http"));
$template->content = $view;
print $template;
} else {
//offline payment
// create order
$order = basket_plus::createOrder($basket, Bp_Order_Model::PAYMENT_OFFLINE);
bp_order_log::log($order, Bp_Order_Log_Model::ORDERED);
$basket->clear();
// send e-mails to customer and internal order handling
basket_plus::send_order($order);
// show page Order completed
$this->_complete($order);
}
}