当前位置: 首页>>代码示例>>PHP>>正文


PHP edd_get_payment_gateway函数代码示例

本文整理汇总了PHP中edd_get_payment_gateway函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_payment_gateway函数的具体用法?PHP edd_get_payment_gateway怎么用?PHP edd_get_payment_gateway使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了edd_get_payment_gateway函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_data

 /**
  * Get the data being exported
  *
  * @access      public
  * @since       1.2
  * @return      array
  */
 public function get_data()
 {
     global $edd_logs;
     $data = array();
     $args = array('nopaging' => true, 'post_type' => 'edd_payment', 'meta_key' => '_edd_payment_shipping_status', 'meta_value' => '1', 'fields' => 'ids');
     $payments = get_posts($args);
     if ($payments) {
         foreach ($payments as $payment) {
             $user_info = edd_get_payment_meta_user_info($payment);
             $downloads = edd_get_payment_meta_cart_details($payment);
             $products = '';
             if ($downloads) {
                 foreach ($downloads as $key => $download) {
                     // Display the Downoad Name
                     $products .= get_the_title($download['id']);
                     if ($key != count($downloads) - 1) {
                         $products .= ' / ';
                     }
                 }
             }
             $data[] = array('id' => $payment, 'date' => get_post_field('post_date', $payment), 'first_name' => $user_info['first_name'], 'last_name' => $user_info['last_name'], 'email' => $user_info['email'], 'address' => $user_info['shipping_info']['address'], 'address2' => !empty($user_info['shipping_info']['address2']) ? $user_info['shipping_info']['address2'] : '', 'city' => $user_info['shipping_info']['city'], 'state' => $user_info['shipping_info']['state'], 'zip' => $user_info['shipping_info']['zip'], 'country' => $user_info['shipping_info']['country'], 'amount' => edd_get_payment_amount($payment), 'tax' => edd_get_payment_tax($payment), 'gateway' => edd_get_payment_gateway($payment), 'key' => edd_get_payment_key($payment), 'products' => $products, 'status' => get_post_field('post_status', $payment));
         }
     }
     $data = apply_filters('edd_export_get_data', $data);
     $data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
     return $data;
 }
开发者ID:JiveDig,项目名称:EDD-Simple-Shipping,代码行数:34,代码来源:class-shipping-export.php

示例2: column_default

 /**
  * Output column data
  *
  * @access      private
  * @since       1.4
  * @return      string
  */
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'error':
             return get_the_title($item['ID']) ? get_the_title($item['ID']) : __('Payment Error', 'edd');
         case 'gateway':
             return edd_get_payment_gateway($item['payment_id']);
         case 'buyer':
             $user = !empty($item['user_id']) ? $item['user_id'] : $item['buyer'];
             return '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&user=') . urlencode($user) . '">' . $item['buyer'] . '</a>';
         default:
             return $item[$column_name];
     }
 }
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:21,代码来源:class-gateway-error-logs-list-table.php

示例3: edd_stripe_admin_js

/**
 * Load our admin javascript
 *
 * @access      public
 * @since       1.8
 * @return      void
 */
function edd_stripe_admin_js($payment_id = 0)
{
    if ('stripe' !== edd_get_payment_gateway($payment_id)) {
        return;
    }
    ?>
	<script type="text/javascript">
		jQuery(document).ready(function($) {
			$('select[name=edd-payment-status]').change(function() {

				if( 'refunded' == $(this).val() ) {

					$(this).parent().parent().append( '<input type="checkbox" id="edd_refund_in_stripe" name="edd_refund_in_stripe" value="1"/>' );
					$(this).parent().parent().append( '<label for="edd_refund_in_stripe">Refund Charge in Stripe</label>' );

				}

			});
		});
	</script>
<?php 
}
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:29,代码来源:edd-stripe.php

示例4: column_details


//.........这里部分代码省略.........
        $payment_date = strtotime($item['date']);
        ?>
				<p><?php 
        echo __('Date and Time:', 'edd') . ' ' . date_i18n(get_option('date_format'), $payment_date) . ' ' . date_i18n(get_option('time_format'), $payment_date);
        ?>
				<p><?php 
        echo __('Discount used:', 'edd') . ' ';
        if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
            echo $user_info['discount'];
        } else {
            _e('none', 'edd');
        }
        ?>
				<p><?php 
        echo __('Total:', 'edd') . ' ' . edd_currency_filter(edd_format_amount(edd_get_payment_amount($item['ID'])));
        ?>
