本文整理汇总了PHP中edd_is_test_mode函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_is_test_mode函数的具体用法?PHP edd_is_test_mode怎么用?PHP edd_is_test_mode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_is_test_mode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: atcf_pending_purchase
/**
* Create a log for preapproval payments
*
* @since Astoundify Crowdfunding 0.1-alpha
*
* @param int $payment_id the ID number of the payment
* @param string $new_status the status of the payment, probably "publish"
* @param string $old_status the status of the payment prior to being marked as "complete", probably "pending"
* @return void
*/
function atcf_pending_purchase($payment_id, $new_status, $old_status)
{
global $edd_logs;
// Make sure that payments are only completed once
if ($old_status == 'publish' || $old_status == 'complete') {
return;
}
// Make sure the payment completion is only processed when new status is complete
if ($new_status != 'preapproval' && $new_status != 'complete') {
return;
}
if (edd_is_test_mode() && !apply_filters('edd_log_test_payment_stats', false)) {
return;
}
$payment_data = edd_get_payment_meta($payment_id);
$downloads = maybe_unserialize($payment_data['downloads']);
$user_info = maybe_unserialize($payment_data['user_info']);
if (!is_array($downloads)) {
return;
}
foreach ($downloads as $download) {
if (!isset($download['quantity'])) {
$download['quantity'] = 1;
}
for ($i = 0; $i < $download['quantity']; $i++) {
$edd_logs->insert_log(array('post_parent' => $download['id'], 'log_type' => 'preapproval'), array('payment_id' => $payment_id));
}
}
}
示例2: edds_process_payza_payment
/**
* Process the payment through Payza
*
* @param array $purchase_data
*/
function edds_process_payza_payment($purchase_data)
{
global $edd_options;
// record the pending payment
$payment_data = array('price' => $purchase_data['price'], 'date' => $purchase_data['date'], 'user_email' => $purchase_data['user_email'], 'purchase_key' => $purchase_data['purchase_key'], 'currency' => edd_get_currency(), 'downloads' => $purchase_data['downloads'], 'cart_details' => $purchase_data['cart_details'], 'user_info' => $purchase_data['user_info'], 'status' => 'pending');
// Inserts a new payment
$payment = edd_insert_payment($payment_data);
if ($payment) {
require_once 'payza.gateway.php';
// Request details
$merchant_id = trim($edd_options['payza_merchant_id']);
$currency = edd_get_currency();
$return_url = edd_get_success_page_url('?payment-confirmation=payza');
$cancel_url = edd_get_failed_transaction_uri();
$ipn_url = trailingslashit(home_url()) . '?edd-listener=PAYZA_IPN';
// Create a new instance of the mb class
$payza = new wp_payza_gateway($merchant_id, 'item', $currency, $return_url, $cancel_url, $ipn_url, edd_is_test_mode());
// Get a new session ID
$redirect_url = $payza->transaction($payment, $purchase_data['cart_details']);
if ($redirect_url) {
// Redirects the user
wp_redirect($redirect_url);
exit;
} else {
edd_send_back_to_checkout('?payment-mode=payza');
}
} else {
edd_send_back_to_checkout('?payment-mode=payza');
}
}
示例3: details
/**
* Get EDD details
*
* ## OPTIONS
*
* None. Returns basic info regarding your EDD instance.
*
* ## EXAMPLES
*
* wp edd details
*
* @access public
* @param array $args
* @param array $assoc_args
* @return void
*/
public function details($args, $assoc_args)
{
$symlink_file_downloads = edd_get_option('symlink_file_downloads', false);
$purchase_page = edd_get_option('purchase_page', '');
$success_page = edd_get_option('success_page', '');
$failure_page = edd_get_option('failure_page', '');
WP_CLI::line(sprintf(__('You are running EDD version: %s', 'easy-digital-downloads'), EDD_VERSION));
WP_CLI::line("\n" . sprintf(__('Test mode is: %s', 'easy-digital-downloads'), edd_is_test_mode() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Ajax is: %s', 'easy-digital-downloads'), edd_is_ajax_enabled() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Guest checkouts are: %s', 'easy-digital-downloads'), edd_no_guest_checkout() ? __('Disabled', 'easy-digital-downloads') : __('Enabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Symlinks are: %s', 'easy-digital-downloads'), apply_filters('edd_symlink_file_downloads', isset($symlink_file_downloads)) && function_exists('symlink') ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line("\n" . sprintf(__('Checkout page is: %s', 'easy-digital-downloads'), !edd_get_option('purchase_page', false) ? __('Valid', 'easy-digital-downloads') : __('Invalid', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Checkout URL is: %s', 'easy-digital-downloads'), !empty($purchase_page) ? get_permalink($purchase_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Success URL is: %s', 'easy-digital-downloads'), !empty($success_page) ? get_permalink($success_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Failure URL is: %s', 'easy-digital-downloads'), !empty($failure_page) ? get_permalink($failure_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Downloads slug is: %s', 'easy-digital-downloads'), defined('EDD_SLUG') ? '/' . EDD_SLUG : '/downloads'));
WP_CLI::line("\n" . sprintf(__('Taxes are: %s', 'easy-digital-downloads'), edd_use_taxes() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Tax rate is: %s', 'easy-digital-downloads'), edd_get_tax_rate() * 100 . '%'));
$rates = edd_get_tax_rates();
if (!empty($rates)) {
foreach ($rates as $rate) {
WP_CLI::line(sprintf(__('Country: %s, State: %s, Rate: %s', 'easy-digital-downloads'), $rate['country'], $rate['state'], $rate['rate']));
}
}
}
示例4: get_data
/**
* Get the Export Data
*
* @access public
* @since 1.4.4
* @global object $wpdb Used to query the database using the WordPress
* Database API
* @return array $data The data for the CSV file
*/
public function get_data()
{
global $wpdb, $edd_options;
$data = array();
$payments = edd_get_payments(array('offset' => 0, 'number' => -1, 'mode' => edd_is_test_mode() ? 'test' : 'live', 'status' => isset($_POST['edd_export_payment_status']) ? $_POST['edd_export_payment_status'] : 'any', 'month' => isset($_POST['month']) ? absint($_POST['month']) : date('n'), 'year' => isset($_POST['year']) ? absint($_POST['year']) : date('Y')));
foreach ($payments as $payment) {
$payment_meta = edd_get_payment_meta($payment->ID);
$user_info = edd_get_payment_meta_user_info($payment->ID);
$downloads = edd_get_payment_meta_cart_details($payment->ID);
$total = isset($payment_meta['amount']) ? $payment_meta['amount'] : 0.0;
$user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
$products = '';
$skus = '';
if ($downloads) {
foreach ($downloads as $key => $download) {
// Download ID
$id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
// If the download has variable prices, override the default price
$price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
$price = edd_get_download_final_price($id, $user_info, $price_override);
// Display the Downoad Name
$products .= get_the_title($id) . ' - ';
if (edd_use_skus()) {
$sku = edd_get_download_sku($id);
if (!empty($sku)) {
$skus .= $sku;
}
}
if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) {
$price_options = $downloads[$key]['item_number']['options'];
if (isset($price_options['price_id'])) {
$products .= edd_get_price_option_name($id, $price_options['price_id']) . ' - ';
}
}
$products .= html_entity_decode(edd_currency_filter($price));
if ($key != count($downloads) - 1) {
$products .= ' / ';
if (edd_use_skus()) {
$skus .= ' / ';
}
}
}
}
if (is_numeric($user_id)) {
$user = get_userdata($user_id);
} else {
$user = false;
}
$data[] = array('id' => $payment->ID, 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'products' => $products, 'skus' => $skus, 'amount' => html_entity_decode(edd_format_amount($total)), 'tax' => html_entity_decode(edd_get_payment_tax($payment->ID, $payment_meta)), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'edd'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment->ID, '_edd_payment_gateway', true)), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'edd'), 'status' => edd_get_payment_status($payment, true));
if (!edd_use_skus()) {
unset($data['skus']);
}
}
$data = apply_filters('edd_export_get_data', $data);
$data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
return $data;
}
示例5: pw_edd_process_payment
function pw_edd_process_payment($purchase_data)
{
global $edd_options;
/**********************************
* set transaction mode
**********************************/
if (edd_is_test_mode()) {
$paytm_redirect = 'https://pguat.paytm.com/oltp-web/processTransaction?';
} else {
if ($edd_options['paytm_select_mode'] == '1') {
$paytm_redirect = 'https://secure.paytm.in/oltp-web/processTransaction?';
} else {
$paytm_redirect = 'https://pguat.paytm.com/oltp-web/processTransaction?';
}
}
// check for any stored errors
$errors = edd_get_errors();
if (!$errors) {
$purchase_summary = edd_get_purchase_summary($purchase_data);
/****************************************
* setup the payment details to be stored
****************************************/
$payment = array('price' => $purchase_data['price'], 'date' => $purchase_data['date'], 'user_email' => $purchase_data['user_email'], 'purchase_key' => $purchase_data['purchase_key'], 'currency' => $edd_options['currency'], 'downloads' => $purchase_data['downloads'], 'gateway' => 'paytm', 'cart_details' => $purchase_data['cart_details'], 'user_info' => $purchase_data['user_info'], 'status' => 'pending');
// record the pending payment
$payment = edd_insert_payment($payment);
$merchant_payment_confirmed = false;
$secret_key = $edd_options['paytm_mer_access_key'];
$params = array('REQUEST_TYPE' => 'DEFAULT', 'MID' => $edd_options['paytm_merchant_id'], 'TXN_AMOUNT' => $purchase_data['price'], 'CHANNEL_ID' => "WEB", 'INDUSTRY_TYPE_ID' => $edd_options['paytm_industry_type'], 'WEBSITE' => $edd_options['paytm_website_name'], 'CUST_ID' => $purchase_data['user_email'], 'ORDER_ID' => $purchase_data['purchase_key'], 'EMAIL' => $purchase_data['user_email']);
if ($edd_options['paytm_callback'] == '1') {
$params['CALLBACK_URL'] = get_site_url() . '/?edd-listener=PAYTM_IPN&payment_id=' . $payment;
}
$checksum = getChecksumFromArray($params, $secret_key);
$params['CHECKSUMHASH'] = $checksum;
foreach ($params as $key => $val) {
$submit_Params .= trim($key) . '=' . trim(urlencode($val)) . '&';
}
$submit_Params = substr($submit_Params, 0, -1);
$request = $paytm_redirect . $submit_Params;
wp_redirect($request);
exit;
} else {
$fail = true;
// errors were detected
}
if ($fail !== false) {
// if errors are present, send the user back to the purchase page so they can be corrected
edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']);
}
}
示例6: atcf_log_pledge_limit
/**
* Track number of purchases for each pledge amount.
*
* @since Astoundify Crowdfunding 0.9
*
* @param int $payment the ID number of the payment
* @param array $payment_data The payment data for the cart
* @return void
*/
function atcf_log_pledge_limit($payment_id, $new_status, $old_status)
{
global $edd_logs;
// Make sure that payments are only completed once
if ($old_status != 'pending') {
return;
}
// Make sure the payment completion is only processed when new status is complete
if (in_array($new_status, array('refunded', 'failed', 'revoked', 'cancelled', 'abandoned'))) {
return;
}
if (edd_is_test_mode() && !apply_filters('edd_log_test_payment_stats', false)) {
return;
}
atcf_update_backer_count($payment_id, 'increase');
}
示例7: load
private function load($fileName)
{
if (class_exists('Easy_Digital_Downloads')) {
global $edd_options;
if (edd_is_test_mode()) {
$mode = 'yes';
} else {
$mode = 'no';
}
$this->config = array('acct1.UserName' => $mode == 'yes' ? $edd_options['epap_test_api_username'] : $edd_options['epap_live_api_username'], 'acct1.Password' => $mode == 'yes' ? $edd_options['epap_test_api_password'] : $edd_options['epap_live_api_password'], 'acct1.Signature' => $mode == 'yes' ? $edd_options['epap_test_api_signature'] : $edd_options['epap_live_api_signature'], 'acct1.AppId' => $mode == 'yes' ? $edd_options['epap_test_app_id'] : $edd_options['epap_live_app_id'], 'service.Binding' => 'SOAP', 'service.EndPoint' => $mode == 'yes' ? 'https://api-3t.sandbox.paypal.com/2.0/' : 'https://api-3t.paypal.com/2.0/', 'service.RedirectURL' => $mode == 'yes' ? 'https://sandbox.paypal.com/webscr&cmd=' : 'https://paypal.com/webscr&cmd=', 'service.DevCentralURL' => 'https://developer.paypal.com', 'http.ConnectionTimeOut' => '10', 'http.Retry' => '5', 'log.FileName' => 'PayPal.log', 'log.LogLevel' => 'INFO', 'log.LogEnabled' => 'true');
} else {
$this->config = @parse_ini_file($fileName);
}
if ($this->config == null || count($this->config) == 0) {
throw new PPConfigurationException("Config file {$fileName} not found", "303");
}
}
示例8: atcf_log_preapproval_payment_total
/**
* Log preapproved payment total for campaigns.
*
* @since 1.8.7
*
* @param int $payment the ID number of the payment
* @param string $new_status
* @param string $old_status
* @return void
*/
function atcf_log_preapproval_payment_total($payment_id, $new_status, $old_status)
{
global $edd_logs;
// If we're in test mode, don't proceed unless expected.
if (edd_is_test_mode() && !apply_filters('edd_log_test_payment_stats', false)) {
return;
}
// Don't do anything if $new_status and $old_status are the same
if ($new_status == $old_status) {
return;
}
// If the status has become preapproved.
if ('preapproval' == $new_status) {
atcf_update_preapproval_total($payment_id, 'increase');
} elseif ('preapproval' == $old_status) {
atcf_update_preapproval_total($payment_id, 'decrease');
}
}
示例9: edd_get_users_purchases
/**
* Get Users Purchases
*
* Retrieves a list of all purchases by a specific user.
*
* @access public
* @since 1.0
* @param int|string $user User ID or email address
* @param int $number Number of purchases to retrieve
*
* @return array List of all user purchases
*/
function edd_get_users_purchases($user = 0, $number = -1)
{
if (empty($user)) {
global $user_ID;
$user = $user_ID;
}
$purchases = get_transient('edd_user_' . $user . '_purchases');
if (false === $purchases || edd_is_test_mode()) {
$mode = edd_is_test_mode() ? 'test' : 'live';
$purchases = edd_get_payments(array('mode' => $mode, 'user' => $user));
set_transient('edd_user_' . $user . '_purchases', $purchases, 7200);
}
// no purchases
if (!$purchases) {
return false;
}
return $purchases;
}
示例10: edd_complete_purchase
/**
* Complete a purchase
*
* Performs all necessary actions to complete a purchase.
* Triggered by the edd_update_payment_status() function.
*
* @since 1.0.8.3
* @param int $payment_id the ID number of the payment
* @param string $new_status the status of the payment, probably "publish"
* @param string $old_status the status of the payment prior to being marked as "complete", probably "pending"
* @return void
*/
function edd_complete_purchase($payment_id, $new_status, $old_status)
{
if ($old_status == 'publish' || $old_status == 'complete') {
return;
}
// Make sure that payments are only completed once
// Make sure the payment completion is only processed when new status is complete
if ($new_status != 'publish' && $new_status != 'complete') {
return;
}
if (edd_is_test_mode() && !apply_filters('edd_log_test_payment_stats', false)) {
return;
}
$payment_data = edd_get_payment_meta($payment_id);
$downloads = maybe_unserialize($payment_data['downloads']);
$user_info = maybe_unserialize($payment_data['user_info']);
$cart_details = maybe_unserialize($payment_data['cart_details']);
if (is_array($downloads)) {
// Increase purchase count and earnings
foreach ($downloads as $download) {
edd_record_sale_in_log($download['id'], $payment_id, $user_info);
edd_increase_purchase_count($download['id']);
$amount = null;
if (is_array($cart_details)) {
foreach ($cart_details as $key => $item) {
if (array_search($download['id'], $item)) {
$cart_item_id = $key;
}
}
$amount = isset($cart_details[$cart_item_id]['price']) ? $cart_details[$cart_item_id]['price'] : null;
}
$amount = edd_get_download_final_price($download['id'], $user_info, $amount);
edd_increase_earnings($download['id'], $amount);
}
// Clear the total earnings cache
delete_transient('edd_earnings_total');
}
if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
edd_increase_discount_usage($user_info['discount']);
}
// Empty the shopping cart
edd_empty_cart();
}
示例11: edd_get_users_purchases
/**
* Get Users Purchases
*
* Retrieves a list of all purchases by a specific user.
*
* @access public
* @since 1.0
* @return array
*/
function edd_get_users_purchases($user_id = 0)
{
if (empty($user_id)) {
global $user_ID;
$user_id = $user_ID;
}
$purchases = get_transient('edd_user_' . $user_id . '_purchases');
if (false === $purchases || edd_is_test_mode()) {
$mode = edd_is_test_mode() ? 'test' : 'live';
$purchases = get_posts(array('meta_query' => array('relation' => 'AND', array('key' => '_edd_payment_mode', 'value' => $mode), array('key' => '_edd_payment_user_id', 'value' => $user_id)), 'post_type' => 'edd_payment', 'posts_per_page' => -1));
set_transient('edd_user_' . $user_id . '_purchases', $purchases, 7200);
}
if ($purchases) {
// return the download list
return $purchases;
}
// no downloads
return false;
}
示例12: edd_csau_payment_actions
/**
* Payment actions
*
* @since 1.1
*/
function edd_csau_payment_actions($payment_id)
{
$cart_details = edd_get_payment_meta_cart_details($payment_id);
if (is_array($cart_details)) {
// Increase purchase count and earnings
foreach ($cart_details as $download) {
// "bundle" or "default"
$download_type = edd_get_download_type($download['id']);
$price_id = isset($download['options']['price_id']) ? (int) $download['options']['price_id'] : false;
// Increase earnings, and fire actions once per quantity number
for ($i = 0; $i < $download['quantity']; $i++) {
if (!edd_is_test_mode() || apply_filters('edd_log_test_payment_stats', false)) {
if (isset($download['item_number']['cross_sell'])) {
$type = 'cross_sell';
} elseif (isset($download['item_number']['upsell'])) {
$type = 'upsell';
} else {
$type = null;
}
if ($type) {
edd_csau_increase_purchase_count($download['id'], $type);
edd_csau_increase_earnings($download['id'], $download['price'], $type);
edd_csau_record_sale_in_log($download['id'], $payment_id, $price_id, $type);
}
}
$types[] = $type;
$types = array_unique(array_filter($types));
}
}
// Clear the total earnings cache
delete_transient('edd_' . $type . '_earnings_total');
}
if ($types) {
foreach ($types as $type) {
// store the total amount of cross-sell earnings
update_post_meta($payment_id, '_edd_payment_' . $type . '_total', edd_csau_calculate_sales($payment_id, $type));
$amount = edd_csau_get_payment_amount($payment_id, $type);
// increase earnings
edd_csau_increase_total_earnings($amount, $type);
}
}
}
示例13: edd_insert_payment
/**
* Insert Payment
*
* @access public
* @since 1.0
* @return void
*/
function edd_insert_payment($payment_data = array())
{
if (empty($payment_data)) {
return false;
}
// construct the payment title
if (isset($payment_data['user_info']['first_name']) || isset($payment_data['user_info']['last_name'])) {
$payment_title = $payment_data['user_info']['first_name'] . ' ' . $payment_data['user_info']['last_name'];
} else {
$payment_title = $payment_data['user_email'];
}
if (isset($payment_data['status'])) {
$status = $payment_data['status'];
} else {
$status = 'pending';
}
// create a blank payment
$payment = wp_insert_post(array('post_title' => $payment_title, 'post_status' => $status, 'post_type' => 'edd_payment', 'post_date' => $payment_data['date']));
if ($payment) {
$payment_meta = array('amount' => $payment_data['price'], 'date' => $payment_data['date'], 'email' => $payment_data['user_email'], 'key' => $payment_data['purchase_key'], 'currency' => $payment_data['currency'], 'downloads' => serialize($payment_data['downloads']), 'user_info' => serialize($payment_data['user_info']), 'cart_details' => serialize($payment_data['cart_details']), 'user_id' => $payment_data['user_info']['id']);
$mode = edd_is_test_mode() ? 'test' : 'live';
$gateway = isset($_POST['edd-gateway']) ? $_POST['edd-gateway'] : '';
// record the payment details
update_post_meta($payment, '_edd_payment_meta', apply_filters('edd_payment_meta', $payment_meta, $payment_data));
update_post_meta($payment, '_edd_payment_user_id', $payment_data['user_info']['id']);
update_post_meta($payment, '_edd_payment_user_email', $payment_data['user_email']);
update_post_meta($payment, '_edd_payment_user_ip', edd_get_ip());
update_post_meta($payment, '_edd_payment_purchase_key', $payment_data['purchase_key']);
update_post_meta($payment, '_edd_payment_total', $payment_data['price']);
update_post_meta($payment, '_edd_payment_mode', $mode);
update_post_meta($payment, '_edd_payment_gateway', $gateway);
// clear the user's purchased cache
delete_transient('edd_user_' . $payment_data['user_info']['id'] . '_purchases');
do_action('edd_insert_payment', $payment, $payment_data);
return $payment;
// return the ID
}
// return false if no payment was inserted
return false;
}
示例14: edd_fd_process_payment
function edd_fd_process_payment($purchase_data)
{
global $edd_options;
// setup gateway appropriately for test mode
if (edd_is_test_mode()) {
$endpoint = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v11/wsdl';
} else {
$endpoint = 'https://api.globalgatewaye4.firstdata.com/transaction/v11/wsdl';
}
// check the posted cc deails
$cc = edd_fd_check_cc_details($purchase_data);
// fcheck for errors before we continue to processing
if (!edd_get_errors()) {
$purchase_summary = edd_get_purchase_summary($purchase_data);
$payment = array('price' => $purchase_data['price'], 'date' => $purchase_data['date'], 'user_email' => $purchase_data['user_email'], 'purchase_key' => $purchase_data['purchase_key'], 'currency' => edd_get_currency(), 'downloads' => $purchase_data['downloads'], 'cart_details' => $purchase_data['cart_details'], 'user_info' => $purchase_data['user_info'], 'status' => 'pending');
// record the pending payment
$payment = edd_insert_payment($payment);
$address = esc_textarea($_POST['card_address'] . ' ' . $_POST['card_address_2'] . '|' . $_POST['card_zip'] . '|' . $_POST['card_city'] . '|' . $_POST['card_state'] . '|' . $_POST['billing_country']);
$firstdata['Transaction'] = array('ExactID' => $edd_options['firstdata_gateway_id'], 'Password' => $edd_options['firstdata_gateway_password'], 'Transaction_Type' => $edd_options['firstdata_transaction_type'], 'DollarAmount' => $purchase_data['price'], 'Card_Number' => $cc['card_number'], 'Expiry_Date' => $cc['card_exp_month'] . $cc['card_exp_year'], 'CardHoldersName' => $cc['card_name'], 'VerificationStr1' => $address, 'VerificationStr2' => $cc['card_cvc'], 'CVD_Presence_Ind' => 1, 'Reference_No' => $payment, 'ZipCode' => $cc['card_zip'], 'Customer_Ref' => $purchase_data['user_info']['id'], 'Client_IP' => $_SERVER['REMOTE_ADDR'], 'Client_Email' => $purchase_data['user_email'], 'Currency' => $edd_options['currency'], 'Ecommerce_Flag' => is_ssl() ? 8 : 7);
try {
$api = @new SoapClient($endpoint);
$result = $api->__soapCall('SendAndCommit', $firstdata);
} catch (Exception $e) {
edd_set_error('firstdata_api_error', sprintf(__('FirstData System Error: %s', 'edd_firstdata'), $e->getMessage()));
edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']);
$fail = true;
}
if (isset($result) && $result->Transaction_Approved) {
edd_update_payment_status($payment, 'complete');
edd_send_to_success_page();
} elseif ($result->Transaction_Error) {
edd_set_error('firstdata_decline', sprintf(__('Transaction Declined: %s', 'edd_firstdata'), $result->EXact_Message));
edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']);
$fail = true;
}
} else {
$fail = true;
}
}
示例15: edd_admin_messages
/**
* Admin Messages
*
* @since 1.0
* @global $edd_options Array of all the EDD Options
* @return void
*/
function edd_admin_messages()
{
global $edd_options;
if (isset($_GET['edd-message']) && 'discount_updated' == $_GET['edd-message'] && current_user_can('manage_shop_discounts')) {
add_settings_error('edd-notices', 'edd-discount-updated', __('Discount code updated.', 'edd'), 'updated');
}
if (isset($_GET['edd-message']) && 'discount_update_failed' == $_GET['edd-message'] && current_user_can('manage_shop_discounts')) {
add_settings_error('edd-notices', 'edd-discount-updated-fail', __('There was a problem updating your discount code, please try again.', 'edd'), 'error');
}
if (isset($_GET['edd-message']) && 'payment_deleted' == $_GET['edd-message'] && current_user_can('view_shop_reports')) {
add_settings_error('edd-notices', 'edd-payment-deleted', __('The payment has been deleted.', 'edd'), 'updated');
}
if (isset($_GET['edd-message']) && 'email_sent' == $_GET['edd-message'] && current_user_can('view_shop_reports')) {
add_settings_error('edd-notices', 'edd-payment-sent', __('The purchase receipt has been resent.', 'edd'), 'updated');
}
if (isset($_GET['page']) && 'edd-payment-history' == $_GET['page'] && current_user_can('view_shop_reports') && edd_is_test_mode()) {
add_settings_error('edd-notices', 'edd-payment-sent', sprintf(__('Note: Test Mode is enabled, only test payments are shown below. %sSettings%s.', 'edd'), '<a href="' . admin_url('edit.php?post_type=download&page=edd-settings') . '">', '</a>'), 'updated');
}
if ((empty($edd_options['purchase_page']) || 'trash' == get_post_status($edd_options['purchase_page'])) && current_user_can('edit_pages')) {
add_settings_error('edd-notices', 'set-checkout', sprintf(__('No checkout page has been configured. Visit <a href="%s">Settings</a> to set one.', 'edd'), admin_url('edit.php?post_type=download&page=edd-settings')));
}
settings_errors('edd-notices');
}