diff --git a/docs/index.md b/docs/index.md index ee55a3a9621dd772cb0921a4f1eda99b7d504a98..b8e2fbdfcd34f2a55d6201c1f6d6baffea9bbb11 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,13 +8,15 @@ Latest releases can be found here: https://civicrm.org/extensions/stripe-payment View this extension in the [Extension Directory](https://civicrm.org/extensions/stripe-payment-processor). ## Compatibility / Requirements -* CiviCRM 5.10+ -* PHP 7.0+ +* CiviCRM 5.13+ +* PHP 7.1+ * Jquery 1.10 (Use jquery_update module on Drupal). * Drupal 7 / Joomla / Wordpress (latest supported release). *Not currently tested with other CMS but it may work.* -* Stripe API version: 2019-02-19 +* Stripe API version: 2019-08-14 * Drupal webform_civicrm 7.x-4.22+ (if using webform integration) +If using test mode with drupal webform_civicrm you need this patch: https://github.com/colemanw/webform_civicrm/pull/266 + ## Credits Current Maintainer: Matthew Wire - https://www.mjwconsult.co.uk diff --git a/js/civicrm_stripe.js b/js/civicrm_stripe.js index 5e464240e92aa02bc12accac259c906d6c77f416..4a83be8006e3f51f5dc01af75c216f83a872dbf8 100644 --- a/js/civicrm_stripe.js +++ b/js/civicrm_stripe.js @@ -249,17 +249,14 @@ CRM.$(function($) { // For CiviCRM Webforms. if (getIsDrupalWebform()) { // We need the action field for back/submit to work and redirect properly after submission - if (!($('#action').length)) { - form.append($('<input type="hidden" name="op" id="action" />')); - } - var $actions = form.querySelector('[type=submit]'); + $('[type=submit]').click(function() { - $('#action').val(this.value); + addDrupalWebformActionElement(this.value); }); // If enter pressed, use our submit function form.addEventListener('keydown', function (e) { if (e.keyCode === 13) { - $('#action').val(this.value); + addDrupalWebformActionElement(this.value); submit(event); } }); @@ -453,4 +450,19 @@ CRM.$(function($) { } } + function addDrupalWebformActionElement(submitAction) { + var hiddenInput = null; + if (document.getElementById('action') !== null) { + hiddenInput = document.getElementById('action'); + } + else { + hiddenInput = document.createElement('input'); + } + hiddenInput.setAttribute('type', 'hidden'); + hiddenInput.setAttribute('name', 'op'); + hiddenInput.setAttribute('id', 'action'); + hiddenInput.setAttribute('value', submitAction); + form.appendChild(hiddenInput); + } + });