</p>

				<div class="purcase-personal-details">
					<h4><?php 
        _e('Buyer\'s Personal Details:', 'edd');
        ?>
</h4>
					<ul>
						<li><?php 
        echo __('Name:', 'edd') . ' ' . $user_info['first_name'] . ' ' . $user_info['last_name'];
        ?>
</li>
						<li><?php 
        echo __('Email:', 'edd') . ' ' . $payment_meta['email'];
        ?>
</li>
						<?php 
        do_action('edd_payment_personal_details_list', $payment_meta, $user_info);
        ?>
					</ul>
				</div>
				<div class="payment-notes">
					<h4><?php 
        _e('Payment Notes', 'edd');
        ?>
</h4>
					<?php 
        $notes = edd_get_payment_notes($item['ID']);
        if (!empty($notes)) {
            echo '<ul id="payment-notes">';
            foreach ($notes as $note) {
                if (!empty($note->user_id)) {
                    $user = get_userdata($note->user_id);
                    $user = $user->display_name;
                } else {
                    $user = __('EDD Bot', 'edd');
                }
                echo '<div class="edd-payment-note"><strong>' . $user . '</strong>&nbsp;<em>' . $note->comment_date . '</em>&nbsp;&mdash;' . $note->comment_content . '</div>';
            }
            echo '</ul>';
        } else {
            echo '<p>' . __('No payment notes', 'edd') . '</p>';
        }
        ?>
				</div>
				<?php 
        $gateway = edd_get_payment_gateway($item['ID']);
        if ($gateway) {
            ?>
				<div class="payment-method">
					<h4><?php 
            _e('Payment Method:', 'edd');
            ?>
</h4>
					<span class="payment-method-name"><?php 
            echo edd_get_gateway_admin_label($gateway);
            ?>
</span>
				</div>
				<?php 
        }
        ?>
				<div class="purchase-key-wrap">
					<h4><?php 
        _e('Purchase Key', 'edd');
        ?>
</h4>
					<span class="purchase-key"><?php 
        echo $payment_meta['key'];
        ?>
</span>
				</div>
				<p><a id="edd-close-purchase-details" class="button-secondary" onclick="tb_remove();" title="<?php 
        _e('Close', 'edd');
        ?>
"><?php 
        _e('Close', 'edd');
        ?>
</a></p>
			</div>
<?php 
        $details .= ob_get_clean();
        return $details;
    }
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:101,代码来源:class-payments-table.php

示例5: record_subscription_payment

 /**
  * Record a subscription payment
  *
  * @since  1.0.1
  * @return void
  */
 public function record_subscription_payment($parent_id = 0, $amount = '', $txn_id = '', $unique_key = 0)
 {
     global $edd_options;
     if ($this->payment_exists($unique_key)) {
         return;
     }
     // increase the earnings for each product in the subscription
     $downloads = edd_get_payment_meta_downloads($parent_id);
     if ($downloads) {
         foreach ($downloads as $download) {
             edd_increase_earnings($download['id'], $amount);
         }
     }
     // setup the payment daya
     $payment_data = array('parent' => $parent_id, 'price' => $amount, 'user_email' => edd_get_payment_user_email($parent_id), 'purchase_key' => get_post_meta($parent_id, '_edd_payment_purchase_key', true), 'currency' => edd_get_option('currency', 'usd'), 'downloads' => $downloads, 'user_info' => edd_get_payment_meta_user_info($parent_id), 'cart_details' => edd_get_payment_meta_cart_details($parent_id), 'status' => 'edd_subscription', 'gateway' => edd_get_payment_gateway($parent_id));
     // record the subscription payment
     $payment = edd_insert_payment($payment_data);
     if (!empty($unique_key)) {
         update_post_meta($payment, '_edd_recurring_' . $unique_key, '1');
     }
     // Record transaction ID
     if (!empty($txn_id)) {
         if (function_exists('edd_set_payment_transaction_id')) {
             edd_set_payment_transaction_id($payment, $txn_id);
         }
     }
     // Update the expiration date of license keys, if EDD Software Licensing is active
     if (function_exists('edd_software_licensing')) {
         $licenses = edd_software_licensing()->get_licenses_of_purchase($parent_id);
         if (!empty($licenses)) {
             foreach ($licenses as $license) {
                 // Update the expiration dates of the license key
                 edd_software_licensing()->renew_license($license->ID, $parent_id);
             }
         }
     }
     do_action('edd_recurring_record_payment', $payment, $parent_id, $amount, $txn_id, $unique_key);
 }
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:44,代码来源:edd-recurring.php

