Commit a02966ce authored by jenlampton's avatar jenlampton

Implement a stupid delay because authnet is junk.

parent cf65ba7a
cred.txt
t
......@@ -69,6 +69,16 @@ function authorizenetwebform_admin_settings() {
'#rows' => 5,
);
$delay = variable_get('authorizenetwebform_delay', 10);
$form['authorizenetwebform_delay'] = array(
'#type' => 'textfield',
'#title' => t('Delay'),
'#description' => t('If you are seeing an intermittent E00114 Invalid OTS Token error, you may need to implement a slight delay.'),
'#default_value' => $delay,
'#field_suffix' => format_plural($delay, 'Second', 'Seconds'),
'#size' => 10,
);
$form['authorizenetwebform_debug'] = array(
'#type' => 'checkbox',
'#title' => t('Debug mode'),
......
......@@ -149,6 +149,7 @@ function authorizenetwebform_form_webform_client_form_alter(&$form, &$form_state
'clientKey' => variable_get('authorizenetwebform_client_key', NULL),
'mapping' => array(),
'sensitive' => array(),
'delay' => variable_get('authorizenetwebform_delay', 10),
);
// Pre-populate the fields with test credit card info.
......@@ -750,6 +751,7 @@ function _authorizenetwebform_prepare_data($transaction_type, $nid, $field_value
$request_type = 'subscription';
$data[$transaction_type][$request_type] = $subscription_data;
}
db_query("delete from watchdog where type = 'cron'");
// Add the optional customer's billing data, if present.
if (isset($field_keys['company']) && isset($field_values[$field_keys['company']])) {
......
......@@ -126,8 +126,12 @@
}
}
// Submit the webform when done.
$(context).find("[data-authnet-form]").submit();
// @todo remove this stupid delay when AuthNet gets their act together.
// https://community.developer.authorize.net/t5/Integration-and-Testing/E00114-Invalid-OTS-Token/td-p/58879/page/2
setTimeout(function() {
// Submit the webform when done.
$(context).find("[data-authnet-form]").submit();
}, Drupal.settings.authorizeNetWebform.delay);
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment