本文整理汇总了PHP中edd_insert_payment_note函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_insert_payment_note函数的具体用法?PHP edd_insert_payment_note怎么用?PHP edd_insert_payment_note使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_insert_payment_note函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edd_process_paytm_gateway_ipn
function edd_process_paytm_gateway_ipn()
{
global $edd_options;
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
return;
}
$payment_id = $_GET['payment_id'];
if (empty($payment_id)) {
edd_send_back_to_checkout('?payment-mode=paytm_gateway');
}
// Fallback just in case post_max_size is lower than needed
if (isset($_POST['ORDERID']) && isset($_POST['RESPCODE'])) {
$order_sent = $_POST['ORDERID'];
$responseDescription = $_POST['RESPMSG'];
if ($_POST['RESPCODE'] == '01') {
// success
$order_sent = $_POST['ORDERID'];
$res_code = $_POST['RESPCODE'];
$responseDescription = $_POST['RESPMSG'];
$checksum_recv = $_POST['CHECKSUMHASH'];
$paramList = $_POST;
$order_amount = $_POST['TXNAMOUNT'];
// code by paytm team
$bool = "FALSE";
$secret_key = $edd_options['paytm_mer_access_key'];
$bool = verifychecksum_e($paramList, $secret_key, $checksum_recv);
if ($bool == "TRUE") {
$payment_meta = edd_get_payment_meta($payment_id);
edd_insert_payment_note($payment_id, sprintf(__('Thank you for your order . Your transaction has been successful. Paytm Transaction ID: %s', 'edd'), $_REQUEST['TXNID']));
edd_set_payment_transaction_id($payment_id, $_REQUEST['TXNID']);
edd_update_payment_status($payment_id, 'complete');
edd_empty_cart();
edd_send_to_success_page();
} else {
edd_record_gateway_error(__('Paytm Error', 'edd'), sprintf(__('Transaction Failed Invalid Checksum', 'edd'), ''), $payment_id);
edd_update_payment_status($payment_id, 'failed');
edd_insert_payment_note($payment_id, sprintf(__('Transaction Failed Invalid Checksum', 'edd'), ''));
wp_redirect('?page_id=6&payment-mode=paytm_gateway');
//edd_send_back_to_checkout( '?payment-mode=paytm_gateway' );
}
} else {
edd_record_gateway_error(__('Paytm Error', 'edd'), sprintf(__('Transaction Failed. %s', 'edd'), $responseDescription), $payment_id);
edd_update_payment_status($payment_id, 'failed');
edd_insert_payment_note($payment_id, sprintf(__('Transaction Failed. %s', 'edd'), $responseDescription));
wp_redirect('?page_id=6&payment-mode=paytm_gateway');
}
} else {
edd_record_gateway_error(__('Paytm Error', 'edd'), sprintf(__('Transaction Failed, No Response ', 'edd'), ''), $payment_id);
edd_update_payment_status($payment_id, 'failed');
edd_insert_payment_note($payment_id, sprintf(__('Transaction Failed, No Response ', 'edd'), ''));
wp_redirect('?page_id=6&payment-mode=paytm_gateway');
}
exit;
}
示例2: process_paypal_subscr_signup
/**
* Processes the "signup" IPN notice
*
* @since 1.0
* @return void
*/
public static function process_paypal_subscr_signup($ipn_data)
{
$parent_payment_id = absint($ipn_data['custom']);
edd_update_payment_status($parent_payment_id, 'publish');
// Record transaction ID
edd_insert_payment_note($parent_payment_id, sprintf(__('PayPal Subscription ID: %s', 'edd-recurring'), $ipn_data['subscr_id']));
// Store the IPN track ID
update_post_meta($parent_payment_id, '_edd_recurring_ipn_track_id', $ipn_data['ipn_track_id']);
$user_id = edd_get_payment_user_id($ipn_data['custom']);
// Set user as subscriber
EDD_Recurring_Customer::set_as_subscriber($user_id);
// store the customer recurring ID
EDD_Recurring_Customer::set_customer_id($user_id, $ipn_data['payer_id']);
// Store the original payment ID in the customer meta
EDD_Recurring_Customer::set_customer_payment_id($user_id, $ipn_data['custom']);
// Set the customer's status to active
EDD_Recurring_Customer::set_customer_status($user_id, 'active');
// Calculate the customer's new expiration date
$new_expiration = EDD_Recurring_Customer::calc_user_expiration($user_id, $parent_payment_id);
// Set the customer's new expiration date
EDD_Recurring_Customer::set_customer_expiration($user_id, $new_expiration);
}
示例3: insert_payment_note
/**
* Insert payment note
*
* @access public
* @since 1.3.1
*/
public function insert_payment_note($payment_id = 0)
{
$referral = affiliate_wp()->referrals->get_by('reference', $payment_id, $this->context);
if (empty($referral)) {
return;
}
$amount = affwp_currency_filter(affwp_format_amount($referral->amount));
$affiliate_id = $referral->affiliate_id;
$name = affiliate_wp()->affiliates->get_affiliate_name($affiliate_id);
edd_insert_payment_note($payment_id, sprintf(__('Referral #%d for %s recorded for %s', 'affiliate-wp'), $referral->referral_id, $amount, $name));
}
示例4: pw_edd_process_payment
function pw_edd_process_payment($purchase_data)
{
global $edd_options;
/**********************************
* set transaction mode
**********************************/
if (edd_is_test_mode()) {
// set test credentials here
} else {
// set live credentials here
}
/**********************************
* check for errors here
**********************************/
/*
// errors can be set like this
if( ! isset($_POST['card_number'] ) ) {
// error code followed by error message
edd_set_error('empty_card', __('You must enter a card number', 'edd'));
}
*/
/**********************************
* Purchase data comes in like this:
$purchase_data = array(
'downloads' => array of download IDs,
'tax' => taxed amount on shopping cart
'fees' => array of arbitrary cart fees
'discount' => discounted amount, if any
'subtotal' => total price before tax
'price' => total price of cart contents after taxes,
'purchase_key' => // Random key
'user_email' => $user_email,
'date' => date( 'Y-m-d H:i:s' ),
'user_id' => $user_id,
'post_data' => $_POST,
'user_info' => array of user's information and used discount code
'cart_details' => array of cart details,
);
*/
// 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'], '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;
/**********************************
* Process the credit card here.
* If not using a credit card
* then redirect to merchant
* and verify payment with an IPN
**********************************/
// if the merchant payment is complete, set a flag
$merchant_payment_confirmed = true;
if ($merchant_payment_confirmed) {
// this is used when processing credit cards on site
// once a transaction is successful, set the purchase to complete
edd_update_payment_status($payment, 'complete');
// record transaction ID, or any other notes you need
edd_insert_payment_note($payment, 'Transaction ID: XXXXXXXXXXXXXXX');
// go to the success page
edd_send_to_success_page();
} else {
$fail = true;
// payment wasn't recorded
}
} 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']);
}
}
示例5: edd_update_edited_purchase
/**
* Update Edited Purchase
*
* Updates the purchase data for a payment.
* Used primarily for adding new downloads to a purchase.
*
* @since 1.0
* @param $data Arguments passed
* @return void
*/
function edd_update_edited_purchase($data)
{
if (wp_verify_nonce($data['edd-payment-nonce'], 'edd_payment_nonce')) {
$payment_id = $_POST['payment-id'];
$payment_data = edd_get_payment_meta($payment_id);
if (isset($_POST['edd-purchased-downloads'])) {
$download_list = array();
foreach ($_POST['edd-purchased-downloads'] as $key => $download) {
if (isset($download['options']['price_id'])) {
$download_list[] = array('id' => $key, 'options' => array('price_id' => $download['options']['price_id']));
} else {
$download_list[] = array('id' => $download);
}
}
$payment_data['downloads'] = serialize($download_list);
}
$user_info = maybe_unserialize($payment_data['user_info']);
$user_info['email'] = strip_tags($_POST['edd-buyer-email']);
$user_info['user_id'] = strip_tags(intval($_POST['edd-buyer-user-id']));
$payment_data['user_info'] = serialize($user_info);
update_post_meta($payment_id, '_edd_payment_meta', $payment_data);
update_post_meta($payment_id, '_edd_payment_user_email', strip_tags($_POST['edd-buyer-email']));
update_post_meta($payment_id, '_edd_payment_user_id', strip_tags(intval($_POST['edd-buyer-user-id'])));
if (!empty($_POST['edd-payment-note'])) {
$note = wp_kses($_POST['edd-payment-note'], array());
$note_id = edd_insert_payment_note($payment_id, $note);
}
if (!empty($_POST['edd-payment-amount'])) {
update_post_meta($payment_id, '_edd_payment_total', sanitize_text_field(edd_sanitize_amount($_POST['edd-payment-amount'])));
}
if (!empty($_POST['edd-unlimited-downloads'])) {
add_post_meta($payment_id, '_unlimited_file_downloads', '1');
} else {
delete_post_meta($payment_id, '_unlimited_file_downloads');
}
if ($_POST['edd-old-status'] != $_POST['edd-payment-status']) {
edd_update_payment_status($payment_id, $_POST['edd-payment-status']);
}
if ($_POST['edd-payment-status'] == 'publish' && isset($_POST['edd-payment-send-email'])) {
// Send the purchase receipt
edd_email_purchase_receipt($payment_id, false);
}
do_action('edd_update_edited_purchase', $payment_id);
}
}
示例6: edd_record_status_change
/**
* Record payment status change
*
* @since 1.4.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_record_status_change($payment_id, $new_status, $old_status)
{
// Get the list of statuses so that status in the payment note can be translated
$stati = edd_get_payment_statuses();
$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
$status_change = sprintf(__('Status changed from %s to %s', 'edd'), $old_status, $new_status);
edd_insert_payment_note($payment_id, $status_change);
}
示例7: voguepay_listen_for_failed_payments
/**
* Mark payments as Failed when returning to the Failed Transaction page
* @return void
*/
public function voguepay_listen_for_failed_payments()
{
$failed_page = edd_get_option('failure_page', 0);
if (!empty($failed_page) && is_page($failed_page) && !empty($_GET['payment-id'])) {
$payment_id = absint($_GET['payment-id']);
if (!empty($_POST)) {
// create payment note for failed transaction.
$payment_note = sprintf(__('voguepay Reference ID: %s <br> Merchant Reference ID: %s', 'edd-voguepay'), $_POST['voguepay_refID'], $_POST['merchant_ref']);
$payment_note .= '<br> Message: ' . $_POST['status_msg'];
edd_insert_payment_note($payment_id, $payment_note);
edd_set_payment_transaction_id($payment_id, $post_data['voguepay_refID']);
}
}
}
示例8: sofort_ipn
function sofort_ipn()
{
global $edd_options;
if (isset($_GET['sofort']) && $_GET['sofort'] == 'ipn') {
require_once 'library/sofortLib.php';
$notification = new SofortLib_Notification();
$notification->getNotification();
$transactionId = $notification->getTransactionId();
if ($transactionId) {
// fetch some information for the transaction id retrieved above
$transactionData = new SofortLib_TransactionData(trim($edd_options['sofort_config_id']));
$transactionData->setTransaction($transactionId);
$transactionData->sendRequest();
$reason = $transactionData->getReason();
$payment_id = str_replace('CartId ', '', $reason[0]);
edd_update_payment_status($payment_id, 'publish');
edd_insert_payment_note($payment_id, 'Payment Successful. Transaction ID is ' . $transactionId);
}
exit;
}
}
示例9: delete_ecommerce360_purchase
/**
* Remove an order from MailChimp if the payment was refunded
*
* @return bool
*/
public function delete_ecommerce360_purchase($payment_id, $new_status, $old_status)
{
if ('publish' != $old_status && 'revoked' != $old_status) {
return;
}
if ('refunded' != $new_status) {
return;
}
// Make sure an API key has been entered
if (empty($this->key)) {
return FALSE;
}
// Send to MailChimp
$options = array('CURLOPT_FOLLOWLOCATION' => false);
$mailchimp = new EDD_MailChimp_API($this->key, $options);
try {
$result = $mailchimp->call('ecomm/order-del', array('store_id' => self::_edd_ec360_get_store_id(), 'order_id' => $payment_id));
edd_insert_payment_note($payment_id, __('Order details have been removed from MailChimp successfully', 'eddmc'));
return TRUE;
} catch (Exception $e) {
edd_insert_payment_note($payment_id, __('MailChimp Ecommerce360 Error: ', 'eddmc') . $e->getMessage());
return FALSE;
}
}
示例10: edd_sl_process_license_upgrade
//.........这里部分代码省略.........
$bundle_licensing = (bool) get_post_meta($download_id, '_edd_sl_enabled', true);
$parent_license_id = 0;
$activation_limit = false;
$user_info = edd_get_payment_meta_user_info($payment_id);
if ($bundle_licensing) {
$downloads[] = $download_id;
}
$downloads = array_merge($downloads, edd_get_bundled_products($download_id));
if (edd_has_variable_prices($download_id)) {
$activation_limit = edd_software_licensing()->get_price_activation_limit($download_id, $cart_item['item_number']['options']['price_id']);
$is_lifetime = edd_software_licensing()->get_price_is_lifetime($download_id, $cart_item['item_number']['options']['price_id']);
}
foreach ($downloads as $d_id) {
if ((int) $d_id === (int) $old_download_id) {
continue;
}
if (!get_post_meta($d_id, '_edd_sl_enabled', true)) {
continue;
}
$license_title = get_the_title($d_id) . ' - ' . $user_info['email'];
$license_args = array('post_type' => 'edd_license', 'post_title' => $license_title, 'post_status' => 'publish', 'post_date' => get_post_field('post_date', $payment_id, 'raw'));
if ($parent_license_id) {
$license_args['post_parent'] = $parent_license_id;
}
$l_id = wp_insert_post(apply_filters('edd_sl_insert_license_args', $license_args));
if ($bundle_licensing && $download_id == $d_id && !$parent_license_id) {
$parent_license_id = $l_id;
}
$license_key = edd_software_licensing()->get_new_download_license_key($d_id);
if (!$license_key) {
// No predefined license key available, generate a random one
$license_key = edd_software_licensing()->generate_license_key($l_id, $d_id, $payment_id, $cart_index);
}
$price_id = isset($cart_item['item_number']['options']['price_id']) ? (int) $cart_item['item_number']['options']['price_id'] : false;
add_post_meta($l_id, '_edd_sl_download_id', $d_id);
if (false !== $price_id) {
add_post_meta($l_id, '_edd_sl_download_price_id', $price_id);
}
add_post_meta($l_id, '_edd_sl_cart_index', $cart_index);
add_post_meta($l_id, '_edd_sl_payment_id', $payment_id);
add_post_meta($l_id, '_edd_sl_key', $license_key);
add_post_meta($l_id, '_edd_sl_user_id', $user_info['id']);
add_post_meta($l_id, '_edd_sl_status', 'inactive');
add_post_meta($l_id, '_edd_sl_site_count', 0);
if ($parent_license_id && !empty($activation_limit)) {
add_post_meta($l_id, '_edd_sl_limit', $activation_limit);
}
// Get license length
$license_length = edd_software_licensing()->get_license_length($l_id, $payment_id, $d_id);
if (empty($is_lifetime) && 'lifetime' !== $license_length) {
// Set license expiration date
delete_post_meta($l_id, '_edd_sl_is_lifetime');
edd_software_licensing()->set_license_expiration($l_id, strtotime($license_length, strtotime($purchase_date)));
} else {
edd_software_licensing()->set_license_as_lifetime($l_id);
}
do_action('edd_sl_store_license', $l_id, $d_id, $payment_id, $type);
}
// Now update the original license
wp_update_post(array('ID' => $license_id, 'post_parent' => $parent_license_id));
update_post_meta($license_id, '_edd_sl_cart_index', $cart_index);
add_post_meta($license_id, '_edd_sl_payment_id', $payment_id);
} else {
// Standard license upgrade
$new_title = get_the_title($download_id) . ' - ' . edd_get_payment_user_email($payment_id);
wp_update_post(array('ID' => $license_id, 'post_title' => $new_title));
update_post_meta($license_id, '_edd_sl_cart_index', $cart_index);
add_post_meta($license_id, '_edd_sl_payment_id', $payment_id);
update_post_meta($license_id, '_edd_sl_download_id', $download_id);
if (edd_has_variable_prices($download_id)) {
$limit = edd_software_licensing()->get_price_activation_limit($download_id, $upgrade['price_id']);
$is_lifetime = edd_software_licensing()->get_price_is_lifetime($download_id, $upgrade['price_id']);
update_post_meta($license_id, '_edd_sl_download_price_id', $upgrade['price_id']);
} else {
$limit = edd_software_licensing()->get_license_limit($download_id, $license_id);
}
update_post_meta($license_id, '_edd_sl_limit', $limit);
$license_length = edd_software_licensing()->get_license_length($license_id, $payment_id, $download_id);
if (empty($is_lifetime) && 'lifetime' !== $license_length) {
// Set license expiration date
delete_post_meta($license_id, '_edd_sl_is_lifetime');
edd_software_licensing()->set_license_expiration($license_id, strtotime($license_length, strtotime($purchase_date)));
} else {
edd_software_licensing()->set_license_as_lifetime($license_id);
}
}
// Now store upgrade details / notes on payments
$old_product = get_the_title($old_download_id);
if (false !== $old_price_id) {
$old_product .= ' - ' . edd_get_price_option_name($old_download_id, $old_price_id);
}
$new_product = get_the_title($download_id);
if (edd_has_variable_prices($download_id)) {
$new_product .= ' - ' . edd_get_price_option_name($download_id, $upgrade['price_id']);
}
$note = sprintf(__('License upgraded from %s to %s', 'edd_sl'), $old_product, $new_product);
edd_insert_payment_note($payment_id, $note);
update_post_meta($payment_id, '_edd_sl_upgraded_payment_id', $old_payment_id);
update_post_meta($old_payment_id, '_edd_sl_upgraded_to_payment_id', $payment_id);
}
示例11: add_note
/**
* Add a note to a payment
*
* @since 2.5
* @param string $note The note to add
* @return void
*/
public function add_note($note = false)
{
// Bail if no note specified
if (!$note) {
return false;
}
edd_insert_payment_note($this->ID, $note);
}
示例12: gourledd_gourlcallback
function gourledd_gourlcallback($user_id, $order_id, $payment_details, $box_status)
{
if (!in_array($box_status, array("cryptobox_newrecord", "cryptobox_updated"))) {
return false;
}
if (strpos($order_id, "order") === 0) {
$payment_id = substr($order_id, 5);
} else {
return false;
}
if (!$user_id || $payment_details["status"] != "payment_received") {
return false;
}
$payment = get_post($payment_id);
if (!$payment || !$payment->post_status) {
return false;
}
$coinName = ucfirst($payment_details["coinname"]);
$amount = $payment_details["amount"] . " " . $payment_details["coinlabel"] . "  ( \$" . $payment_details["amountusd"] . " )";
$payID = $payment_details["paymentID"];
$confirmed = $payment_details["is_confirmed"] ? __('Yes', GOURLEDD) : __('No', GOURLEDD);
// a. New Payment Received - Awaiting Transaction Confirmation...
if ($box_status == "cryptobox_newrecord") {
// Save Log
edd_insert_payment_note($payment_id, sprintf(__("<b>%s</b> Payment Received <br/>%s <br/><a href='%s'>Payment ID: %s</a>. <br/>Awaiting network confirmation...", GOURLEDD), __($coinName, GOURLEDD), $amount, GOURL_ADMIN . GOURL . "payments&s=payment_" . $payID, $payID) . ' <br/>');
edd_set_payment_transaction_id($payment_id, $payment_details["tx"]);
}
// b. Existing Payment Confirmed (6+ transaction confirmations)
if ($payment_details["is_confirmed"]) {
// Save Log
edd_insert_payment_note($payment_id, sprintf(__("%s Payment ID: <a href='%s'>%s</a> - <b>Confirmed</b>", GOURLEDD), __($coinName, GOURLEDD), GOURL_ADMIN . GOURL . "payments&s=payment_" . $payID, $payID) . ' <br/>');
}
// c. Update Status to Completed
if ($payment->post_status != 'publish') {
edd_update_payment_status($payment_id, 'publish');
}
return true;
}
示例13: edd_pup_ajax_send_email
/**
* Email the product update to the customer in a customizable message
*
* @param int $payment_id Payment ID
* @param int $email_id Email ID for a edd_pup_email post-type
* @return void
*/
function edd_pup_ajax_send_email($payment_id, $email_id, $test_mode = null)
{
$userid = get_current_user_id();
$emailpost = get_post($email_id);
$emailmeta = get_post_custom($email_id);
$payment_data = edd_get_payment_meta($payment_id);
$email = edd_get_payment_user_email($payment_id);
$from_name = $emailmeta['_edd_pup_from_name'][0];
$from_email = $emailmeta['_edd_pup_from_email'][0];
$attachments = apply_filters('edd_pup_attachments', array(), $payment_id, $payment_data);
$lognotes = edd_get_option('edd_pup_log_notes');
add_filter('edd_email_template', 'edd_pup_template');
/* If subject doesn't use tags (and thus is the same for each customer)
* then store it in a transient for quick access on subsequent loops. */
$subject = get_transient('edd_pup_subject_' . $userid);
if (false === $subject || $emailmeta['_edd_pup_subject'][0] != $subject) {
if (empty($emailmeta['_edd_pup_subject'][0])) {
$subject = '(no subject)';
wp_update_post(array('ID' => $email_id, 'post_excerpt' => $subject));
update_post_meta($email_id, '_edd_pup_subject', $subject);
set_transient('edd_pup_subject_' . $userid, $subject, 60 * 60);
} else {
$subject = edd_do_email_tags($emailmeta['_edd_pup_subject'][0], $payment_id);
if ($subject == $emailmeta['_edd_pup_subject'][0]) {
set_transient('edd_pup_subject_' . $userid, $subject, 60 * 60);
}
}
}
if (version_compare(get_option('edd_version'), '2.1') >= 0) {
$edd_emails = new EDD_emails();
$message = edd_do_email_tags($emailpost->post_content, $payment_id);
$edd_emails->__set('from_name', $from_name);
$edd_emails->__set('from_address', $from_email);
$mailresult = isset($test_mode) ? true : $edd_emails->send($email, $subject, $message, $attachments);
} else {
$email_body_header = get_transient('edd_pup_email_body_header_' . $userid);
if (false === $email_body_header) {
$email_body_header = edd_get_email_body_header();
set_transient('edd_pup_email_body_header_' . $userid, $email_body_header, 60 * 60);
}
$email_body_footer = get_transient('edd_pup_email_body_footer_' . $userid);
if (false === $email_body_footer) {
$email_body_footer = edd_get_email_body_footer();
set_transient('edd_pup_email_body_footer_' . $userid, $email_body_footer, 60 * 60);
}
$headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
$headers .= "Reply-To: " . $from_email . "\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$message = $email_body_header;
$message .= apply_filters('edd_pup_message', edd_email_template_tags($emailpost->post_content, $payment_data, $payment_id), $payment_id, $payment_data);
$message .= $email_body_footer;
$mailresult = isset($test_mode) ? true : wp_mail($email, $subject, $message, $headers, $attachments);
}
// Update payment notes to log this email being sent
if (!isset($lognotes['sent'])) {
edd_insert_payment_note($payment_id, 'Sent product update email "' . $subject . '" <a href="' . admin_url('edit.php?post_type=download&page=edd-prod-updates&view=view_pup_email&id=' . $email_id) . '">View Email</a>');
}
return $mailresult;
}
示例14: edd_ti_send_tracking
function edd_ti_send_tracking($post)
{
$nonce = !empty($post['nonce']) ? $post['nonce'] : false;
if (!wp_verify_nonce($nonce, 'edd-ti-send-tracking')) {
wp_die();
}
$tracking_id = edd_ti_get_payment_tracking_id($post['payment_id']);
if (empty($tracking_id)) {
return;
}
$from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
$from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
$to_email = edd_get_payment_user_email($post['payment_id']);
$subject = 'Your order has shipped';
$heading = 'Your order has shipped!';
$message = '<p>Your recent order ' . $post['payment_id'] . ' has been shipped.</p>';
$message .= '<p>Tracking ID: <a href="' . edd_ti_get_payment_tracking_link($post['payment_id']) . '">' . $tracking_id . '</a></p>';
$message .= '<p>Thank you!</p>';
$message .= '<p>The ' . $from_name . ' team</p>';
$headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
$headers .= "Reply-To: " . $from_email . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$attachments = array();
$emails = EDD()->emails;
$emails->__set('from_name', $from_name);
$emails->__set('from_email', $from_email);
$emails->__set('heading', $heading);
$emails->__set('headers', $headers);
$result = $emails->send($to_email, $subject, $message, $attachments);
$response = array('success' => $result);
$response['message'] = $result ? __('Email sent.', 'edd-tracking-info') : __('Error sending email. Try again later.', 'edd-tracking-info');
if ($result) {
edd_update_payment_meta($post['payment_id'], 'edd_tracking_info_sent', true);
edd_insert_payment_note($post['payment_id'], sprintf(__('Tracking information sent to %s.', 'edd-tracking-info'), $to_email));
}
echo json_encode($response);
die;
}
示例15: process_purchase
/**
* The $purchase_data array consists of the following data:
*
* $purchase_data = array(
* 'downloads' => array of download IDs,
* 'tax' => taxed amount on shopping cart
* 'subtotal' => total price before tax
* 'price' => total price of cart contents after taxes,
* 'purchase_key' => Random key
* 'user_email' => $user_email,
* 'date' => date( 'Y-m-d H:i:s' ),
* 'user_id' => $user_id,
* 'post_data' => $_POST,
* 'user_info' => array of user's information and used discount code
* 'cart_details' => array of cart details,
* );
*/
public function process_purchase($purchase_data)
{
$config_id = edd_get_option($this->id . '_config_id');
// Collect payment data
$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'], 'user_info' => $purchase_data['user_info'], 'cart_details' => $purchase_data['cart_details'], 'gateway' => $this->id, 'status' => 'pending');
// Record the pending payment
$payment_id = edd_insert_payment($payment_data);
// Check payment
if (!$payment_id) {
// Log error
edd_record_gateway_error(__('Payment Error', 'pronamic_ideal'), sprintf(__('Payment creation failed before sending buyer to the payment provider. Payment data: %s', 'pronamic_ideal'), json_encode($payment_data)), $payment_id);
edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']);
} else {
$data = new Pronamic_WP_Pay_Extensions_EDD_PaymentData($payment_id, $payment_data);
$gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id);
if ($gateway) {
// Start
$payment = Pronamic_WP_Pay_Plugin::start($config_id, $gateway, $data, $this->payment_method);
$error = $gateway->get_error();
if (is_wp_error($error)) {
edd_record_gateway_error(__('Payment Error', 'pronamic_ideal'), sprintf(__('Payment creation failed before sending buyer to the payment provider. Payment data: %s', 'pronamic_ideal'), json_encode($payment_data)), $payment_id);
edd_set_error('pronamic_pay_error', Pronamic_WP_Pay_Plugin::get_default_error_message());
foreach ($error->get_error_messages() as $i => $message) {
edd_set_error('pronamic_pay_error_' . $i, $message);
}
edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']);
} else {
// Transaction ID
// @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.3/includes/payments/functions.php#L1400-L1416
edd_set_payment_transaction_id($payment_id, $payment->get_transaction_id());
// Payment note
$payment_link = add_query_arg(array('post' => $payment->get_id(), 'action' => 'edit'), admin_url('post.php'));
$note = sprintf(__('Payment %s pending.', 'pronamic_ideal'), sprintf('<a href="%s">#%s</a>', $payment_link, $payment->get_id()));
edd_insert_payment_note($payment_id, $note);
$gateway->redirect($payment);
exit;
}
} else {
edd_set_error('pronamic_pay_error', Pronamic_WP_Pay_Plugin::get_default_error_message());
edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']);
}
}
}