示例6: edd_process_paypal_web_accept_and_cart

/**
 * Process web accept (one time) payment IPNs
 *
 * @since 1.3.4
 * @param array   $data IPN Data
 * @return void
 */
function edd_process_paypal_web_accept_and_cart($data, $payment_id)
{
    if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
        return;
    }
    if (empty($payment_id)) {
        return;
    }
    // Collect payment details
    $purchase_key = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
    $paypal_amount = $data['mc_gross'];
    $payment_status = strtolower($data['payment_status']);
    $currency_code = strtolower($data['mc_currency']);
    $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
    $payment_meta = edd_get_payment_meta($payment_id);
    if (edd_get_payment_gateway($payment_id) != 'paypal') {
        return;
        // this isn't a PayPal standard IPN
    }
    // Verify payment recipient
    if (strcasecmp($business_email, trim(edd_get_option('paypal_email', false))) != 0) {
        edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid business email in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
        edd_update_payment_status($payment_id, 'failed');
        edd_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'edd'));
        return;
    }
    // Verify payment currency
    if ($currency_code != strtolower($payment_meta['currency'])) {
        edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid currency in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
        edd_update_payment_status($payment_id, 'failed');
        edd_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'edd'));
        return;
    }
    if (!edd_get_payment_user_email($payment_id)) {
        // This runs when a Buy Now purchase was made. It bypasses checkout so no personal info is collected until PayPal
        // No email associated with purchase, so store from PayPal
        edd_update_payment_meta($payment_id, '_edd_payment_user_email', $data['payer_email']);
        // Setup and store the customers's details
        $address = array();
        $address['line1'] = !empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false;
        $address['city'] = !empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false;
        $address['state'] = !empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false;
        $address['country'] = !empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false;
        $address['zip'] = !empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false;
        $user_info = array('id' => '-1', 'email' => sanitize_text_field($data['payer_email']), 'first_name' => sanitize_text_field($data['first_name']), 'last_name' => sanitize_text_field($data['last_name']), 'discount' => '', 'address' => $address);
        $payment_meta['user_info'] = $user_info;
        edd_update_payment_meta($payment_id, '_edd_payment_meta', $payment_meta);
    }
    if ($payment_status == 'refunded' || $payment_status == 'reversed') {
        // Process a refund
        edd_process_paypal_refund($data, $payment_id);
    } else {
        if (get_post_status($payment_id) == 'publish') {
            return;
            // Only complete payments once
        }
        // Retrieve the total purchase amount (before PayPal)
        $payment_amount = edd_get_payment_amount($payment_id);
        if (number_format((double) $paypal_amount, 2) < number_format((double) $payment_amount, 2)) {
            // The prices don't match
            edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid payment amount in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
            edd_update_payment_status($payment_id, 'failed');
            edd_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'edd'));
            return;
        }
        if ($purchase_key != edd_get_payment_key($payment_id)) {
            // Purchase keys don't match
            edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid purchase key in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
            edd_update_payment_status($payment_id, 'failed');
            edd_insert_payment_note($payment_id, __('Payment failed due to invalid purchase key in PayPal IPN.', 'edd'));
            return;
        }
        if ('completed' == $payment_status || edd_is_test_mode()) {
            edd_insert_payment_note($payment_id, sprintf(__('PayPal Transaction ID: %s', 'edd'), $data['txn_id']));
            edd_set_payment_transaction_id($payment_id, $data['txn_id']);
            edd_update_payment_status($payment_id, 'publish');
        } else {
            if ('pending' == $payment_status && isset($data['pending_reason'])) {
                // Look for possible pending reasons, such as an echeck
                $note = '';
                switch (strtolower($data['pending_reason'])) {
                    case 'echeck':
                        $note = __('Payment made via eCheck and will clear automatically in 5-8 days', 'edd');
                        break;
                    case 'address':
                        $note = __('Payment requires a confirmed customer address and must be accepted manually through PayPal', 'edd');
                        break;
                    case 'intl':
                        $note = __('Payment must be accepted manually through PayPal due to international account regulations', 'edd');
                        break;
                    case 'multi-currency':
                        $note = __('Payment received in non-shop currency and must be accepted manually through PayPal', 'edd');
                        break;
//.........这里部分代码省略.........
开发者ID:nitun,项目名称:Easy-Digital-Downloads,代码行数:101,代码来源:paypal-standard.php

示例7: _e

								<h3 class="hndle">
									<span><?php 
_e('Payment Meta', 'edd');
?>
</span>
								</h3>
								<div class="inside">
									<div class="edd-admin-box">

										<?php 
do_action('edd_view_order_details_payment_meta_before', $payment_id);
?>

										<?php 
$gateway = edd_get_payment_gateway($payment_id);
if ($gateway) {
    ?>
											<div class="edd-order-gateway edd-admin-box-inside">
												<p>
													<span class="label"><?php 
    _e('Gateway:', 'edd');
    ?>
</span>&nbsp;
													<?php 
    echo edd_get_gateway_admin_label($gateway);
    ?>
												</p>
											</div>
										<?php 
}
开发者ID:nitun,项目名称:Easy-Digital-Downloads,代码行数:30,代码来源:view-order-details.php

示例8: edd_get_payment_transaction_id

/**
 * Retrieves the transaction ID for the given payment
 *
 * @since  2.1
 * @param int payment_id Payment ID
 * @return string The Transaction ID
 */
function edd_get_payment_transaction_id($payment_id = 0)
{
    $transaction_id = false;
    $transaction_id = edd_get_payment_meta($payment_id, '_edd_payment_transaction_id', true);
    if (empty($transaction_id)) {
        $gateway = edd_get_payment_gateway($payment_id);
        $transaction_id = apply_filters('edd_get_payment_transaction_id-' . $gateway, $payment_id);
    }
    return apply_filters('edd_get_payment_transaction_id', $transaction_id, $payment_id);
}
开发者ID:ankitpokhrel,项目名称:Easy-Digital-Downloads,代码行数:17,代码来源:functions.php

示例9: get_logs

 /**
  * Gets the log entries for the current view
  *
  * @access public
  * @since 1.4
  * @global object $edd_logs EDD Logs Object
  * @return array $logs_data Array of all the Log entires
  */
 public function get_logs()
 {
     global $edd_logs;
     // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
     wp_suspend_cache_addition(true);
     $logs_data = array();
     $paged = $this->get_paged();
     $log_query = array('log_type' => 'gateway_error', 'paged' => $paged);
     $logs = $edd_logs->get_connected_logs($log_query);
     if ($logs) {
         foreach ($logs as $log) {
             $logs_data[] = array('ID' => $log->ID, 'payment_id' => $log->post_parent, 'error' => 'error', 'gateway' => edd_get_payment_gateway($log->post_parent), 'date' => $log->post_date);
         }
     }
     return $logs_data;
 }
开发者ID:SelaInc,项目名称:eassignment,代码行数:24,代码来源:class-gateway-error-logs-list-table.php

示例10: edd_email_tag_payment_method

/**
 * Email template tag: payment_method
 * The method of payment used for this purchase
 *
 * @param int $payment_id
 *
 * @return string gateway
 */
function edd_email_tag_payment_method($payment_id)
{
    return edd_get_gateway_checkout_label(edd_get_payment_gateway($payment_id));
}
开发者ID:Balamir,项目名称:Easy-Digital-Downloads,代码行数:12,代码来源:class-edd-email-tags.php

示例11: get_recent_sales

 /**
  * Retrieves Recent Sales
  *
  * @access public
  * @since  1.5
  * @return array
  */
 public function get_recent_sales()
 {
     $sales = array();
     $query = edd_get_payments(array('number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     if ($query) {
         $i = 0;
         foreach ($query as $payment) {
             $payment_meta = edd_get_payment_meta($payment->ID);
             $user_info = edd_get_payment_meta_user_info($payment->ID);
             $cart_items = edd_get_payment_meta_cart_details($payment->ID);
             $sales['sales'][$i]['ID'] = $payment->ID;
             $sales['sales'][$i]['key'] = edd_get_payment_key($payment->ID);
             $sales['sales'][$i]['subtotal'] = edd_get_payment_subtotal($payment->ID);
             $sales['sales'][$i]['tax'] = edd_get_payment_tax($payment->ID);
             $sales['sales'][$i]['fees'] = edd_get_payment_fees($payment->ID);
             $sales['sales'][$i]['total'] = edd_get_payment_amount($payment->ID);
             $sales['sales'][$i]['gateway'] = edd_get_payment_gateway($payment->ID);
             $sales['sales'][$i]['email'] = edd_get_payment_user_email($payment->ID);
             $sales['sales'][$i]['date'] = $payment->post_date;
             $sales['sales'][$i]['products'] = array();
             $c = 0;
             foreach ($cart_items as $key => $item) {
                 $price_override = isset($payment_meta['cart_details']) ? $item['price'] : null;
                 $price = edd_get_download_final_price($item['id'], $user_info, $price_override);
                 if (isset($cart_items[$key]['item_number'])) {
                     $price_name = '';
                     $price_options = $cart_items[$key]['item_number']['options'];
                     if (isset($price_options['price_id'])) {
                         $price_name = edd_get_price_option_name($item['id'], $price_options['price_id'], $payment->ID);
                     }
                 }
                 $sales['sales'][$i]['products'][$c]['name'] = get_the_title($item['id']);
                 $sales['sales'][$i]['products'][$c]['price'] = $price;
                 $sales['sales'][$i]['products'][$c]['price_name'] = $price_name;
                 $c++;
             }
             $i++;
         }
     }
     return $sales;
 }
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:48,代码来源:class-edd-api.php

示例12: edd_process_paypal_web_accept_and_cart

/**
 * Process web accept (one time) payment IPNs
 *
 * @since 1.3.4
 * @global $edd_options Array of all the EDD Options
 * @param array   $data IPN Data
 * @return void
 */
function edd_process_paypal_web_accept_and_cart($data)
{
    global $edd_options;
    if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
        return;
    }
    // Collect payment details
    $payment_id = $data['custom'];
    $purchase_key = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
    $paypal_amount = $data['mc_gross'];
    $payment_status = strtolower($data['payment_status']);
    $currency_code = strtolower($data['mc_currency']);
    $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
    if (edd_get_payment_gateway($payment_id) != 'paypal') {
        return;
        // this isn't a PayPal standard IPN
    }
    // Verify payment recipient
    if (strcasecmp($business_email, trim($edd_options['paypal_email'])) != 0) {
        edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid business email in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
        edd_update_payment_status($payment_id, 'failed');
        edd_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'edd'));
        return;
    }
    // Verify payment currency
    if ($currency_code != strtolower(edd_get_currency())) {
        edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid currency in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
        edd_update_payment_status($payment_id, 'failed');
        edd_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'edd'));
        return;
    }
    if (!edd_get_payment_user_email($payment_id)) {
        // This runs when a Buy Now purchase was made. It bypasses checkout so no personal info is collected until PayPal
        // No email associated with purchase, so store from PayPal
        edd_update_payment_meta($payment_id, '_edd_payment_user_email', $data['payer_email']);
        // Setup and store the customers's details
        $address = array();
        $address['line1'] = !empty($data['address_street']) ? $data['address_street'] : false;
        $address['city'] = !empty($data['address_city']) ? $data['address_city'] : false;
        $address['state'] = !empty($data['address_state']) ? $data['address_state'] : false;
        $address['country'] = !empty($data['address_country_code']) ? $data['address_country_code'] : false;
        $address['zip'] = !empty($data['address_zip']) ? $data['address_zip'] : false;
        $user_info = array('id' => '-1', 'email' => $data['payer_email'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'discount' => '', 'address' => $address);
        $payment_meta = get_post_meta($payment_id, '_edd_payment_meta', true);
        $payment_meta['user_info'] = $user_info;
        edd_update_payment_meta($payment_id, '_edd_payment_meta', $payment_meta);
    }
    if ($payment_status == 'refunded' || $payment_status == 'reversed') {
        // Process a refund
        edd_process_paypal_refund($data);
    } else {
        if (get_post_status($payment_id) == 'publish') {
            return;
            // Only complete payments once
        }
        // Retrieve the total purchase amount (before PayPal)
        $payment_amount = edd_get_payment_amount($payment_id);
        if (number_format((double) $paypal_amount, 2) < number_format((double) $payment_amount, 2)) {
            // The prices don't match
            edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid payment amount in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
            edd_update_payment_status($payment_id, 'failed');
            edd_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'edd'));
            return;
        }
        if ($purchase_key != edd_get_payment_key($payment_id)) {
            // Purchase keys don't match
            edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid purchase key in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
            edd_update_payment_status($payment_id, 'failed');
            edd_insert_payment_note($payment_id, __('Payment failed due to invalid purchase key in PayPal IPN.', 'edd'));
            return;
        }
        if ($payment_status == 'completed' || edd_is_test_mode()) {
            edd_insert_payment_note($payment_id, sprintf(__('PayPal Transaction ID: %s', 'edd'), $data['txn_id']));
            edd_set_payment_transaction_id($payment_id, $data['txn_id']);
            edd_update_payment_status($payment_id, 'publish');
        }
    }
}
开发者ID:Bragi26,项目名称:Easy-Digital-Downloads,代码行数:86,代码来源:paypal-standard.php

