Skip to content

Commit

Permalink
OctopusDeploy release: 2.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Aug 19, 2021
1 parent aea2fc0 commit 10f9e14
Show file tree
Hide file tree
Showing 23 changed files with 732 additions and 807 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
# Changelog

## Latest version

- Set Fraud Management Rules for GP-ECOM

## v2.3.9 (08/03/2021)

- Send "x-gp-sdk" in the header with the SDK programming language and release version used
- Send headers to GP-API that are dynamically set through configuration, like:
- x-gp-platform: "prestashop;version=1.7.2"
Expand Down
387 changes: 204 additions & 183 deletions examples/consumer-authentication/cruise.php

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions examples/end-to-end/charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
->withAllowDuplicates(true)
->execute();

// print_r($response);

$body = '<h1>Success!</h1>';
$body .= '<p>Thank you, ' . $_GET['FirstName'] . ', for your order of $15.</p>';

Expand Down
75 changes: 36 additions & 39 deletions examples/iframe-recurring-signup/assets/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(function (document, Heartland) {
// Create a new `HPS` object with the necessary configuration
var hps = new Heartland.HPS({
publicKey: 'pkapi_cert_jKc1FtuyAydZhZfbB3',
type: 'iframe',
// Configure the iframe fields to tell the library where
// the iframe should be inserted into the DOM and some
// basic options
// Configure account
GlobalPayments.configure({
publicApiKey: "pkapi_cert_jKc1FtuyAydZhZfbB3"
});

// Create Form
const cardForm = GlobalPayments.creditCard.form("#payment-form",
{
fields: {
cardNumber: {
target: 'iframesCardNumber',
Expand Down Expand Up @@ -173,35 +173,32 @@
'display': 'none'
}
},
// Callback when a token is received from the service
onTokenSuccess: function (resp) {
document.querySelector("input[name=token_value]").value = resp.token_value;
document.querySelector("input[name=card_last_four]").value = resp.last_four;
Heartland.Events.removeHandler(document.getElementById('payment_form'), 'submit');
document.getElementById('payment_form').submit();
},
// Callback when an error is received from the service
onTokenError: function (resp) {
alert('There was an error: ' + resp.error.message);
},
// Callback when an event is fired within an iFrame
onEvent: function (ev) {
console.log(ev);
}
});
}
);

// form-level event handlers. examples:
cardForm.ready(() => {
console.log("Registration of all credit card fields occurred");
});
cardForm.on("token-success", (resp) => {
// add payment token to form as a hidden input
const token = document.createElement("input");
token.type = "hidden";
token.name = "payment-reference";
token.value = resp.paymentReference;

// Attach a handler to interrupt the form submission
Heartland.Events.addHandler(document.getElementById('iframes'), 'submit', function (e) {
// Prevent the form from continuing to the `action` address
e.preventDefault();
// Tell the iframes to tokenize the data
hps.Messages.post(
{
accumulateData: true,
action: 'tokenize',
message: 'pkapi_cert_jKc1FtuyAydZhZfbB3'
},
'cardNumber'
);
});
}(document, Heartland));
document.querySelector("input[name=card-last-four]").value = resp.cardLast4;

// submit data to the integration's backend for processing
const form = document.getElementById("payment-form");
form.appendChild(token);
form.submit();
});
cardForm.on("token-error", (resp) => {
// show error to the consumer
});

