本文整理汇总了PHP中RGFormsModel::update_lead方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::update_lead方法的具体用法?PHP RGFormsModel::update_lead怎么用?PHP RGFormsModel::update_lead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::update_lead方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Save the order and return the order id
*
* If the order is new, then save all the order items and manage the inventory.
* If the order already exists, only the order data is updated. The order items and inventory
* remain unchanged.
*
* @return int The order id (primary key form database)
*/
public function save()
{
// If the order is already in the database, only save the order data, not the ordered items or anything else
if ($this->id > 0) {
$this->_db->update($this->_tableName, $this->_data, array('id' => $this->id));
} else {
// This is a new order so save the order items and deduct from inventory if necessary
$this->_orderInfo['ouid'] = md5($this->_orderInfo['trans_id'] . $this->_orderInfo['bill_address']);
$this->_db->insert($this->_tableName, $this->_orderInfo);
$this->id = $this->_db->insert_id;
$key = $this->_orderInfo['trans_id'] . '-' . $this->id . '-';
foreach ($this->_items as $item) {
// Deduct from inventory
Cart66Product::decrementInventory($item->getProductId(), $item->getOptionInfo(), $item->getQuantity());
$data = array('order_id' => $this->id, 'product_id' => $item->getProductId(), 'product_price' => $item->getProductPrice(), 'item_number' => $item->getItemNumber(), 'description' => $item->getFullDisplayName(), 'quantity' => $item->getQuantity(), 'duid' => md5($key . $item->getProductId()));
$formEntryIds = '';
$fIds = $item->getFormEntryIds();
if (is_array($fIds) && count($fIds)) {
foreach ($fIds as $entryId) {
if (class_exists('RGFormsModel')) {
if ($lead = RGFormsModel::get_lead($entryId)) {
$lead['status'] = 'active';
RGFormsModel::update_lead($lead);
}
}
}
$formEntryIds = implode(',', $fIds);
}
$data['form_entry_ids'] = $formEntryIds;
if ($item->getCustomFieldInfo()) {
$data['description'] .= "\n" . $item->getCustomFieldDesc() . ":\n" . $item->getCustomFieldInfo();
}
$orderItems = Cart66Common::getTableName('order_items');
$this->_db->insert($orderItems, $data);
$orderItemId = $this->_db->insert_id;
Cart66Common::log("Saved order item ({$orderItemId}): " . $data['description'] . "\nSQL: " . $this->_db->last_query);
}
}
return $this->id;
}
示例2: admin_update_payment
public static function admin_update_payment($form, $lead_id)
{
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
//update payment information in admin, need to use this function so the lead data is updated before displayed in the sidebar info section
//check meta to see if this entry is paypal
$payment_gateway = gform_get_meta($lead_id, "payment_gateway");
$form_action = strtolower(rgpost("save"));
if ($payment_gateway != "paypal" || $form_action != "update") {
return;
}
//get lead
$lead = RGFormsModel::get_lead($lead_id);
//get payment fields to update
$payment_status = rgpost("payment_status");
//when updating, payment status may not be editable, if no value in post, set to lead payment status
if (empty($payment_status)) {
$payment_status = $lead["payment_status"];
}
$payment_amount = rgpost("payment_amount");
$payment_transaction = rgpost("paypal_transaction_id");
$payment_date = rgpost("payment_date");
if (empty($payment_date)) {
$payment_date = gmdate("y-m-d H:i:s");
} else {
//format date entered by user
$payment_date = date("Y-m-d H:i:s", strtotime($payment_date));
}
global $current_user;
$user_id = 0;
$user_name = "System";
if ($current_user && ($user_data = get_userdata($current_user->ID))) {
$user_id = $current_user->ID;
$user_name = $user_data->display_name;
}
$lead["payment_status"] = $payment_status;
$lead["payment_amount"] = $payment_amount;
$lead["payment_date"] = $payment_date;
$lead["transaction_id"] = $payment_transaction;
// if payment status does not equal approved or the lead has already been fulfilled, do not continue with fulfillment
if ($payment_status == 'Approved' && !$lead["is_fulfilled"]) {
//call fulfill order, mark lead as fulfilled
self::fulfill_order($lead, $payment_transaction, $payment_amount);
$lead["is_fulfilled"] = true;
}
//update lead, add a note
RGFormsModel::update_lead($lead);
RGFormsModel::add_note($lead["id"], $user_id, $user_name, sprintf(__("Payment information was manually updated. Status: %s. Amount: %s. Transaction Id: %s. Date: %s", "gravityforms"), $lead["payment_status"], GFCommon::to_money($lead["payment_amount"], $lead["currency"]), $payment_transaction, $lead["payment_date"]));
}
示例3: start_subscription
private static function start_subscription($entry, $subscriber_id, $amount, $user_id, $user_name)
{
$entry["payment_status"] = "Active";
$entry["payment_amount"] = $amount;
$entry["payment_date"] = gmdate("y-m-d H:i:s");
$entry["transaction_id"] = $subscriber_id;
$entry["transaction_type"] = 2;
//subscription
if (!$entry["is_fulfilled"]) {
self::fulfill_order($entry, $subscriber_id, $amount);
$entry["is_fulfilled"] = true;
}
RGFormsModel::update_lead($entry);
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has been created. Subscriber Id: %s", "gravityforms"), $subscriber_id));
}
示例4: gravityFormToCart
public function gravityFormToCart($entry)
{
if (CART66_PRO) {
$formId = Cart66GravityReader::getGravityFormIdForEntry($entry['id']);
if ($formId) {
$productId = Cart66Product::getProductIdByGravityFormId($formId);
if ($productId > 0) {
$product = new Cart66Product($productId);
$qty = $product->gravityCheckForEntryQuantity($entry);
$options = $product->gravityGetVariationPrices($entry);
$productUrl = Cart66Common::getCurrentPageUrl();
$cart = Cart66Session::get('Cart66Cart');
$item = $cart->addItem($productId, $qty, $options, $entry['id'], $productUrl, false, true);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Cart Item Value: " . print_r($item, true));
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Should we use the gravity forms price? " . $product->gravity_form_pricing . ' :: Session value: ' . Cart66Session::get('userPrice_' . $product->id));
if ($product->gravity_form_pricing == 1) {
$price = Cart66GravityReader::getPrice($entry['id']) / $qty;
$entry_id = $item->getFirstFormEntryId();
$user_price_name = 'userPrice_' . $productId . '_' . $entry_id;
Cart66Session::set($user_price_name, $price, true);
// Setting the price of a Gravity Forms pricing product
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Using gravity forms pricing for product: Price: {$price} :: Name: " . $product->name . " :: Session variable name: {$user_price_name}");
}
$cartPage = get_page_by_path('store/cart');
$cartPageLink = get_permalink($cartPage->ID);
Cart66Session::set('Cart66LastPage', $_SERVER['HTTP_REFERER']);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Cart66 Session Dump: " . Cart66Session::dump());
if (!Cart66Setting::getValue('display_form_entries_before_sale')) {
$entry["status"] = 'unpaid';
}
RGFormsModel::update_lead($entry);
$cart->applyAutoPromotions();
do_action('cart66_after_add_to_cart', $product, $qty);
wp_redirect($cartPageLink);
exit;
}
}
}
}
示例5: cancel_subscription
private static function cancel_subscription($lead)
{
$lead["payment_status"] = "Canceled";
RGFormsModel::update_lead($lead);
//loading data class
$feed_id = gform_get_meta($lead["id"], "authorize.net_feed_id");
require_once self::get_base_path() . "/data.php";
$config = GFAuthorizeNetData::get_feed($feed_id);
if (!$config) {
return;
}
//1- delete post or mark it as a draft based on configuration
if (rgars($config, "meta/update_post_action") == "draft" && !rgempty("post_id", $lead)) {
$post = get_post($lead["post_id"]);
$post->post_status = 'draft';
wp_update_post($post);
} else {
if (rgars($config, "meta/update_post_action") == "delete" && !rgempty("post_id", $lead)) {
wp_delete_post($lead["post_id"]);
}
}
//2- call subscription canceled hook
do_action("gform_subscription_canceled", $lead, $config, $lead["transaction_id"], "authorize.net");
}
示例6: process_subscription_canceled
protected function process_subscription_canceled($entry, $feed)
{
//Updating entry payment status
$entry["payment_status"] = "Canceled";
RGFormsModel::update_lead($entry);
//Delete post or mark it as a draft based on feed configuration
if (rgars($feed, "meta/update_post_action") == "draft" && !rgempty("post_id", $entry)) {
$post = get_post($entry["post_id"]);
$post->post_status = 'draft';
wp_update_post($post);
} else {
if (rgars($feed, "meta/update_post_action") == "delete" && !rgempty("post_id", $entry)) {
wp_delete_post($entry["post_id"]);
}
}
}
示例7: saveOrder
//.........这里部分代码省略.........
list($itemId, $formEntryId) = explode(':', $f);
$gfIds[$itemId] = $formEntryId;
}
}
// Look for discount amount
$discount = 0;
if (isset($pp['discount'])) {
$discount = $pp['discount'];
}
// Look for coupon code
$coupon_code = "none";
if (isset($coupon) && $coupon != "") {
$coupon_code = $coupon;
}
$data = array('bill_first_name' => $pp['first_name'], 'bill_last_name' => $pp['last_name'], 'bill_address' => $pp['address_street'], 'bill_city' => $pp['address_city'], 'bill_state' => $pp['address_state'], 'bill_zip' => $pp['address_zip'], 'bill_country' => $pp['address_country'], 'ship_first_name' => $pp['address_name'], 'ship_address' => $pp['address_street'], 'ship_city' => $pp['address_city'], 'ship_state' => $pp['address_state'], 'ship_zip' => $pp['address_zip'], 'ship_country' => $pp['address_country'], 'shipping_method' => $deliveryMethod, 'email' => $pp['payer_email'], 'phone' => $pp['contact_phone'], 'shipping' => $pp['mc_handling'], 'tax' => $pp['tax'], 'subtotal' => $subtotal, 'total' => $pp['mc_gross'], 'coupon' => $coupon_code, 'discount_amount' => $discount, 'trans_id' => $pp['txn_id'], 'ordered_on' => date('Y-m-d H:i:s', Cart66Common::localTs()), 'status' => $status, 'ouid' => $ouid);
$data = Cart66Common::deNullArrayValues($data);
// Verify the first items in the IPN are for products managed by Cart66. It could be an IPN from some other type of transaction.
$productsTable = Cart66Common::getTableName('products');
$orderItemsTable = Cart66Common::getTableName('order_items');
$sql = "SELECT id from {$productsTable} where item_number = '" . $pp['item_number1'] . "'";
$productId = $wpdb->get_var($sql);
if (!$productId) {
throw new Exception("This is not an IPN that should be managed by Cart66");
}
// Look for the 100% coupons shipping item and move it back to a shipping costs rather than a product
if ($data['shipping'] == 0) {
for ($i = 1; $i <= $numCartItems; $i++) {
$itemNumber = strtoupper($pp['item_number' . $i]);
if ($itemNumber == 'SHIPPING') {
$data['shipping'] = isset($pp['mc_gross_' . $i]) ? $pp['mc_gross_' . $i] : $pp['mc_gross' . $i];
}
}
}
$wpdb->insert($orderTable, $data);
$orderId = $wpdb->insert_id;
$product = new Cart66Product();
for ($i = 1; $i <= $numCartItems; $i++) {
$sql = "SELECT id from {$productsTable} where item_number = '" . $pp['item_number' . $i] . "'";
$productId = $wpdb->get_var($sql);
if ($productId > 0) {
$product->load($productId);
// Decrement inventory
$info = $pp['item_name' . $i];
if (strpos($info, '(') > 0) {
$info = strrchr($info, '(');
$start = strpos($info, '(');
$end = strpos($info, ')');
$length = $end - $start;
$variation = substr($info, $start + 1, $length - 1);
Cart66Common::log("PayPal Variation Information: {$variation}\n{$info}");
}
$qty = $pp['quantity' . $i];
Cart66Product::decrementInventory($productId, $variation, $qty);
if ($hasDigital == false) {
$hasDigital = $product->isDigital();
}
// PayPal is not consistent in the way it passes back the item amounts
$amt = 0;
if (isset($pp['mc_gross' . $i])) {
$amt = $pp['mc_gross' . $i];
} elseif (isset($pp['mc_gross_' . $i])) {
$amt = $pp['mc_gross_' . $i] / $pp['quantity' . $i];
}
// Look for Gravity Form Entry ID
$formEntryId = '';
if (is_array($gfIds) && !empty($gfIds) && isset($gfIds[$i])) {
$formEntryId = $gfIds[$i];
if (class_exists('RGFormsModel')) {
if ($lead = RGFormsModel::get_lead($formEntryId)) {
$lead['status'] = 'active';
RGFormsModel::update_lead($lead);
}
}
}
$duid = md5($pp['txn_id'] . '-' . $orderId . '-' . $productId);
$data = array('order_id' => $orderId, 'product_id' => $productId, 'item_number' => $pp['item_number' . $i], 'product_price' => $amt, 'description' => $pp['item_name' . $i], 'quantity' => $pp['quantity' . $i], 'duid' => $duid, 'form_entry_ids' => $formEntryId);
$wpdb->insert($orderItemsTable, $data);
}
}
// Handle email receipts
if (CART66_PRO && CART66_EMAILS && Cart66Setting::getValue('enable_advanced_notifications') == 1) {
$notify = new Cart66AdvancedNotifications($orderId);
$notify->sendAdvancedEmailReceipts();
} elseif (CART66_EMAILS) {
$notify = new Cart66Notifications($orderId);
$notify->sendEmailReceipts();
}
$promotion = new Cart66Promotion();
$promotion->loadByCode($coupon_code);
if ($promotion) {
$promotion->updateRedemptions();
}
// Process affiliate reward if necessary
if ($referrer) {
Cart66Common::awardCommission($orderId, $referrer);
}
}
// end transaction id check
}
}
示例8: gform_entry_created
/**
* Save payment information to DB
*
* @since 1.7.9.1
*
* @uses rgar()
* @uses GFCommon::get_currency()
* @uses rgpost()
* @uses RGFormsModel::get_lead_details_table_name()
* @uses wpdb->prepare()
* @uses wpdb->get_results()
* @uses RGFormsModel::get_lead_detail_id()
* @uses wpdb->update()
* @uses wpdb->insert()
* @uses RGFormsModel::update_lead()
* @uses apply_filters()
* @uses GFP_Stripe::get_feed()
* @uses gform_update_meta()
* @uses GFP_Stripe_Data::insert_transaction()
*
* @param $entry
* @param $form
*
* @return void
*/
public function gform_entry_created($entry, $form)
{
global $wpdb;
$entry_id = rgar($entry, 'id');
if (!empty(self::$transaction_response)) {
//Current Currency
$currency = GFCommon::get_currency();
$transaction_id = self::$transaction_response['transaction_id'];
$transaction_type = self::$transaction_response['transaction_type'];
$amount = array_key_exists('amount', self::$transaction_response) ? self::$transaction_response['amount'] : null;
$payment_date = gmdate('Y-m-d H:i:s');
$entry['currency'] = $currency;
if ('1' == $transaction_type) {
$entry['payment_status'] = 'Approved';
} else {
$entry['payment_status'] = 'Active';
}
$entry['payment_amount'] = $amount;
$entry['payment_date'] = $payment_date;
$entry['transaction_id'] = $transaction_id;
$entry['transaction_type'] = $transaction_type;
$entry['is_fulfilled'] = true;
//save card type since it gets stripped
$form_id = $entry['form_id'];
foreach ($form['fields'] as $field) {
if ('creditcard' == $field['type']) {
$creditcard_field_id = $field['id'];
}
}
$card_type_name = "input_" . $creditcard_field_id . "_4";
$card_type_id = $creditcard_field_id . ".4";
$card_type_value = rgpost($card_type_name);
$card_type_value = substr($card_type_value, 0, GFORMS_MAX_FIELD_LENGTH);
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
$current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $entry_id));
$lead_detail_id = RGFormsModel::get_lead_detail_id($current_fields, $card_type_id);
if ($lead_detail_id > 0) {
$wpdb->update($lead_detail_table, array('value' => $card_type_value), array('id' => $lead_detail_id), array("%s"), array("%d"));
} else {
$wpdb->insert($lead_detail_table, array('lead_id' => $entry_id, 'form_id' => $form['id'], 'field_number' => $card_type_id, 'value' => $card_type_value), array("%d", "%d", "%f", "%s"));
}
$entry = apply_filters('gfp_stripe_entry_created_update_lead', $entry, self::$transaction_response);
RGFormsModel::update_lead($entry);
//saving feed id
$feed = self::$_this->get_feed($form);
gform_update_meta($entry_id, 'Stripe_feed_id', $feed['id']);
//updating form meta with current payment gateway
gform_update_meta($entry_id, 'payment_gateway', 'stripe');
$subscriber_id = apply_filters('gfp_stripe_entry_created_subscriber_id', '', self::$transaction_response, $entry);
GFP_Stripe_Data::insert_transaction($entry['id'], apply_filters('gfp_stripe_entry_created_insert_transaction_type', 'payment', $transaction_type), $subscriber_id, $transaction_id, $amount);
}
}
示例9: saveMijirehOrder
public function saveMijirehOrder($order_number)
{
global $wpdb;
// Make sure the order is not already in the database
$orders_table = Cart66Common::getTableName('orders');
$sql = "select id from {$orders_table} where trans_id = %s";
$sql = $wpdb->prepare($sql, $order_number);
$order_id = $wpdb->get_var($sql);
if (!$order_id) {
// Save the order
$order = new Cart66Order();
$cloud_order = $this->pullOrder($order_number);
$order_data = $this->buildOrderDataArray($cloud_order);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Order data: " . print_r($order_data, true));
$order_data = Cart66Common::deNullArrayValues($order_data);
$order_id = $order->rawSave($order_data);
// Save the order items
$order_items_table = Cart66Common::getTableName('order_items');
foreach ($cloud_order['items'] as $key => $item) {
$product = new Cart66Product();
$product->loadByItemNumber($item['sku']);
$data = array('order_id' => $order_id, 'product_id' => $product->id, 'product_price' => $item['price'], 'item_number' => $item['sku'], 'description' => $item['name'], 'quantity' => $item['quantity'], 'duid' => md5($order_id . $item['sku']));
// Look for gravity forms data
if (isset($cloud_order['meta_data'][$key]['gforms_' . $item['sku']])) {
$data['form_entry_ids'] = $cloud_order['meta_data'][$key]['gforms_' . $item['sku']];
}
$fIds = array();
if (isset($data['form_entry_ids'])) {
$fIds = explode(',', $data['form_entry_ids']);
if (is_array($fIds) && count($fIds)) {
foreach ($fIds as $entryId) {
if (class_exists('RGFormsModel')) {
if ($lead = RGFormsModel::get_lead($entryId)) {
$lead['status'] = 'active';
RGFormsModel::update_lead($lead);
}
}
}
}
}
$data = Cart66Common::deNullArrayValues($data);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Trying to save this order item:" . print_r($data, true));
$wpdb->insert($order_items_table, $data);
$order_item_id = $wpdb->insert_id;
// Decrement inventory after sale
if (Cart66Setting::getValue('track_inventory') == 1) {
$option_info = '';
if (isset($cloud_order['meta_data']['options_' . $item['sku']])) {
$option_info = $cloud_order['meta_data']['options_' . $item['sku']];
}
Cart66Product::decrementInventory($data['product_id'], $option_info, $data['quantity']);
}
// Look for membership product upgrades/extensions
if (isset($cloud_order['meta_data']['account_id']) && is_numeric($cloud_order['meta_data']['account_id'])) {
$order->load($order_id);
$account_id = $cloud_order['meta_data']['account_id'];
if ($mp = $order->getMembershipProduct()) {
$account = new Cart66Account();
$account->load($account_id);
$account->attachMembershipProduct($mp, $account->firstName, $account->lastName);
$order->account_id = $account->id;
$order->save();
}
}
}
//update the number of redemptions for the promotion code.
if (Cart66Session::get('Cart66Promotion')) {
Cart66Session::get('Cart66Promotion')->updateRedemptions();
}
// Send email receipts
if (CART66_PRO && CART66_EMAILS && Cart66Setting::getValue('enable_advanced_notifications') == 1) {
$notify = new Cart66AdvancedNotifications($order_id);
$notify->sendAdvancedEmailReceipts();
} elseif (CART66_EMAILS) {
$notify = new Cart66Notifications($order_id);
$notify->sendEmailReceipts();
}
//Cart66Common::sendEmailReceipts($order_id);
}
// Redirect to receipt page
$this->goToReceipt($order_id);
}
示例10: set_payment_status
public static function set_payment_status($config, $entry, $status, $transaction_type, $transaction_id, $subscriber_id, $amount, $profile_status, $period_type, $initial_payment_status, $initial_payment_amount, $initial_payment_transaction_id, $parent_transaction_id, $reason_code)
{
global $current_user;
$user_id = 0;
$user_name = "System";
if ($current_user && ($user_data = get_userdata($current_user->ID))) {
$user_id = $current_user->ID;
$user_name = $user_data->display_name;
}
switch (strtolower($transaction_type)) {
case "recurring_payment_profile_created":
if ($profile_status == "Active" && $entry["payment_status"] == "Pending") {
//Adding note
RGFormsModel::add_note($entry["id"], $user_id, $user_name, __("Pending profile has been approved by PayPal and this subscription has been marked as Active.", "gravityformspaypalpro"));
//Marking entry as Active
$entry["payment_status"] = "Active";
RGFormsModel::update_lead($entry);
//Update transaction with transaction_id and payment amount
$transactions = GFPayPalProData::get_transactions("signup", $subscriber_id);
if (count($transactions) > 0) {
$transaction = $transactions[0];
$transaction["transaction_id"] = rgpost("initial_payment_txn_id");
$transaction["amount"] = rgpost("initial_payment_amount");
GFPayPalProData::update_transaction($transaction);
} else {
//this shoulndn't happen, but create a new transaction if one isn't there
$feed_id = gform_get_meta($entry["id"], "paypalpro_feed_id");
GFPayPalProData::insert_transaction($entry["id"], $feed_id, "signup", $subscriber_id, $transaction_id, $parent_transaction_id, $initial_payment_amount);
}
//fulfilling order
self::fulfill_order($entry, $subscriber_id, $initial_payment_amount, $amount);
}
break;
case "recurring_payment":
if ($amount != 0) {
$do_fulfillment = false;
if ($profile_status == "Active") {
if ($period_type == "Trial") {
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Trial payment has been made. Amount: %s. Transaction Id: %s", "gravityforms"), GFCommon::to_money($amount, $entry["currency"]), $transaction_id));
} else {
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription payment has been made. Amount: %s. Transaction Id: %s", "gravityforms"), GFCommon::to_money($amount, $entry["currency"]), $transaction_id));
}
//Setting entry to Active
if ($entry["payment_status"] == "Pending") {
RGFormsModel::add_note($entry["id"], $user_id, $user_name, __("Pending profile has been approved by PayPal and this subscription has been marked as Active.", "gravityformspaypalpro"));
$entry["payment_status"] = "Active";
$do_fulfillment = true;
}
} else {
if ($profile_status == "Expired") {
$entry["payment_status"] = "Expired";
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has successfully completed its billing schedule. Subscriber Id: %s", "gravityformspaypalpro"), $subscriber_id));
}
}
RGFormsModel::update_lead($entry);
GFPayPalProData::insert_transaction($entry["id"], $config["id"], "payment", $subscriber_id, $transaction_id, $parent_transaction_id, $amount);
//fulfilling order
if ($do_fulfillment) {
self::fulfill_order($entry, $subscriber_id, $initial_payment_amount, $amount);
}
}
break;
case "recurring_payment_failed":
if ($profile_status == "Active") {
$entry["payment_status"] = "Failed";
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription payment failed due to a transaction decline, rejection, or error. The gateway will retry to collect payment in the next billing cycle. Subscriber Id: %s", "gravityforms"), $subscriber_id));
} else {
if ($profile_status == "Suspended") {
$entry["payment_status"] = "Failed";
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription payment failed due to a transaction decline, rejection, or error. Subscriber Id: %s", "gravityformspaypalpro"), $subscriber_id));
}
}
RGFormsModel::update_lead($entry);
break;
case "recurring_payment_profile_cancel":
$entry["payment_status"] = "Cancelled";
RGFormsModel::update_lead($entry);
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has been cancelled. Subscriber Id: %s", "gravityformspaypalpro"), $subscriber_id));
break;
case "recurring_payment_suspended_due_to_max_failed_payment":
$entry["payment_status"] = "Failed";
RGFormsModel::update_lead($entry);
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription is currently suspended as it exceeded maximum number of failed payments allowed. Subscriber Id: %s", "gravityformspaypalpro"), $subscriber_id));
break;
default:
//handles products and donation
switch (strtolower($status)) {
case "reversed":
//self::$log->LogDebug("Processing reversal.");
if ($entry["payment_status"] != "Reversed") {
if ($entry["transaction_type"] == 1) {
$entry["payment_status"] = "Reversed";
////self::$log->LogDebug("Setting entry as Reversed");
RGFormsModel::update_lead($entry);
}
RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Payment has been reversed. Transaction Id: %s. Reason: %s", "gravityformspaypalpro"), $transaction_id, self::get_reason($reason_code)));
}
GFPayPalProData::insert_transaction($entry["id"], $config["id"], "reversal", $subscriber_id, $transaction_id, $parent_transaction_id, $amount);
break;
case "canceled_reversal":
//.........这里部分代码省略.........