示例13: get_payment_method

 /**
  * Get the payment method used for the given $payment_id. Returns a link to the transaction in Stripe or PayPal if possible.
  *
  * @param int $payment_id
  *
  * @return string
  */
 private function get_payment_method($payment_id)
 {
     $payment_method = edd_get_payment_gateway($payment_id);
     switch ($payment_method) {
         case 'paypal':
             $notes = edd_get_payment_notes($payment_id);
             foreach ($notes as $note) {
                 if (preg_match('/^PayPal Transaction ID: ([^\\s]+)/', $note->comment_content, $match)) {
                     $transaction_id = $match[1];
                     $payment_method = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=' . esc_attr($transaction_id) . '" target="_blank">PayPal</a>';
                     break 2;
                 }
             }
             break;
         case 'stripe':
             $notes = edd_get_payment_notes($payment_id);
             foreach ($notes as $note) {
                 if (preg_match('/^Stripe Charge ID: ([^\\s]+)/', $note->comment_content, $match)) {
                     $transaction_id = $match[1];
                     $payment_method = '<a href="https://dashboard.stripe.com/payments/' . esc_attr($transaction_id) . '" target="_blank">Stripe</a>';
                     break 2;
                 }
             }
             break;
         case 'manual_purchases':
             $payment_method = 'Manual';
             break;
     }
     return $payment_method;
 }
开发者ID:rene-hermenau,项目名称:edd-helpscout,代码行数:37,代码来源:class-endpoint.php

示例14: eddc_record_commission

/**
 * Record Commissions
 *
 * @access      private
 * @since       1.0
 * @return      void
 */
function eddc_record_commission($payment_id, $new_status, $old_status)
{
    // Check if the payment was already set to complete
    if ($old_status == 'publish' || $old_status == 'complete') {
        return;
    }
    // Make sure that payments are only completed once
    // Make sure the commission is only recorded when new status is complete
    if ($new_status != 'publish' && $new_status != 'complete') {
        return;
    }
    if (edd_get_payment_gateway($payment_id) == 'manual_purchases' && !isset($_POST['commission'])) {
        return;
    }
    // do not record commission on manual payments unless specified
    $payment_data = edd_get_payment_meta($payment_id);
    $user_info = maybe_unserialize($payment_data['user_info']);
    $cart_details = maybe_unserialize($payment_data['cart_details']);
    // loop through each purchased download and award commissions, if needed
    foreach ($cart_details as $download) {
        $download_id = absint($download['id']);
        $commissions_enabled = get_post_meta($download_id, '_edd_commisions_enabled', true);
        if ('subtotal' == edd_get_option('edd_commissions_calc_base', 'subtotal')) {
            $price = $download['subtotal'];
        } else {
            $price = $download['price'];
        }
        // if we need to award a commission, and the price is greater than zero
        if ($commissions_enabled && floatval($price) > '0') {
            // set a flag so downloads with commissions awarded are easy to query
            update_post_meta($download_id, '_edd_has_commission', true);
            $commission_settings = get_post_meta($download_id, '_edd_commission_settings', true);
            if ($commission_settings) {
                $type = eddc_get_commission_type($download_id);
                // but if we have price variations, then we need to get the name of the variation
                if (edd_has_variable_prices($download_id)) {
                    $price_id = edd_get_cart_item_price_id($download);
                    $variation = edd_get_price_option_name($download_id, $price_id);
                }
                $recipients = eddc_get_recipients($download_id);
                // Record a commission for each user
                foreach ($recipients as $recipient) {
                    $rate = eddc_get_recipient_rate($download_id, $recipient);
                    // percentage amount of download price
                    $commission_amount = eddc_calc_commission_amount($price, $rate, $type);
                    // calculate the commission amount to award
                    $currency = $payment_data['currency'];
                    $commission = array('post_type' => 'edd_commission', 'post_title' => $user_info['email'] . ' - ' . get_the_title($download_id), 'post_status' => 'publish');
                    $commission_id = wp_insert_post(apply_filters('edd_commission_post_data', $commission));
                    $commission_info = apply_filters('edd_commission_info', array('user_id' => $recipient, 'rate' => $rate, 'amount' => $commission_amount, 'currency' => $currency), $commission_id);
                    update_post_meta($commission_id, '_edd_commission_info', $commission_info);
                    update_post_meta($commission_id, '_commission_status', 'unpaid');
                    update_post_meta($commission_id, '_download_id', $download_id);
                    update_post_meta($commission_id, '_user_id', $recipient);
                    update_post_meta($commission_id, '_edd_commission_payment_id', $payment_id);
                    //if we are dealing with a variation, then save variation info
                    if (isset($variation)) {
                        update_post_meta($commission_id, '_edd_commission_download_variation', $variation);
                    }
                    do_action('eddc_insert_commission', $recipient, $commission_amount, $rate, $download_id, $commission_id, $payment_id);
                }
            }
        }
    }
}
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:72,代码来源:commission-functions.php