// field-level event handlers. example:
cardForm.on("card-number", "register", () => {
console.log("Registration of Card Number occurred");
});
64 changes: 23 additions & 41 deletions examples/iframe-recurring-signup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,48 @@
<body>
<div class="container">
<h1>PHP SecureSubmit Example</h1>
<form class="payment_form form-horizontal" id="payment_form" action="charge.php">
<form class="payment_form form-horizontal" id="payment-form" action="charge.php">
<h2>Billing Information</h2>
<div class="form-group">
<label for="FirstName" class="col-sm-2 control-label">First Name</label>
<label for="first-name" class="col-sm-2 control-label">First Name</label>
<div class="col-sm-10">
<input type="text" name="FirstName" />
<input id="first-name" type="text" name="first-name" />
</div>
</div>
<div class="form-group">
<label for="LastName" class="col-sm-2 control-label">Last Name</label>
<label for="last-name" class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-10">
<input type="text" name="LastName" />
<input id="last-name" type="text" name="last-name" />
</div>
</div>
<div class="form-group">
<label for="PhoneNumber" class="col-sm-2 control-label">Phone Number</label>
<label for="phone-number" class="col-sm-2 control-label">Phone Number</label>
<div class="col-sm-10">
<input type="text" name="PhoneNumber" />
<input id="phone-number" type="text" name="phone-number" />
</div>
</div>
<div class="form-group">
<label for="Email" class="col-sm-2 control-label">Email</label>
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="text" name="Email" />
<input id="email" type="text" name="email" />
</div>
</div>
<div class="form-group">
<label for="Address" class="col-sm-2 control-label">Address</label>
<label for="address" class="col-sm-2 control-label">Address</label>
<div class="col-sm-10">
<input type="text" name="Address" />
<input id="address" type="text" name="address" />
</div>
</div>
<div class="form-group">
<label for="City" class="col-sm-2 control-label">City</label>
<label for="city" class="col-sm-2 control-label">City</label>
<div class="col-sm-10">
<input type="text" name="City" />
<input id="city" type="text" name="city" />
</div>
</div>
<div class="form-group">
<label for="State" class="col-sm-2 control-label">State</label>
<label for="state" class="col-sm-2 control-label">State</label>
<div class="col-sm-10">
<select Name="State">
<select Name="state">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
Expand Down Expand Up @@ -108,17 +108,17 @@ <h2>Billing Information</h2>
</div>
</div>
<div class="form-group">
<label for="Zip" class="col-sm-2 control-label">Zip</label>
<label for="billing-zip" class="col-sm-2 control-label">Billing Zip Code</label>
<div class="col-sm-10">
<input type="text" name="Zip" />
<input id="billing-zip" type="tel" name="billing-zip" />
</div>
</div>

<h2>Subscription Information</h2>
<div class="form-group">
<label for="payment_amount" class="col-sm-2 control-label">Subscription Plan</label>
<label for="payment-amount" class="col-sm-2 control-label">Subscription Plan</label>
<div class="col-sm-10">
<select name="payment_amount" id="payment_amount">
<select name="payment-amount" id="payment-amount">
<option> -- Select a Plan -- </option>
<option value="100">Basic</option>
<option value="200">Enhanced</option>
Expand All @@ -129,37 +129,19 @@ <h2>Subscription Information</h2>
<h2>Card Information</h2>
<div class="form-group">
<div class="form-wrapper">
<div id="ss-banner"></div>

<div class="form-row">
<label for="iframesCardNumber">Card Number:</label>
<div id="iframesCardNumber"></div>
</div>

<div class="form-row">
<label for="iframesCardExpiration">Card Expiration:</label>
<div id="iframesCardExpiration"></div>
</div>

<div class="form-row">
<label for="iframesCardCvv">Card CVV:</label>
<div id="iframesCardCvv"></div>
</div>

<br />
<div id="iframesSubmit"></div>
<div class="form-group" id="credit-card"></div>
</div>
</div>

