Gravity Forms Checkout for Easy Digital Downloads  1.2.1
Integrate Gravity Forms purchases with Easy Digital Downloads
 All Classes Functions Pages
Public Member Functions | Public Attributes | List of all members
KWS_GF_EDD Class Reference

Public Member Functions

 __construct ()
 
 init ()
 
 get_payment_status_from_gf_status ($status)
 
 get_download_options_from_entry ($entry, $field, $download_id, $product, $option_name= '', $option_price=0)
 
 get_form_field_by_id ($id, $form)
 
 get_edd_data_array_from_entry ($entry, $form)
 
 get_user_info ($form, $entry)
 
 send_purchase_to_edd ($entry=null, $form)
 
 post_payment_callback ($entry=array(), $action=array(), $result=true)
 

Public Attributes

const version = '1.2.1'
 
const name = 'Gravity Forms Checkout'
 

Detailed Description

Plugin Name: Easy Digital Downloads - Gravity Forms Checkout Plugin URI: http://katz.co/downloads/edd-gf/ Description: Integrate Gravity Forms purchases with Easy Digital Downloads Author: Katz Web Services, Inc. Version: 1.2.1 Requires at least: 3.0 Author URI: http://katz.co License: GPL v3 Text Domain: edd-gf Domain Path: languages

Constructor & Destructor Documentation

KWS_GF_EDD::__construct ( )

Set constants, load textdomain, and trigger init() KWS_GF_EDD::init()

Member Function Documentation

KWS_GF_EDD::get_download_options_from_entry (   $entry,
  $field,
  $download_id,
  $product,
  $option_name = '',
  $option_price = 0 
)

Returns an options array for a download with variations.

This takes the submitted entry, the original GF form, and the EDD price variations and searches for matches to the price ID and the related amounts.

Parameters
array$entryGF Entry array
array$fieldGF Field array
int$download_idThe Download ID of the parent EDD download
float | int$field_idThe ID of the current field being processed
Returns
array An associative array with amount and price_id keys.
KWS_GF_EDD::get_edd_data_array_from_entry (   $entry,
  $form 
)

Take the submitted GF entry and form and generate an array of data for a new EDD order

This is the work horse for the plugin. It processes an array with the keys: cart_details, user_info, downloads.

Learn about how not to use logged-in user data array $entry GF Entry array array $form GF Form array todo 4. array Associative array with keys cart_details, user_info, downloads

KWS_GF_EDD::get_form_field_by_id (   $id,
  $form 
)

Get a field array from a Gravity Forms form by the ID of the field

Parameters
string | int$idNumber of the field ID
array$formGravity Forms form array
Returns
array|boolean Field array, if exists. False if not.
KWS_GF_EDD::get_payment_status_from_gf_status (   $status)

Make GF and EDD statuses match

Returns
array Existing statuses edd_gf_default_status Modify the default status when there's no status match. Default: pending. Passes default and $status arguments. edd_gf_payment_status Override the status when there is a match. Passes matched value and $status arguments.
Todo:
Ensure the default status is right when there's no status match.
KWS_GF_EDD::get_user_info (   $form,
  $entry 
)

Get user info from the entry

Parameters
array$formGravity Forms form array
array$entryGravity Forms entry array
Returns
array array with user data. Keys include: 'id' (int user ID), 'email' (string user email), 'first_name', 'last_name', 'discount' (empty)
KWS_GF_EDD::init ( )

Include the admin script and non-admin hooks

Todo:
Check for whether Gravity Forms exists.

Check for plugin updates. Built into EDD version 1.9+

KWS_GF_EDD::post_payment_callback (   $entry = array(),
  $action = array(),
  $result = true 
)

Update the payment status after payment is modified in Gravity Forms

$action = array( 'type' => 'cancel_subscription', // required 'transaction_id' => '', // required (if payment) 'subscription_id' => '', // required (if subscription) 'amount' => '0.00', // required (some exceptions) 'entry_id' => 1, // required (some exceptions) 'transaction_type' => '', 'payment_status' => '', 'note' => '' );

Parameters
array$entryGravity Forms entry array
array$actionArray describing the action (see method description above)
boolean$resultWhether the update was successful in GF edd_update_payment_status()
See Also
GFPaymentAddOn::process_callback_action()
Returns
void
KWS_GF_EDD::send_purchase_to_edd (   $entry = null,
  $form 
)

Take a GF submission and add a purcase to EDD.

This converts the GF submission to an EDD order.

GFFormsModel::get_lead() KWS_GF_EDD::get_edd_data_array_from_entry() KWS_GF_EDD::get_payment_status_from_gf_status() edd_update_payment_status() GFCommon::to_number() edd_insert_payment() edd_insert_payment_note()

Parameters
array$entryGF Entry array
array$formGF Form array

The documentation for this class was generated from the following file: