G’day Gary,
I’ve tested the filters, and they do set the invoice description and invoice reference in the Customer Details section.
I’ve just added a new filter for setting the invoice transaction reference in the Transaction Details section: “gfeway_invoice_trans_number”.
NB: this field is limited to only 16 characters (eWAY intends it to hold an invoice number or similar), so you probably want to use “gfeway_invoice_ref” anyway as that can hold up to 255 characters.
Here’s some code that sets all three, from fields in the form:
/**
* filter the eWAY invoice description for a Gravity Form post
* @param string $desc the description before filtering
* @param array $form the Gravity Form object
* @return string
*/
function test_gfeway_invoice_desc($desc, $form) {
// set by named field
foreach($form['fields'] as $field) {
if ($field['label'] == 'Invoice Description') {
$desc = rgpost('input_' . $field['id']);
break;
}
}
return $desc;
}
add_filter('gfeway_invoice_desc', 'test_gfeway_invoice_desc', 10, 2);
/**
* filter the eWAY invoice reference for a Gravity Form post
* @param string $ref the reference before filtering
* @param array $form the Gravity Form object
* @return string
*/
function test_gfeway_invoice_ref($ref, $form) {
// set by named field
foreach($form['fields'] as $field) {
if ($field['label'] == 'Invoice Reference') {
$ref = rgpost('input_' . $field['id']);
break;
}
}
return $ref;
}
add_filter('gfeway_invoice_ref', 'test_gfeway_invoice_ref', 10, 2);
/**
* filter the eWAY invoice transaction no. for a Gravity Form post
* @param string $ref the trans no. before filtering
* @param array $form the Gravity Form object
* @return string
*/
function test_gfeway_invoice_trans_number($transNumber, $form) {
// set by named field
foreach($form['fields'] as $field) {
if ($field['label'] == 'Transaction Number') {
$transNumber = rgpost('input_' . $field['id']);
break;
}
}
return $transNumber;
}
add_filter('gfeway_invoice_trans_number', 'test_gfeway_invoice_trans_number', 10, 2);
cheers,
Ross