Skip to content

Commit

Permalink
Version 1.10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Jul 21, 2014
0 parents commit f7b9004
Show file tree
Hide file tree
Showing 16 changed files with 4,673 additions and 0 deletions.
184 changes: 184 additions & 0 deletions change_log.txt
@@ -0,0 +1,184 @@
------------------------------------------------------------
Version 1.10.3
- Fixed issue where post wasn't getting created when option to "only create post when payment is received" was active and payment total was $0.00

------------------------------------------------------------
Version 1.10.2
- Fixed notices when using coupons

------------------------------------------------------------
Version 1.10.1
- Fixed issue where posts were not being created if the feed were inactive with the setting to delay post creation having been previously checked

------------------------------------------------------------
Version 1.10
- Updated the number of recurring times maximum from 30 to 52 per PayPal documentation
- Fixed issue where floating point comparision was failing in GFPayPal::is_valid_initial_payment_amount()
- Added new hook: 'gform_paypal_ipn_{transaction_type}'; allows users to easily hook into the specific IPN transactions they need
- Fixed issue with notifications not being sent when setting "only show notifications when payment is received" is enabled and payment is $0.00

------------------------------------------------------------
Version 1.9
- Fixed notice message
- Fixed issue where upgrade class was not always included when PayPal details are written on the plugins page
- Updated IPN verification script to use HTTP 1.1 in response to PayPal's change