示例15: cryptocoin_payment

 public function cryptocoin_payment($payment)
 {
     global $gourl;
     if (!is_object($payment) || edd_get_payment_gateway($payment->ID) != "gourl") {
         return true;
     }
     // Current Order Details
     $status = $payment->post_status;
     $amount = edd_get_payment_amount($payment->ID);
     $currency = edd_get_payment_currency_code($payment->ID);
     $userID = edd_get_payment_user_id($payment->ID);
     $orderID = "order" . $payment->ID;
     // file shortcode-receipt.php
     // filter 'edd_payment_receipt_before' inside <table>
     echo '</thead></table>';
     if (!$payment || !$payment->ID) {
         echo '<h3>' . __('Information', GOURLEDD) . '</h3>' . PHP_EOL;
         echo "<div class='edd-alert edd-alert-error'>" . __('The GoUrl payment plugin was called to process a payment but could not retrieve the order details. Cannot continue!', GOURLEDD) . "</div>";
     } elseif (!in_array($status, array("pending", "publish"))) {
         echo '<h3>' . __('Information', GOURLEDD) . '</h3>' . PHP_EOL;
         echo "<div class='edd-alert edd-alert-error'>" . sprintf(__("This order's status is '%s' - it cannot be paid for. Please contact us if you need assistance.", GOURLEDD), $status) . "</div>";
     } elseif (!class_exists('gourlclass') || !defined('GOURL') || !is_object($gourl)) {
         echo '<h3>' . __('Information', GOURLEDD) . '</h3>' . PHP_EOL;
         echo "<div class='edd-alert edd-alert-error'>" . sprintf(__("Please try a different payment method. Admin need to install and activate wordpress plugin <a href='%s'>GoUrl Bitcoin Gateway for Wordpress</a> to accept Bitcoin/Altcoin Payments online.", GOURLEDD), "https://gourl.io/bitcoin-wordpress-plugin.html") . "</div>";
     } elseif (!$this->payments || !$this->defcoin || true === version_compare(EDD_VERSION, '2.4.2', '<') || true === version_compare(GOURL_VERSION, '1.3.4', '<') || array_key_exists($currency, $this->coin_names) && !array_key_exists($currency, $this->payments)) {
         echo '<h3>' . __('Information', GOURLEDD) . '</h3>' . PHP_EOL;
         echo "<div class='edd-alert edd-alert-error'>" . sprintf(__('Sorry, but there was an error processing your order. Please try a different payment method or contact us if you need assistance (GoUrl Bitcoin Plugin not configured / %s not activated).', GOURLEDD), !$this->payments || !$this->defcoin || !isset($this->coin_names[$currency]) ? $this->title : $this->coin_names[$currency]) . "</div>";
     } else {
         $plugin = "gourledd";
         $period = "NOEXPIRY";
         $language = $this->deflang;
         $coin = $this->coin_names[$this->defcoin];
         $affiliate_key = 'gourl';
         $crypto = array_key_exists($currency, $this->coin_names);
         if (!$userID) {
             $userID = "guest";
         }
         // allow guests to make checkout (payments)
         if (!$userID) {
             echo '<h3>' . __('Information', GOURLEDD) . '</h3>' . PHP_EOL;
             echo "<div align='center'><a href='" . wp_login_url(get_permalink()) . "'>\n\t\t\t\t\t\t\t<img style='border:none;box-shadow:none;' title='" . __('You need first to login or register on the website to make Bitcoin/Altcoin Payments', GOURLEDD) . "' vspace='10'\n\t\t\t\t\t\t\tsrc='" . $gourl->box_image() . "' border='0'></a></div>";
         } elseif ($amount <= 0) {
             echo '<h3>' . __('Information', GOURLEDD) . '</h3>' . PHP_EOL;
             echo "<div class='edd-alert edd-alert-error'>" . sprintf(__("This order's amount is %s - it cannot be paid for. Please contact us if you need assistance.", GOURLEDD), $amount . " " . $currency) . "</div>";
         } else {
             // Exchange (optional)
             // --------------------
             if ($currency != "USD" && !$crypto) {
                 $amount = gourl_convert_currency($currency, "USD", $amount);
                 if ($amount <= 0) {
                     echo '<h3>' . __('Information', GOURLEDD) . '</h3>' . PHP_EOL;
                     echo "<div class='edd-alert edd-alert-error'>" . sprintf(__('Sorry, but there was an error processing your order. Please try later or use a different payment method. System cannot receive exchange rates for %s/USD from Google Finance', GOURLEDD), $currency) . "</div>";
                 } else {
                     $currency = "USD";
                 }
             }
             if (!$crypto) {
                 $amount = $amount * $this->emultiplier;
             }
             // Payment Box
             // ------------------
             if ($amount > 0) {
                 // crypto payment gateway
                 $result = $gourl->cryptopayments($plugin, $amount, $currency, $orderID, $period, $language, $coin, $affiliate_key, $userID, $this->iconwidth);
                 if (!isset($result["is_paid"]) || !$result["is_paid"]) {
                     echo '<h3>' . __('Pay Now -', GOURLEDD) . '</h3>' . PHP_EOL;
                 }
                 if ($result["error"]) {
                     echo "<div class='edd-alert edd-alert-error'>" . __("Sorry, but there was an error processing your order. Please try a different payment method.", GOURLEDD) . "<br/>" . $result["error"] . "</div>";
                 } else {
                     // display payment box or successful payment result
                     echo $result["html_payment_box"];
                     // payment received
                     if ($result["is_paid"]) {
                         if (false) {
                             echo "<div align='center'>" . sprintf(__('%s Payment ID: #%s', GOURLEDD), ucfirst($result["coinname"]), $result["paymentID"]) . "</div>";
                         }
                         echo "<br/>";
                         if ($status == 'pending') {
                             header('Location: ' . $_SERVER['REQUEST_URI']);
                         }
                     }
                 }
             }
         }
     }
     echo '<br/><br/><table id="edd_purchase_receipt"><thead>';
     return true;
 }
开发者ID:oshadami,项目名称:Bitcoin-Easy-Digital-Downloads,代码行数:89,代码来源:gourl-edd.php


注:本文中的edd_get_payment_gateway函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。