本文整理汇总了PHP中feed::proAccountHistory方法的典型用法代码示例。如果您正苦于以下问题:PHP feed::proAccountHistory方法的具体用法?PHP feed::proAccountHistory怎么用?PHP feed::proAccountHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feed
的用法示例。
在下文中一共展示了feed::proAccountHistory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PageMain
//.........这里部分代码省略.........
// If the token and PayerID has been returned by the Return URL
if (isset($_GET["token"]) && isset($_GET["PayerID"])) {
$token = $_GET["token"];
$payer_id = $_GET["PayerID"];
// Get the selected plan
$ItemName = $_SESSION['ItemName'];
//Item Name
$ItemPrice = $_SESSION['ItemPrice'];
//Item Price
$ItemNumber = $_SESSION['ItemNumber'];
//Item Number
$ItemDesc = $_SESSION['ItemDesc'];
//Item Number
$ItemQty = $_SESSION['ItemQty'];
// Item Quantity
$ItemTotalPrice = $_SESSION['ItemTotalPrice'];
$params = array('TOKEN' => $token, 'PAYERID' => $payer_id, 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', 'L_PAYMENTREQUEST_0_NAME0' => $ItemName, 'L_PAYMENTREQUEST_0_NUMBER0' => $ItemNumber, 'L_PAYMENTREQUEST_0_DESC0' => $ItemDesc, 'L_PAYMENTREQUEST_0_AMT0' => $ItemPrice, 'L_PAYMENTREQUEST_0_QTY0' => $ItemQty, 'PAYMENTREQUEST_0_ITEMAMT' => $ItemTotalPrice, 'PAYMENTREQUEST_0_AMT' => $ItemPrice, 'PAYMENTREQUEST_0_CURRENCYCODE' => $PayPalCurrencyCode, 'PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD' => 'InstantPaymentOnly');
// Execute DoExpressCheckoutPayment to receive the payment from the user
$paypalResponse = $paypal->post('DoExpressCheckoutPayment', $params, $PayPalMode);
// Check if the payment was successful
if (strtoupper($paypalResponse["ACK"]) == "SUCCESS") {
// Verify if the payment is Completed
if ($paypalResponse["PAYMENTINFO_0_PAYMENTSTATUS"] == 'Completed') {
// Execute GetExpressCheckoutDetails to retrieve the transaction details
$params = array('TOKEN' => $token);
$paypalResponse = $paypal->post('GetExpressCheckoutDetails', $params, $PayPalMode);
// If the GetExpressCheckoutDetails was successful
if (strtoupper($paypalResponse["ACK"]) == "SUCCESS") {
$date = date("Y-m-d H:m:s", strtotime($_SESSION['SelectedPlan'] == 1 ? "+1 year" : "+1 month"));
$stmt = $db->prepare(sprintf("INSERT INTO `payments`\n\t\t\t\t\t\t\t\t(`by`, `payer_id`, `payer_first_name`, `payer_last_name`, `payer_email`, `payer_country`, `txn_id`, `amount`, `currency`, `type`, `status`, `valid`, `time`) VALUES \n\t\t\t\t\t\t\t\t('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s')", $db->real_escape_string($feed->id), $db->real_escape_string($paypalResponse['PAYERID']), $db->real_escape_string($paypalResponse['FIRSTNAME']), $db->real_escape_string($paypalResponse['LASTNAME']), $db->real_escape_string($paypalResponse['EMAIL']), $db->real_escape_string($paypalResponse['SHIPTOCOUNTRYNAME']), $db->real_escape_string($paypalResponse['PAYMENTREQUEST_0_TRANSACTIONID']), $db->real_escape_string($paypalResponse['AMT']), $settings['currency'], $_SESSION['SelectedPlan'], 1, $date, date("Y-m-d H:m:s")));
// Execute the statement
$stmt->execute();
// Check the affected rows
$affected = $stmt->affected_rows;
// Close the statement
$stmt->close();
// If the pro status has been added
if ($affected) {
// Set the pro account to valid
$proAccount = 2;
}
} else {
$TMPL['error'] = notificationBox('error', '<strong>' . urldecode($paypalResponse['L_SHORTMESSAGE0'] . '</strong>: ' . $paypalResponse['L_LONGMESSAGE0']));
}
} else {
$TMPL['error'] = notificationBox('error', '<strong>' . urldecode($paypalResponse['L_SHORTMESSAGE0'] . '</strong>: ' . $paypalResponse['L_LONGMESSAGE0']));
}
} else {
$TMPL['error'] = notificationBox('error', '<strong>' . urldecode($paypalResponse['L_SHORTMESSAGE0'] . '</strong>: ' . $paypalResponse['L_LONGMESSAGE0']));
}
}
}
if ($proAccount) {
$skin = new skin('pro/successful');
$rows = '';
$transaction = $feed->getProStatus($feed->id, 2);
// If the proAccount was just created
if ($proAccount == 2) {
$TMPL['pro_title'] = $LNG['congratulations'] . '!';
$TMPL['pro_title_desc'] = $LNG['go_pro_congrats'];
} else {
$TMPL['pro_title'] = $LNG['pro_plan'];
$TMPL['pro_title_desc'] = $LNG['account_status'];
}
// Explode the date to display in a custom format
$valid = explode('-', $transaction['valid']);
$TMPL['validuntil'] = $valid[0] . '-' . $valid[1] . '-' . substr($valid[2], 0, 2);
// Decide the plan type
$TMPL['plan'] = $transaction['amount'] == $settings['proyear'] ? $LNG['yearly'] : $LNG['monthly'];
// Days left of pro Plan
$TMPL['daysleft'] = floor((strtotime($transaction['valid']) - strtotime(date("Y-m-d H:i:s"))) / (60 * 60 * 24)) . ' ' . $LNG['days_left'];
// The Amount paid for the pro plan
$TMPL['amount'] = $transaction['amount'] . ' ' . $settings['currency'];
}
$TMPL['go_pro_action'] = 'formSubmit(\'gopro-form\')';
} else {
$TMPL['go_pro_action'] = 'connect_modal()';
}
$TMPL['history'] = $feed->proAccountHistory(null, 1, 1);
$TMPL['protracksize'] = fsize($settings['protracksize']);
$TMPL['protracktotal'] = fsize($settings['protracktotal']);
$TMPL['tracksize'] = fsize($settings['tracksize']);
$TMPL['tracksizetotal'] = fsize($settings['tracksizetotal']);
$TMPL['promonth'] = $settings['promonth'];
$TMPL['proyear'] = $settings['proyear'];
$TMPL['currency'] = $settings['currency'];
$rows = $skin->make();
$TMPL = $TMPL_old;
unset($TMPL_old);
$TMPL['rows'] = $rows;
if (isset($_GET['logout']) == 1) {
$loggedIn->logOut();
header("Location: " . $CONF['url'] . "/index.php?a=welcome");
}
$TMPL['url'] = $CONF['url'];
$TMPL['title'] = $LNG['go_pro'] . ' - ' . $settings['title'];
$TMPL['meta_description'] = $settings['title'] . ' ' . $LNG['go_pro'] . ' - ' . $LNG['go_pro_desc'];
$skin = new skin('pro/content');
return $skin->make();
}