------------------------------------------------------------
Version 1.8
- Updated automatic upgrade so that it caches remote requests for 12 hours (even on plugin's page)
- Fixed issue with redirecting back from PayPal that takes users to the wrong confirmation page on some occasions

------------------------------------------------------------
Version 1.7
- Fixed issue where submission still went to PayPal regardless of the feed being inactive
- Fixed issue where changing the form on an existing feed did not save the change
- Fixed error on entry info box (entry detail page) when editing entries
- Fixed issue that ignored discounts when total (product + discount) added up to zero.
- Fixed notice message

------------------------------------------------------------
Version 1.6
- Updated "return mode" parameter so that it is a redirect for non-secure pages to avoid security warning message when returning from PayPal to the site
- Added gform_paypal_request filter to allow entire request to PayPal to be filtered
- Fixed issue where null responses from upgrader resulted in several notices
- Updated ajax calls to not send a cookie to prevent calls to admin-ajax.php being aborted for some users
- Added support for new notification structure (for delayed notification setting) in preparation for Gravity Forms 1.7 release while maintaining backwards compatibility with current released version
- Fixed issue which caused the admin IPN setting to not always remain checked/unchecked
- Fixed issue with feed creating throwing javascript errors and displaying the wrong notification UI
- Updated URL to ajax page so that it uses the built-in WordPress ajaxurl variable
- Fixed issue with detecting if page is under SSL which caused return URL to be invalid.
- Updated process to correctly save the config ID used to process the entry in the entry meta
- Updated process to retrieve config by entry
- Added amount validation as an extra IPN security check. Entry will only be marked as Approved/Active if payment amount matches product/subscription amount
- Fixed issue where orders with discounts greater than the total were still being sent to PayPal
- Added additional logging for reasons why the transaction wasn't sent to PayPal (no config, $0 price)
- Fixed issue with tooltip script being included in every page

------------------------------------------------------------
Version 1.5
- Added support for negative line items.
- Fixed error message which still referred to Donation fields
- Added new hook: "gform_paypal_get_feeds", allows the filtering of return configuration feeds
- Updated logging to use the GF Logging plugin
- Fixed issue with "business" variable not being sent via the IPN message
- Added new conditional logic options (greater than, less than, contains starts with, ends with) and support for other conditional fields
- Fixed notices
- Added ability to edit payment status when not set to Approved and not a subscription
- Added ability to edit payment details (amount, transaction id, date) for all payments types

------------------------------------------------------------
Version 1.4
- Added additional log messages
- Increased timeout value used when sending IPN message to PayPal for validation
- Added feed_id and gateway type to entry meta to facilitate integration with other Add-Ons
- Fixed notice
- Added logging support
- Added support for multiple feeds to be created for a form. Feed to be executed will be determined by the configured Feed Condition when the form is submitted
- Fixed issue where RG_CURRENT_PAGE constant was not available when GF is deactivated
- Updated get_product_query_string() to include quantity when calculating the total
- Fixed issue with drop down values being displayed on PayPal pages, instead of text
- Added function rgars() if it does not already exist

------------------------------------------------------------
Version 1.3.1
- Added function rgars() if it does not already exist

------------------------------------------------------------
Version 1.3
- Fixed issue with delay notification and delay post settings not behaving correctly when paypal condition is not met
- Fixed notice messages
- Changed PayPal request to add charset=UTF-8 variable
- Added currency.js file to remove dependency on script from Gravity Forms
- Fixed issue on validation that failed when emails had extra blank spaces
- Added support for sending product fields to PayPal when feed is a donation
- Added support for using Form Total as an option for the recurring amount
- Changed CURL's setting to disable SSL peer validation
- Fixed UI issue on feeds page that displayed the "Add New" button when PayPal was not configured
- Fixed issue with notification settings not displaying the saved values correctly

------------------------------------------------------------
Version 1.2
- Cleaned up notices
- Fixed issue when using condition on a field with multiple single quote characters in the label
- Fixed issue when creating a feed using forms with HTML markup in field labels
- Fixed database index error when upgrading plugin

------------------------------------------------------------
Version 1.1.1
- Cleaned up Notice debug messages

------------------------------------------------------------
Version 1.1
- Fixed issue with delay notification hooks causing emails to be sent in the wrong time when the "send email after payment is received" option is enabled

------------------------------------------------------------
Version 1.0.beta6.2
- Added "gform_paypal_config_validation" hook to validate custom options created for the PayPal feed
- Updated PayPal config validation code to support muliple validation errors
- Renamed "gforms_paypal_save_config" to "gform_paypal_save_config"
- Removed extraneous code

------------------------------------------------------------
Version 1.0.beta6.1
- Added a hook to allow users to modify the query string sent to PayPal: gform_paypal_query
add_filter("gform_paypal_query_12", "update_paypal_query", 10, 3);
function update_paypal_query($query_string, $form, $entry){
return $query_string;
}
- Added "Cancel" button to the Edit page

------------------------------------------------------------
Version 1.0.beta6
- Fixed issue with thank you page displaying "Oops, could not locate your form" message when coming back from Paypal.
- Fixed issue with IPN not locating entry properly

------------------------------------------------------------
Version 1.0.beta5
- Fixed issue where recurring times were not reflecting changes made to PayPal feed
- Defaulting invoice id to blank. It can be specified if needed via the gform_paypal_invoice hook
- Fixed issue where recurring times were not getting sent to paypal

------------------------------------------------------------
Version 1.0.beta4
- Changed invoice number so that is has a unique number appended to it.
- Added a hook to allow users to change the invoice number
add_filter("gform_paypal_invoice", "change_invoice", 10, 3);
function change_invoice($invoice_id, $form, $entry){
return $entry["id"];
}

-----------------------------------------------------------
Version 1.0.beta3
- Added javascript form object as a parameter for the "paypalFormSelected" jQuery action

-----------------------------------------------------------
Version 1.0.beta2
- Added condition so that PayPal can be bypassed based on selected values in the form
- Bypassing PayPal if there are no products selected

-----------------------------------------------------------
Version 0.9
- displaying summary boxes even when graph is empty
- added disclaimer for free trials and no payments
- fixed issue with double fulfillment for subscriptions with paid trials

-----------------------------------------------------------
Version 0.8
- added transaction table and modified graph to pull data from it

-----------------------------------------------------------
Version 0.7
- added suppport for shipping field

-----------------------------------------------------------
Version 0.6
- added option to change post status after subscription is cancelled

-----------------------------------------------------------
Version 0.5
- added graphical stats page
- added link to entries page
-----------------------------------------------------------
Version 0.4
- added tooltips to admin page
- implemented confirmation when returning from paypal
197 changes: 197 additions & 0 deletions data.php
@@ -0,0 +1,197 @@
<?php
class GFPayPalData{

public static function update_table(){
global $wpdb;
$table_name = self::get_paypal_table_name();

if ( ! empty($wpdb->charset) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate) )
$charset_collate .= " COLLATE $wpdb->collate";

require_once(ABSPATH . '/wp-admin/includes/upgrade.php');

$sql = "CREATE TABLE $table_name (
id mediumint(8) unsigned not null auto_increment,
form_id mediumint(8) unsigned not null,
is_active tinyint(1) not null default 1,
meta longtext,
PRIMARY KEY (id),
KEY form_id (form_id)
)$charset_collate;";

dbDelta($sql);

$table_name = self::get_transaction_table_name();
$sql = "CREATE TABLE $table_name (
id mediumint(8) unsigned not null auto_increment,
entry_id int(10) unsigned not null,
transaction_type varchar(15),
subscription_id varchar(50),
transaction_id varchar(50),
parent_transaction_id varchar(50),
is_renewal tinyint(1) not null default 0,
amount decimal(19,2),
date_created datetime,
PRIMARY KEY (id),
KEY txn_id (transaction_id)
)$charset_collate;";

dbDelta($sql);

}

public static function insert_transaction($entry_id, $transaction_type, $subscription_id, $transaction_id, $parent_transaction_id, $amount){
global $wpdb;
$table_name = self::get_transaction_table_name();

if(empty($parent_transaction_id))
$parent_transaction_id = $transaction_id;

$existing_transaction_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM $table_name WHERE transaction_id=%s", $transaction_id));

if(!$existing_transaction_id){

$is_renewal = 0;
if(!empty($subscription_id)){
$count = $wpdb->get_var($wpdb->prepare("SELECT count(id) FROM $table_name WHERE subscription_id=%s", $transaction_id));
if($count > 0)
$is_renewal = 1;
}

$sql = $wpdb->prepare(" INSERT INTO $table_name (entry_id, transaction_type, subscription_id, transaction_id, parent_transaction_id, amount, is_renewal, date_created)
values(%d, %s, %s, %s, %s, %f, %d, utc_timestamp())", $entry_id, $transaction_type, $subscription_id, $transaction_id, $parent_transaction_id, $amount, $is_renewal);
$wpdb->query($sql);
$id = $wpdb->insert_id;
}
else{
$id = $existing_transaction_id;
}

return $id;
}


public static function get_transaction_totals($form_id){
global $wpdb;
$lead_table_name = RGFormsModel::get_lead_table_name();
$transaction_table_name = self::get_transaction_table_name();

$sql = $wpdb->prepare(" SELECT t.transaction_type, sum(t.amount) revenue, count(t.id) transactions
FROM {$transaction_table_name} t
INNER JOIN {$lead_table_name} l ON l.id = t.entry_id
WHERE l.form_id={$form_id}
GROUP BY t.transaction_type", $form_id);

$results = $wpdb->get_results($sql, ARRAY_A);
$totals = array();
if(is_array($results)){
foreach($results as $result){
$totals[$result["transaction_type"]] = array("revenue" => empty($result["revenue"]) ? 0 : $result["revenue"] , "transactions" => empty($result["transactions"]) ? 0 : $result["transactions"]);
}
}

return $totals;
}

public static function get_paypal_table_name(){
global $wpdb;
return $wpdb->prefix . "rg_paypal";
}

public static function get_transaction_table_name(){
global $wpdb;
return $wpdb->prefix . "rg_paypal_transaction";
}

public static function get_feeds(){
global $wpdb;
$table_name = self::get_paypal_table_name();
$form_table_name = RGFormsModel::get_form_table_name();
$sql = "SELECT s.id, s.is_active, s.form_id, s.meta, f.title as form_title
FROM $table_name s
INNER JOIN $form_table_name f ON s.form_id = f.id";

$results = $wpdb->get_results($sql, ARRAY_A);

$count = sizeof($results);
for($i=0; $i<$count; $i++){
$results[$i]["meta"] = maybe_unserialize($results[$i]["meta"]);
}

return $results;
}

public static function delete_feed($id){
global $wpdb;
$table_name = self::get_paypal_table_name();
$wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE id=%s", $id));
}

public static function get_feed_by_form($form_id, $only_active = false){
global $wpdb;
$table_name = self::get_paypal_table_name();
$active_clause = $only_active ? " AND is_active=1" : "";
$sql = $wpdb->prepare("SELECT id, form_id, is_active, meta FROM $table_name WHERE form_id=%d $active_clause", $form_id);
$results = $wpdb->get_results($sql, ARRAY_A);
if(empty($results))
return array();

//Deserializing meta
$count = sizeof($results);
for($i=0; $i<$count; $i++){
$results[$i]["meta"] = maybe_unserialize($results[$i]["meta"]);
}
return apply_filters("gform_paypal_get_feeds_{$form_id}", apply_filters('gform_paypal_get_feeds', $results, $form_id), $form_id);
}

public static function get_feed($id){
global $wpdb;
$table_name = self::get_paypal_table_name();
$sql = $wpdb->prepare("SELECT id, form_id, is_active, meta FROM $table_name WHERE id=%d", $id);
$results = $wpdb->get_results($sql, ARRAY_A);
if(empty($results))
return array();

$result = $results[0];
$result["meta"] = maybe_unserialize($result["meta"]);
return $result;
}

public static function update_feed($id, $form_id, $is_active, $setting){
global $wpdb;
$table_name = self::get_paypal_table_name();
$setting = maybe_serialize($setting);
if($id == 0){
//insert
$wpdb->insert($table_name, array("form_id" => $form_id, "is_active"=> $is_active, "meta" => $setting), array("%d", "%d", "%s"));
$id = $wpdb->get_var("SELECT LAST_INSERT_ID()");
}
else{
//update
$wpdb->update($table_name, array("form_id" => $form_id, "is_active"=> $is_active, "meta" => $setting), array("id" => $id), array("%d", "%d", "%s"), array("%d"));
}

return $id;
}

public static function drop_tables(){
global $wpdb;
$wpdb->query("DROP TABLE IF EXISTS " . self::get_paypal_table_name());
}

// get forms that are not assigned to feeds
public static function get_available_forms($active_form = ''){

$forms = RGFormsModel::get_forms();
$available_forms = array();

foreach($forms as $form) {
$available_forms[] = $form;
}

return $available_forms;
}
}
?>
1 change: 1 addition & 0 deletions flot/jquery.flot.min.js

Large diffs are not rendered by default.

Binary file added images/active0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/active1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/loading.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/paypal_wordpress_icon_32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/remove.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tick.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tooltip_tip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f7b9004

Please sign in to comment.