<br />
<input type="hidden" id="token_value" name="token_value" />
<input type="hidden" id="card_last_four" name="card_last_four" />
<input type="hidden" id="token-value" name="token-value" />
<input type="hidden" id="card-last-four" name="card-last-four" />
<br />
</form>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="https://api2.heartlandportico.com/SecureSubmit.v1/token/2.1/securesubmit.js"></script>
<script type="text/javascript" src="https://js.globalpay.com/v1/globalpayments.js"></script>
<script src="./assets/main.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ function getIdentifier($id) {
function createCustomer() {
$customer = new Customer();
$customer->id = getIdentifier('Person');
$customer->firstName = $_GET["FirstName"];
$customer->lastName = $_GET["LastName"];
$customer->firstName = $_GET["first-name"];
$customer->lastName = $_GET["last-name"];
$customer->status = 'Active';
$customer->email = $_GET['Email'];
$customer->email = $_GET['email'];
$customer->address = new Address();
$customer->address->streetAddress1 = $_GET["Address"];
$customer->address->city = $_GET["City"];
$customer->address->province = $_GET["State"];
$customer->address->postalCode = $_GET["Zip"];
$customer->address->streetAddress1 = $_GET["address"];
$customer->address->city = $_GET["city"];
$customer->address->province = $_GET["state"];
$customer->address->postalCode = $_GET["billing-zip"];
$customer->address->country = 'USA';
$customer->workPhone = $_GET["PhoneNumber"];
$customer->workPhone = $_GET["phone-number"];

$newCustomer = $customer->create();

Expand All @@ -63,7 +63,7 @@ function createCustomer() {

function createPaymentMethod($customer) {
$card = new CreditCardData();
$card->token = $_GET['token_value'];
$card->token = $_GET['payment-reference'];

$paymentMethod = $customer->addPaymentMethod(
getIdentifier('CreditV'), $card
Expand Down Expand Up @@ -97,7 +97,7 @@ function createSchedule($customerKey, $paymentMethodKey, $amount) {
try {
$customer = createCustomer();
$paymentMethod = createPaymentMethod($customer);
$schedule = createSchedule($customer->key, $paymentMethod->key, $_GET['payment_amount']);
$schedule = createSchedule($customer->key, $paymentMethod->key, $_GET['payment-amount']);

echo '<b>Your payment scheduled successfully </b><br />';
printf('Customer Key: %s<br />', $customer->key);
Expand All @@ -109,7 +109,7 @@ function createSchedule($customerKey, $paymentMethodKey, $amount) {


$body = '<h1>Success!</h1>';
$body .= '<p>Thank you, ' . $_GET['FirstName'] . ', for your subscription.';
$body .= '<p>Thank you, ' . $_GET['first-name'] . ', for your subscription.';



Expand Down
74 changes: 35 additions & 39 deletions examples/manual-tokenize/assets/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(function (document, Heartland) {
// Create a new `HPS` object with the necessary configuration
var hps = new Heartland.HPS({
publicKey: 'pkapi_cert_jKc1FtuyAydZhZfbB3',
type: 'iframe',
// Configure the iframe fields to tell the library where
// the iframe should be inserted into the DOM and some
// basic options
// Configure account
GlobalPayments.configure({
publicApiKey: "pkapi_cert_P6dRqs1LzfWJ6HgGVZ"
});

// Create Form
const cardForm = GlobalPayments.creditCard.form("#payment-form",
{
fields: {
cardNumber: {
target: 'iframesCardNumber',
Expand Down Expand Up @@ -173,34 +173,30 @@
'display': 'none'
}
},
// Callback when a token is received from the service
onTokenSuccess: function (resp) {
document.querySelector("input[name=token_value]").value = resp.token_value;
Heartland.Events.removeHandler(document.getElementById('payment_form'), 'submit');
document.getElementById('payment_form').submit();
},
// Callback when an error is received from the service
onTokenError: function (resp) {
alert('There was an error: ' + resp.error.message);
},
// Callback when an event is fired within an iFrame
onEvent: function (ev) {
console.log(ev);
}
});

// Attach a handler to interrupt the form submission
Heartland.Events.addHandler(document.getElementById('iframes'), 'submit', function (e) {
// Prevent the form from continuing to the `action` address
e.preventDefault();
// Tell the iframes to tokenize the data
hps.Messages.post(
{
accumulateData: true,
action: 'tokenize',
message: 'pkapi_cert_jKc1FtuyAydZhZfbB3'
},
'cardNumber'
);
});
}(document, Heartland));
}
);

// form-level event handlers. examples:
cardForm.ready(() => {
console.log("Registration of all credit card fields occurred");
});
cardForm.on("token-success", (resp) => {
// add payment token to form as a hidden input
const token = document.createElement("input");
token.type = "hidden";
token.name = "payment-reference";
token.value = resp.paymentReference;

// submit data to the integration's backend for processing
const form = document.getElementById("payment-form");
form.appendChild(token);
form.submit();
});
cardForm.on("token-error", (resp) => {
// show error to the consumer
});

// field-level event handlers. example:
cardForm.on("card-number", "register", () => {
console.log("Registration of Card Number occurred");
});
Loading

0 comments on commit 10f9e14

Please sign in to comment.