Skip to content

Commit

Permalink
v2.1.0 release
Browse files Browse the repository at this point in the history
v2.0.3 release
- Switch to using WooCommerce order button instead of a HPS order button
  • Loading branch information
securesubmit-buildmaster authored Aug 30, 2022
2 parents 607a532 + 8676572 commit 3830802
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Download the contents and extract to your WordPress plugin folder. Activate.

## Changelog

#### 2.1.0

* Switch from iframe order button to default WooCommerce order button

#### 2.0.3

* Fix invalid cache after plugin update
Expand Down
64 changes: 54 additions & 10 deletions assets/js/securesubmit.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,16 @@
return;
}

let wooOrderButton = document.getElementById("place_order");
wooOrderButton.style = "display:none";

let buttonTarget = document.createElement("div");
buttonTarget.id = "submit_button";
buttonTarget.style = "display:none";

let wooOrderButton = document.getElementById("place_order");

wooOrderButton.parentElement.insertBefore(buttonTarget, wooOrderButton);

wooOrderButton.addEventListener("click", handleSubmitButton, true);

GlobalPayments.configure({
publicApiKey: wc_securesubmit_params.key
});
Expand Down Expand Up @@ -330,8 +332,6 @@

wc_securesubmit_params.hps.ready(
function () {
if (buttonTarget.firstChild)
buttonTarget.firstChild.style = "width: 100%";
if (
document.getElementById("securesubmit_card_number")
&& document.getElementById("securesubmit_card_number").firstChild
Expand Down Expand Up @@ -443,13 +443,57 @@
document.getElementById("submit_button").firstChild.remove();

window.securesubmitLoadIframes();
};

var triggerSubmit = function () {
// manually include iframe submit button
const fields = ['submit'];
const target = wc_securesubmit_params.hps.frames['card-number'];

for (const type in wc_securesubmit_params.hps.frames) {
if (wc_securesubmit_params.hps.frames.hasOwnProperty(type)) {
fields.push(type);
}
}

for (const type in wc_securesubmit_params.hps.frames) {
if (!wc_securesubmit_params.hps.frames.hasOwnProperty(type)) {
continue;
}

const frame = wc_securesubmit_params.hps.frames[type];

if (!frame) {
continue;
}

GlobalPayments.internal.postMessage.post({
data: {
fields: fields,
target: target.id
},
id: frame.id,
type: 'ui:iframe-field:request-data'
}, frame.id);
}
}

function handleSubmitButton (event) {
if (
document.getElementById("submit_button")
&& document.getElementById("submit_button").firstChild
)
document.getElementById("submit_button").firstChild.style = "width: 100%"
};
document.getElementById("payment_method_securesubmit")
&& document.getElementById("payment_method_securesubmit").checked
) {
if (document.getElementById("secure_submit_card_new")) {
if (document.getElementById("secure_submit_card_new").checked) {
event.preventDefault();
triggerSubmit();
}
} else {
event.preventDefault();
triggerSubmit();
}
}
}

jQuery('body').on('update_checkout', function() {
window.reloadIframes();
Expand Down
2 changes: 1 addition & 1 deletion classes/class-wc-gateway-securesubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class WC_Gateway_SecureSubmit extends WC_Payment_Gateway
public $payment = null;
public $refund = null;
public $reverse = null;
private $pluginVersion = '2.0.3';
private $pluginVersion = '2.1.0';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion gateway-securesubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: WooCommerce SecureSubmit Gateway
Plugin URI: https://developer.heartlandpaymentsystems.com/SecureSubmit/
Description: Heartland Payment Systems gateway for WooCommerce.
Version: 2.0.3
Version: 2.1.0
WC tested up to: 6.7.0
Author: SecureSubmit
Author URI: https://developer.heartlandpaymentsystems.com/SecureSubmit/
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Get your Certification (Dev/Sandbox) Api Keys by creating an account on https://
3. A view of the Manage Cards section

== Changelog ==
= 2.1.0 =
* Switch from iframe order button to default WooCommerce order button

= 2.0.3 =
* Fix invalid cache after plugin update
* Improvements to 'capture' payment action
Expand Down

0 comments on commit 3830802

Please sign in to comment.