本文整理汇总了PHP中Booking::payment方法的典型用法代码示例。如果您正苦于以下问题:PHP Booking::payment方法的具体用法?PHP Booking::payment怎么用?PHP Booking::payment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Booking
的用法示例。
在下文中一共展示了Booking::payment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
if (!Tools::hasFunction('booking_list')) {
Tools::redirect('index.php');
}
if (Tools::getValue("settle") == 1) {
$this->brandNavi[] = array("name" => "Settlement", "url" => 'booking_list.php?settle=1');
} else {
$this->brandNavi[] = array("name" => "Booking List", "url" => $this->php_self);
}
if (Tools::isSubmit("change_pay")) {
$id = (int) Tools::getValue("id");
$status = (int) Tools::getValue("status");
Booking::changePayStatus($id, $status);
if ($status == 2) {
Booking::changeBookingStatus($id, 10);
// Successed
Booking::payment($id, $_POST['money']);
//给otherPrice值
}
exit;
} else {
if (Tools::isSubmit("change_status")) {
$id = (int) Tools::getValue("id");
$status = (int) Tools::getValue("status");
$roleid = self::$cookie->RoleID;
if ($status == 7) {
$bookingInfo = Booking::getBookingInfo($id);
$checkin = $bookingInfo['checkin'];
$nights = $bookingInfo['nights'];
$roomplan_list = array();
foreach ($bookingInfo['booked_roomplan_list'] as $booked_roomplan_list) {
$roomplan_list[] = $booked_roomplan_list['RoomPlanId'];
}
Stock::updateAmountStock($checkin, $nights, $roomplan_list);
}
Booking::changeBookingStatus($id, $status);
exit;
}
}
}
示例2: run
public function run()
{
$logStr = "";
$logFd = fopen(PAYPAL_IPN_LOG, "a");
//$booking_info = Booking::getBookingInfoByBN('TASF0000427');
// p($booking_info);
fwrite($logFd, "******************************START*****************************************************************\n");
//echo PAYPAL_IPN_LOG;
if (array_key_exists("txn_id", $_POST)) {
$logStr = "Received IPN, TX ID : " . htmlspecialchars($_POST["txn_id"]);
fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
} else {
$logStr = "IPN Listner recieved an HTTP request with out a Transaction ID.";
fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
fclose($logFd);
exit;
}
//从 PayPal 出读取 POST 信息同时添加变量?cmd?
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&{$key}={$value}";
}
//建议在此将接受到的信息记录到日志文件中以确认是否收到 IPN 信息
$tmpAr = array_merge($_POST, array("cmd" => "_notify-validate"));
$postFieldsAr = array();
foreach ($tmpAr as $name => $value) {
$postFieldsAr[] = "{$name}={$value}";
}
$logStr = "Sending IPN values:\n" . implode("\n", $postFieldsAr);
fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
//将信息 POST 回给 PayPal 进行验证
$ppResponseAr = Utils::PPHttpPost("https://www." . DEFAULT_ENV . ".paypal.com/cgi-bin/webscr", implode("&", $postFieldsAr), false);
if (!$ppResponseAr["status"]) {
fwrite($logFd, "--------------------\n");
$logStr = "IPN Listner recieved an Error:\n";
if (0 !== $ppResponseAr["error_no"]) {
$logStr .= "Error " . $ppResponseAr["error_no"] . ": ";
}
$logStr .= $ppResponseAr["error_msg"];
fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
fclose($logFd);
exit;
}
//将 POST 变量记录在本地变量中
//该付款明细所有变量可参考:
//https://www.paypal.com/IntegrationCenter/ic_ipn-pdt-variable-reference.html
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
//…
//判断回复 POST 是否创建成功
fwrite($logFd, "--------------------\n");
$logStr = "IPN Post Response:\n" . $ppResponseAr["httpResponse"];
fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
$res = $ppResponseAr["httpResponse"];
//已经通过认证
if (strcmp($res, "VERIFIED") == 0) {
fwrite($logFd, "----- VERIFIED -----------\n");
//检查付款状态
fwrite($logFd, "----- Payment Status:{$payment_status} -----------\n");
if ($payment_status == "Completed") {
//检查 txn_id 是否已经处理过
fwrite($logFd, "-----Check Transaction ID :{$txn_id}-----------\n");
//检查 receiver_email 是否是您的 PayPal 账户中的 EMAIL 地址
fwrite($logFd, "-----Check Receiver_email :{$receiver_email}-----------\n");
if ($receiver_email != DEFAULT_EMAIL_ADDRESS) {
fwrite($logFd, "----- Receiver_email Error :{$receiver_email}-----------\n");
} else {
//检查付款金额和货币单位是否正确
//todo:$ammount
$booking_info = Booking::getBookingInfoByBN($item_name);
// fwrite($logFd, "-----Booking Info :-----------\n");
//fwrite($logFd, var_dump($booking_info));
$ammount = $booking_info['money'];
fwrite($logFd, "-----Check Payment Amount :{$payment_amount}-----------\n");
fwrite($logFd, "-----Check Payment Currency :{$payment_currency}-----------\n");
if ($payment_currency != DEFAULT_PAYMENT_CURRENCY) {
fwrite($logFd, "-----Payment Currency Error :{$payment_currency}-----------\n");
} elseif ($payment_amount != $ammount) {
fwrite($logFd, "-----Payment Error :{$payment_amount}---{$ammount}--------\n");
} else {
//处理这次付款,包括写数据库
fwrite($logFd, "----- changeBookingStatus -----------\n");
Booking::changeBookingStatus($booking_info['order_id'], 4);
fwrite($logFd, "----- changePayStatus -----------\n");
Booking::changePayStatus($booking_info['order_id'], 2);
fwrite($logFd, "----- payment -----------\n");
Booking::payment($booking_info['order_id'], $payment_amount);
//下订单成功,此时需要发送邮件
fwrite($logFd, "----- ordermail -----------\n");
Tools::ordermail($booking_info['order_id']);
fwrite($logFd, "----- finish -----------\n");
}
}
//.........这里部分代码省略.........
示例3: process
public function process()
{
global $cookie;
if ($_POST["booking"] != 'confirm' && $_POST["booking"] != 'calculate' && $_REQUEST['booking'] != 'view' && $_POST['booking'] != 'payment' && $_POST["booking"] != 'finish' && $_POST["booking"] != 'save') {
Tools::redirect('index.php');
}
if ($_REQUEST['booking'] == 'view') {
// view page
if ($_REQUEST['vouch_info'] == 1 || $_REQUEST['savepdf'] == 1) {
$orderId = $_GET['oid'];
//获取订单编号
if ($_REQUEST['savepdf'] == 1) {
$booking_info = Booking::getBookingInfo($_GET['oid'], "en");
} else {
$booking_info = Booking::getBookingInfo($_GET['oid']);
}
$booking_info['agent_info'] = new Member($booking_info['OrderUserId']);
// make string of "Total No or rooms"
$_rooms = array();
foreach ($booking_info['booked_roomplan_list'] as $roomplan) {
if ($_rooms[$roomplan[RoomPlanId]]) {
$_rooms[$roomplan[RoomPlanId]]['count']++;
} else {
$_rooms[$roomplan[RoomPlanId]]['count'] = 1;
$_rooms[$roomplan[RoomPlanId]]['name'] = $roomplan[RoomPlanName];
}
}
$_roomsString = "";
foreach ($_rooms as $_room) {
if ($_roomsString != "") {
$_roomsString .= "& ";
}
$_roomsString .= $_room['count'] . " " . $_room['name'];
}
$booking_info['roomString'] = $_roomsString;
if ($_REQUEST['savepdf'] == 1) {
$this->printPDF($booking_info);
exit;
} else {
self::$smarty->assign("booking_info", $booking_info);
}
}
// move the engine to preprocess function
/*
$booking_info = Booking::getBookingInfo ( $_GET ['oid'] );
if (! $booking_info)
Tools::redirect ( 'index.php' );
if ($_REQUEST ['payment'])
self::$smarty->assign ( "payment", $_REQUEST ['payment'] );
self::$smarty->assign ( "method", 'view' );
*/
} else {
// other(build booking info from post variable for edit, confirm, finish)
$booking_info = Booking::buildBookingInfoFromPost(self::$cookie->CompanyID);
self::$smarty->assign("method", 'order');
self::$smarty->assign("booking_info", $booking_info);
foreach ($booking_info['booked_roomplan_list'] as $bi) {
//echo $bi['Check_0'];
if ($bi['Check_0'] == '0') {
$error['message'] = "満室のためご希望の日程には変更できません";
self::$smarty->assign("error", $error);
self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl');
exit;
}
}
//p($booking_info['booked_roomplan_list']);
}
if ($_POST["booking"] == 'calculate') {
$checkin = $_POST['checkin'];
//获取checkin的值
$checkout = $_POST['checkout'];
//获取checkout的值
//获取roomPlanId
$ids = $_POST['ids'];
$rpid_list = array();
foreach ($ids as $id) {
$rpid_list[] = $_POST['roomplan_ids_' . $id];
}
//计算房间数量是否满足条件,如果有一条不满足则发出错误报告
$roomplan_list = RoomPlan::getRoomPlanListForBooking($rpid_list, $checkin, $checkout);
$plan_list = array();
foreach ($roomplan_list as $record) {
$plan_list[$record['RoomPlanId']] = $record;
}
//查看是否有房间不满足条件
$isOk = true;
foreach ($rpid_list as $rpid) {
if (empty($plan_list[$rpid])) {
$isOk = false;
break;
}
}
if (!$isOk) {
$error['message'] = "There is not any room as requested";
self::$smarty->assign("error", $error);
self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl');
exit;
}
self::$smarty->assign("countries", Tools::getCountries());
self::$smarty->assign("method", 'edit');
//.........这里部分代码省略.........