本文整理汇总了PHP中WPSC_Purchase_Log::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Purchase_Log::exists方法的具体用法?PHP WPSC_Purchase_Log::exists怎么用?PHP WPSC_Purchase_Log::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSC_Purchase_Log
的用法示例。
在下文中一共展示了WPSC_Purchase_Log::exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_purchase_log_for_callbacks
private function set_purchase_log_for_callbacks($sessionid = false)
{
if ($sessionid === false) {
$sessionid = $_REQUEST['sessionid'];
}
$purchase_log = new WPSC_Purchase_Log($sessionid, 'sessionid');
if (!$purchase_log->exists()) {
return;
}
$this->set_purchase_log($purchase_log);
}
示例2: set_purchase_log_for_callbacks
/**
* Creates a new Purchase Log entry and set it to the current object
*
* @return null
*/
protected function set_purchase_log_for_callbacks($sessionid = false)
{
// Define the sessionid if it's not passed
if ($sessionid === false) {
$sessionid = $_REQUEST['sessionid'];
}
// Create a new Purchase Log entry
$purchase_log = new WPSC_Purchase_Log($sessionid, 'sessionid');
if (!$purchase_log->exists()) {
return null;
}
// Set the Purchase Log for the gateway object
$this->set_purchase_log($purchase_log);
}
示例3: import_ipn_data
private function import_ipn_data()
{
global $wpdb;
$purchase_log = new WPSC_Purchase_Log($this->cart_data['session_id'], 'sessionid');
if (!$purchase_log->exists()) {
return;
}
// get all active form fields and organize them based on id and unique_name, because we're only
// importing fields relevant to checkout fields that have unique name
$form_fields_sql = "SELECT id, unique_name FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE active='1'";
$form_fields_results = $wpdb->get_results($form_fields_sql);
$form_fields = array();
foreach ($form_fields_results as $row) {
if (!empty($row->unique_name)) {
$form_fields[$row->id] = $row->unique_name;
}
}
$purchase_log_id = $purchase_log->get('id');
// this defines how ipn response data will be parsed into checkout field values
$field_mapping = array('firstname' => 'first_name', 'lastname' => 'last_name', 'country' => 'address_country_code', 'email' => 'payer_email', 'city' => 'address_city', 'address' => 'address_street', 'phone' => 'contact_phone');
$inserts = array();
// billing & shipping will get the same values
foreach (array('billing', 'shipping') as $type) {
// if the corresponding checkout field is "active", prepare the data array that will
// get passed into $wpdb->insert()
foreach ($field_mapping as $key => $value) {
$unique_name = $type . $key;
$id = array_search($unique_name, $form_fields);
if ($id === false || !isset($this->paypal_ipn_values[$value])) {
continue;
}
$inserts[] = array('log_id' => $purchase_log_id, 'form_id' => $id, 'value' => $this->paypal_ipn_values[$value]);
}
}
// loop through the prepared data array and insert them
foreach ($inserts as $insert) {
$wpdb->insert(WPSC_TABLE_SUBMITED_FORM_DATA, $insert, array('%d', '%d', '%s'));
}
}
示例4: is_valid_ipn_response
public function is_valid_ipn_response()
{
$valid = true;
// Validate Currency
if ($this->paypal_ipn_values['mc_currency'] !== $this->get_paypal_currency_code()) {
$valid = false;
}
$purchase_log = new WPSC_Purchase_Log($this->cart_data['session_id'], 'sessionid');
if (!$purchase_log->exists()) {
$valid = false;
}
// Validate amount
// It is worth noting, there are edge cases here that may need to be addressed via filter.
// @link https://github.com/wp-e-commerce/WP-e-Commerce/issues/1232.
if ($this->paypal_ipn_values['mc_gross'] != $this->convert($purchase_log->get('totalprice'))) {
$valid = false;
}
return apply_filters('wpsc_paypal_standard_is_valid_ipn_response', $valid, $this);
}
示例5: _wpsc_oklink_return
function _wpsc_oklink_return()
{
if (!isset($_REQUEST['wpsc_oklink_return'])) {
return;
}
// oklink order param interferes with wordpress
unset($_REQUEST['order']);
unset($_GET['order']);
if (!isset($_REQUEST['sessionid'])) {
return;
}
global $sessionid;
$purchase_log = new WPSC_Purchase_Log($_REQUEST['sessionid'], 'sessionid');
if (!$purchase_log->exists() || $purchase_log->is_transaction_completed()) {
return;
}
$status = 1;
if (isset($_REQUEST['cancelled'])) {
# Unsetting sessionid to show error
do_action('wpsc_payment_failed');
$sessionid = false;
unset($_REQUEST['sessionid']);
unset($_GET['sessionid']);
} else {
$status = WPSC_Purchase_Log::ORDER_RECEIVED;
$purchase_log->set('processed', $status);
$purchase_log->save();
wpsc_empty_cart();
}
}