本文整理汇总了PHP中PMProEmail::sendInvoiceEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PMProEmail::sendInvoiceEmail方法的具体用法?PHP PMProEmail::sendInvoiceEmail怎么用?PHP PMProEmail::sendInvoiceEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMProEmail
的用法示例。
在下文中一共展示了PMProEmail::sendInvoiceEmail方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hideCardNumber
$morder->billing->country = $old_order->billing->country;
$morder->billing->phone = $old_order->billing->phone;
//get CC info that is on file
$morder->cardtype = get_user_meta($user_id, "pmpro_CardType", true);
$morder->accountnumber = hideCardNumber(get_user_meta($user_id, "pmpro_AccountNumber", true), false);
$morder->expirationmonth = get_user_meta($user_id, "pmpro_ExpirationMonth", true);
$morder->expirationyear = get_user_meta($user_id, "pmpro_ExpirationYear", true);
$morder->ExpirationDate = $morder->expirationmonth . $morder->expirationyear;
$morder->ExpirationDate_YdashM = $morder->expirationyear . "-" . $morder->expirationmonth;
//save
$morder->status = "success";
$morder->saveOrder();
$morder->getMemberOrderByID($morder->id);
//email the user their invoice
$pmproemail = new PMProEmail();
$pmproemail->sendInvoiceEmail($user, $morder);
$logstr .= "Created new order with ID #" . $morder->id . ". Event ID #" . $event->id . ".";
/*
Checking if there is an update "after next payment" for this user.
*/
$user_updates = $user->pmpro_stripe_updates;
if (!empty($user_updates)) {
foreach ($user_updates as $key => $update) {
if ($update['when'] == 'payment') {
//get current plan at Stripe to get payment date
$last_order = new MemberOrder();
$last_order->getLastMemberOrder($user_id);
$last_order->setGateway('stripe');
$last_order->Gateway->getCustomer();
if (!empty($last_order->Gateway->customer)) {
//find the first subscription
示例2: pmpro_insSaveOrder
function pmpro_insSaveOrder($txn_id, $last_order)
{
global $wpdb;
//check that txn_id has not been previously processed
$old_txn = $wpdb->get_var("SELECT payment_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE payment_transaction_id = '" . $txn_id . "' LIMIT 1");
if (empty($old_txn)) {
//hook for successful subscription payments
do_action("pmpro_subscription_payment_completed");
//save order
$morder = new MemberOrder();
$morder->user_id = $last_order->user_id;
$morder->membership_id = $last_order->membership_id;
$morder->payment_transaction_id = $txn_id;
$morder->subscription_transaction_id = $last_order->subscription_transaction_id;
$morder->InitialPayment = $_POST['item_list_amount_1'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $_POST['item_list_amount_1'];
$morder->FirstName = $_POST['customer_first_name'];
$morder->LastName = $_POST['customer_last_name'];
$morder->Email = $_POST['customer_email'];
//save
$morder->saveOrder();
$morder->getMemberOrderByID($morder->id);
//email the user their invoice
$pmproemail = new PMProEmail();
$pmproemail->sendInvoiceEmail(get_userdata($last_order->user_id), $morder);
inslog("New order (" . $morder->code . ") created.");
return true;
} else {
inslog("Duplicate Transaction ID: " . $txn_id);
return false;
}
}
示例3: pmpro_ipnSaveOrder
function pmpro_ipnSaveOrder($txn_id, $last_order)
{
global $wpdb;
//check that txn_id has not been previously processed
$old_txn = $wpdb->get_var("SELECT payment_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE payment_transaction_id = '" . $txn_id . "' LIMIT 1");
if (empty($old_txn)) {
//hook for successful subscription payments
do_action("pmpro_subscription_payment_completed");
//save order
$morder = new MemberOrder();
$morder->user_id = $last_order->user_id;
$morder->membership_id = $last_order->membership_id;
$morder->payment_transaction_id = $txn_id;
$morder->subscription_transaction_id = $last_order->subscription_transaction_id;
$morder->gateway = $last_order->gateway;
$morder->gateway_environment = $last_order->gateway_environment;
// Payment Status
$morder->status = 'success';
// We have confirmed that and thats the reason we are here.
// Payment Type.
$morder->payment_type = $last_order->payment_type;
//set amount based on which PayPal type
if ($last_order->gateway == "paypal") {
$morder->InitialPayment = $_POST['amount'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $_POST['amount'];
} elseif ($last_order->gateway == "paypalexpress") {
$morder->InitialPayment = $_POST['amount'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $_POST['amount'];
} elseif ($last_order->gateway == "paypalstandard") {
$morder->InitialPayment = $_POST['mc_gross'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $_POST['mc_gross'];
}
$morder->FirstName = $_POST['first_name'];
$morder->LastName = $_POST['last_name'];
$morder->Email = $_POST['payer_email'];
//get address info if appropriate
if ($last_order->gateway == "paypal") {
$morder->Address1 = get_user_meta($last_order->user_id, "pmpro_baddress1", true);
$morder->City = get_user_meta($last_order->user_id, "pmpro_bcity", true);
$morder->State = get_user_meta($last_order->user_id, "pmpro_bstate", true);
$morder->CountryCode = "US";
$morder->Zip = get_user_meta($last_order->user_id, "pmpro_bzip", true);
$morder->PhoneNumber = get_user_meta($last_order->user_id, "pmpro_bphone", true);
$morder->billing->name = $_POST['first_name'] . " " . $_POST['last_name'];
$morder->billing->street = get_user_meta($last_order->user_id, "pmpro_baddress1", true);
$morder->billing->city = get_user_meta($last_order->user_id, "pmpro_bcity", true);
$morder->billing->state = get_user_meta($last_order->user_id, "pmpro_bstate", true);
$morder->billing->zip = get_user_meta($last_order->user_id, "pmpro_bzip", true);
$morder->billing->country = get_user_meta($last_order->user_id, "pmpro_bcountry", true);
$morder->billing->phone = get_user_meta($last_order->user_id, "pmpro_bphone", true);
//get CC info that is on file
$morder->cardtype = get_user_meta($last_order->user_id, "pmpro_CardType", true);
$morder->accountnumber = hideCardNumber(get_user_meta($last_order->user_id, "pmpro_AccountNumber", true), false);
$morder->expirationmonth = get_user_meta($last_order->user_id, "pmpro_ExpirationMonth", true);
$morder->expirationyear = get_user_meta($last_order->user_id, "pmpro_ExpirationYear", true);
$morder->ExpirationDate = $morder->expirationmonth . $morder->expirationyear;
$morder->ExpirationDate_YdashM = $morder->expirationyear . "-" . $morder->expirationmonth;
}
//save
$morder->saveOrder();
$morder->getMemberOrderByID($morder->id);
//email the user their invoice
$pmproemail = new PMProEmail();
$pmproemail->sendInvoiceEmail(get_userdata($last_order->user_id), $morder);
ipnlog("New order (" . $morder->code . ") created.");
return true;
} else {
ipnlog("Duplicate Transaction ID: " . $txn_id);
return false;
}
}
示例4: pmpro_insSaveOrder
function pmpro_insSaveOrder($txnref, $last_order)
{
global $wpdb;
//check that txn_id has not been previously processed
$old_txn = $wpdb->get_var("SELECT payment_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE payment_transaction_id = '" . $txnref . "' LIMIT 1");
if (empty($old_txn)) {
//hook for successful subscription payments
do_action("pmpro_subscription_payment_completed");
//save order
$morder = new MemberOrder();
$morder->user_id = $last_order->user_id;
$morder->membership_id = $last_order->membership_id;
$morder->payment_transaction_id = $txnref;
$morder->subscription_transaction_id = $last_order->subscription_transaction_id;
$morder->InitialPayment = $last_order->InitialPayment;
//$_POST['item_list_amount_1']; //not the initial payment, but the class is expecting that
$morder->PaymentAmount = $last_order->PaymentAmount;
//$_POST['item_list_amount_1'];
$morder->gateway = $last_order->gateway;
$morder->gateway_environment = $last_order->gateway_environment;
//save
$morder->saveOrder();
$pmproemail = new PMProEmail();
$pmproemail->sendInvoiceEmail($user_id, $morder);
$user = get_userdata($morder->user_id);
$user->membership_level = $morder->membership_level;
//make sure they have the right level info
//send email to member
$pmproemail = new PMProEmail();
$pmproemail->sendCheckoutEmail($user_id, $morder);
//send email to admin
$pmproemail = new PMProEmail();
$pmproemail->sendCheckoutAdminEmail($user_id, $morder);
$morder->getMemberOrderByID($morder->id);
// //email the user their invoice
$pmproemail = new PMProEmail();
$pmproemail->sendInvoiceEmail(get_userdata($last_order->user_id), $morder);
if (strpos(PMPRO_INS_DEBUG, "@")) {
$log_email = PMPRO_INS_DEBUG;
} else {
$log_email = get_option("admin_email");
}
inslog("New order (" . $morder->code . ") created.");
return true;
} else {
inslog("Duplicate Transaction ID: " . $txnref);
return false;
}
}
示例5: pmpro_ipnSaveOrder
function pmpro_ipnSaveOrder($txn_id, $last_order)
{
global $wpdb;
//check that txn_id has not been previously processed
$old_txn = $wpdb->get_var("SELECT payment_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE payment_transaction_id = '" . $txn_id . "' LIMIT 1");
if (empty($old_txn)) {
//save order
$morder = new MemberOrder();
$morder->user_id = $last_order->user_id;
$morder->membership_id = $last_order->membership_id;
$morder->payment_transaction_id = $txn_id;
$morder->subscription_transaction_id = $last_order->subscription_transaction_id;
$morder->gateway = $last_order->gateway;
$morder->gateway_environment = $last_order->gateway_environment;
// Payment Status
$morder->status = 'success';
// We have confirmed that and thats the reason we are here.
// Payment Type.
$morder->payment_type = $last_order->payment_type;
//set amount based on which PayPal type
if (false !== stripos($last_order->gateway, "paypal")) {
if (isset($_POST['amount']) && !empty($_POST['amount'])) {
$morder->InitialPayment = $_POST['amount'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $_POST['amount'];
} elseif (isset($_POST['mc_gross']) && !empty($_POST['mc_gross'])) {
$morder->InitialPayment = $_POST['mc_gross'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $_POST['mc_gross'];
} elseif (isset($_POST['payment_gross']) && !empty($_POST['payment_gross'])) {
$morder->InitialPayment = $_POST['payment_gross'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $_POST['payment_gross'];
}
}
$morder->FirstName = $_POST['first_name'];
$morder->LastName = $_POST['last_name'];
$morder->Email = $_POST['payer_email'];
//get address info if appropriate
if ($last_order->gateway == "paypal") {
$morder->Address1 = get_user_meta($last_order->user_id, "pmpro_baddress1", true);
$morder->City = get_user_meta($last_order->user_id, "pmpro_bcity", true);
$morder->State = get_user_meta($last_order->user_id, "pmpro_bstate", true);
$morder->CountryCode = "US";
$morder->Zip = get_user_meta($last_order->user_id, "pmpro_bzip", true);
$morder->PhoneNumber = get_user_meta($last_order->user_id, "pmpro_bphone", true);
$morder->billing->name = $_POST['first_name'] . " " . $_POST['last_name'];
$morder->billing->street = get_user_meta($last_order->user_id, "pmpro_baddress1", true);
$morder->billing->city = get_user_meta($last_order->user_id, "pmpro_bcity", true);
$morder->billing->state = get_user_meta($last_order->user_id, "pmpro_bstate", true);
$morder->billing->zip = get_user_meta($last_order->user_id, "pmpro_bzip", true);
$morder->billing->country = get_user_meta($last_order->user_id, "pmpro_bcountry", true);
$morder->billing->phone = get_user_meta($last_order->user_id, "pmpro_bphone", true);
//get CC info that is on file
$morder->cardtype = get_user_meta($last_order->user_id, "pmpro_CardType", true);
$morder->accountnumber = hideCardNumber(get_user_meta($last_order->user_id, "pmpro_AccountNumber", true), false);
$morder->expirationmonth = get_user_meta($last_order->user_id, "pmpro_ExpirationMonth", true);
$morder->expirationyear = get_user_meta($last_order->user_id, "pmpro_ExpirationYear", true);
$morder->ExpirationDate = $morder->expirationmonth . $morder->expirationyear;
$morder->ExpirationDate_YdashM = $morder->expirationyear . "-" . $morder->expirationmonth;
}
//figure out timestamp or default to none (today)
if (!empty($_POST['payment_date'])) {
$morder->timestamp = strtotime($_POST['payment_date']);
}
// Save the event ID for the last processed user/IPN (in case we want to be able to replay IPN requests)
$ipn_id = isset($_POST['ipn_track_id']) ? sanitize_text_field($_POST['ipn_track_id']) : null;
// Allow extraction of the IPN Track ID from the order notes (if needed)
$morder->notes = "{$morder->notes} [IPN_ID]{$ipn_id}[/IPN_ID]";
/**
* Post processing for a specific subscription related IPN event ID
*
* @param string $ipn_id - The ipn_track_id from the PayPal IPN request
* @param MemberOrder $morder - The completed Member Order object for the IPN request
*/
do_action('pmpro_subscription_ipn_event_processed', $ipn_id, $morder);
if (!is_null($ipn_id)) {
if (false === update_user_meta($morder->user_id, "pmpro_last_{$morder->gateway}_ipn_id", $ipn_id)) {
ipnlog("Unable to save the IPN event ID ({$ipn_id}) to usermeta for {$morder->user_id} ");
}
}
//save
$morder->saveOrder();
$morder->getMemberOrderByID($morder->id);
//email the user their invoice
$pmproemail = new PMProEmail();
$pmproemail->sendInvoiceEmail(get_userdata($last_order->user_id), $morder);
//hook for successful subscription payments
do_action("pmpro_subscription_payment_completed", $morder);
ipnlog("New order (" . $morder->code . ") created.");
return true;
} else {
ipnlog("Duplicate Transaction ID: " . $txn_id);
return false;
}
}
示例6: pmpro_payflow_recurring_orders
//.........这里部分代码省略.........
continue;
}
//check subscription
if (!empty($last_order->subscription_transaction_id)) {
echo "- Checking subscription #" . $last_order->subscription_transaction_id . ".<br />";
$status = pmpropfro_getSubscriptionPayments($last_order);
//find orders
$payments = pmpropfro_processPaymentHistory($status);
if (!empty($payments)) {
foreach ($payments as $payment) {
if ($payment['P_TRANSTATE'] == 1 || $payment['P_TRANSTATE'] == 11) {
echo "- Failed payment #" . $payment['P_PNREF'] . ".";
//check if we have this one already
$old_order = new MemberOrder();
$old_order->getMemberOrderByPaymentTransactionID($payment['P_PNREF']);
if (empty($old_order->id)) {
$failed_payment_emails[] = $user->user_email;
//not there yet, add it
$morder = new MemberOrder();
$morder->user_id = $last_order->user_id;
$morder->membership_id = $last_order->membership_id;
$morder->payment_transaction_id = $payment['P_PNREF'];
$morder->subscription_transaction_id = $last_order->subscription_transaction_id;
$morder->InitialPayment = $payment['P_AMT'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $payment['P_AMT'];
$morder->status = "error";
//save
$morder->saveOrder();
$morder->getMemberOrderByID($morder->id);
echo " Saving order.";
//this will affect the main query, so need to roll back the "end" 1 space
$end--;
//unless there is another non-failed payment more recent, cancel their membership
if (!pmpropfro_paymentAfter($payments, strtotime($payment['P_TRANSTIME']))) {
//cancel membership
pmpro_changeMembershipLevel(0, $user_id);
echo " Membership cancelled. Member emailed.";
//notify them
$myemail = new PMProEmail();
$myemail->sendCancelEmail($user);
} else {
echo " More recent successful order. So not cancelling membership.";
}
} else {
echo " Already logged.";
}
echo "<br />";
} elseif ($payment['P_TRANSTATE'] == 8) {
//check if we have this one already
$old_order = new MemberOrder();
$old_order->getMemberOrderByPaymentTransactionID($payment['P_PNREF']);
if (empty($old_order->id)) {
//not there yet, add it
$morder = new MemberOrder();
$morder->user_id = $last_order->user_id;
$morder->membership_id = $last_order->membership_id;
$morder->payment_transaction_id = $payment['P_PNREF'];
$morder->subscription_transaction_id = $last_order->subscription_transaction_id;
$morder->InitialPayment = $payment['P_AMT'];
//not the initial payment, but the class is expecting that
$morder->PaymentAmount = $payment['P_AMT'];
$morder->status = "success";
//save
$morder->saveOrder();
$morder->getMemberOrderByID($morder->id);
//this will affect the main query, so need to roll back the "end" 1 space
$end--;
if (!empty($morder->id)) {
//update the timestamp
$timestamp = date("Y-m-d H:i:s", strtotime($payment['P_TRANSTIME']));
$wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET timestamp = '" . $timestamp . "' WHERE id = '" . $morder->id . "' LIMIT 1");
echo "<strong>- Order added. #" . $morder->id . ".</strong><br />";
//email the user their invoice
$pmproemail = new PMProEmail();
$pmproemail->sendInvoiceEmail($user, $morder);
echo "- Invoice email sent to " . $user->user_email . ".";
} else {
echo "- Error adding order.";
}
} else {
echo "- Order already saved for #" . $payment['P_TRANSTATE'] . ".<br />";
}
} else {
echo "<strong>- Payment " . $payment['P_PNREF'] . " has status #" . $payment['P_TRANSTATE'] . " so not saving.</strong><br />";
}
}
} else {
echo "- No payments found.<br />";
}
}
echo "<hr />";
echo "Going to start with #" . $end . " next time.";
update_option('payflow_recurring_orders_cron_count', $end);
}
echo "<hr />";
foreach ($failed_payment_emails as $email) {
echo $email . "<br />";
}
}