Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #46 from heidelpay/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Simon Gabriel authored Jan 18, 2019
2 parents dbabd9b + f9f4289 commit ae219cd
Show file tree
Hide file tree
Showing 43 changed files with 2,404 additions and 286 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.1.0][1.0.1.0]

### Added
* EPS payment type incl. example code.
* It is now possible to create, update and fetch a basket as well as referencing it by a authorization or charge.
* Missing tests for metadata resource.

### Changed
* Refactor value update to allow for empty strings.
* Ensuring that transferred floats are always encoded as floats on json-encode.
* Properties stored in an array are now (json-)encoded as \stdClass not as array.

### Fixed
* Comments and styles.

## [1.0.0.1][1.0.0.1]

### Fixed
Expand Down Expand Up @@ -73,3 +88,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[1.0.0-beta.2]: https://github.com/heidelpay/heidelpayPHP/compare/1.0.0-beta.1..1.0.0-beta.2
[1.0.0.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.0.0-beta.2..1.0.0.0
[1.0.0.1]: https://github.com/heidelpay/heidelpayPHP/compare/1.0.0.0..1.0.0.1
[1.0.1.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.0.0.1..1.0.1.0
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ Please refer to the following documentation for installation instructions and us
* Przelewy24
* SEPA direct debit (guaranteed)
* SOFORT
* EPS

## Support
For any issues or questions please get in touch with our support.
For any issues or questions please get in touch with our support team.

### Web page
[https://dev.heidelpay.com/](https://dev.heidelpay.com/)
Expand Down
204 changes: 104 additions & 100 deletions examples/CreditCard3DAuthorization/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,118 +32,122 @@

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
Heidelpay UI Examples
</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<head>
<meta charset="UTF-8">
<title>
Heidelpay UI Examples
</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>

<link rel="stylesheet" href="https://static.heidelpay.com/v1/heidelpay.css" />
<script type="text/javascript" src="https://static.heidelpay.com/v1/heidelpay.js"></script>
</head>
<link rel="stylesheet" href="https://static.heidelpay.com/v1/heidelpay.css" />
<script type="text/javascript" src="https://static.heidelpay.com/v1/heidelpay.js"></script>
</head>

<body style="margin: 70px 70px 0;">
<h3>Example data without 3D secure:</h3>
<ul>
<li>Number: 4111 1111 1111 1111</li>
<li>Expiry date: Date in the future</li>
<li>Cvc: 123</li>
</ul>
<body style="margin: 70px 70px 0;">
<h3>Example data without 3D secure:</h3>
<ul>
<li>Number: 4111 1111 1111 1111</li>
<li>Expiry date: Date in the future</li>
<li>Cvc: 123</li>
</ul>

<h3>Example data with 3D secure:</h3>
<ul>
<li>Number: 4444 3333 2222 1111</li>
<li>Expiry date: Date in the future</li>
<li>Cvc: 123</li>
<li>Secret: VISA123</li>
</ul>
<h3>Example data with 3D secure:</h3>
<ul>
<li>Number: 4444 3333 2222 1111</li>
<li>Expiry date: Date in the future</li>
<li>Cvc: 123</li>
<li>Secret: VISA123</li>
</ul>

<form id="payment-form" class="heidelpayUI form" novalidate>
<div class="field">
<div id="card-element-id-number" class="heidelpayInput">
<!-- Card number UI Element will be inserted here. -->
</div>
<form id="payment-form" class="heidelpayUI form" novalidate>
<div class="field">
<div id="card-element-id-number" class="heidelpayInput">
<!-- Card number UI Element will be inserted here. -->
</div>
</div>
<div class="two fields">
<div class="field ten wide">
<div id="card-element-id-expiry" class="heidelpayInput">
<!-- Card expiry date UI Element will be inserted here. -->
</div>
<div class="two fields">
<div class="field ten wide">
<div id="card-element-id-expiry" class="heidelpayInput">
<!-- Card expiry date UI Element will be inserted here. -->
</div>
</div>
<div class="field six wide">
<div id="card-element-id-cvc" class="heidelpayInput">
<!-- Card CVC UI Element will be inserted here. -->
</div>
</div>
</div>
<div class="field six wide">
<div id="card-element-id-cvc" class="heidelpayInput">
<!-- Card CVC UI Element will be inserted here. -->
</div>
<div class="field">
<button id="submit-button" class="heidelpayUI" type="submit">Pay</button>
</div>
</form>
</div>
</div>
<div class="field" id="error-holder" style="color: #9f3a38"> </div>
<div class="field">
<button id="submit-button" class="heidelpayUI" type="submit">Pay</button>
</div>
</form>

<script>
// Creating a heidelpay instance with your public key
let heidelpayInstance = new heidelpay('s-pub-2a10gsZJ2IeiiK80Wh68qrOzu4IZse6k');
<script>
// Creating a heidelpay instance with your public key
let heidelpayInstance = new heidelpay('s-pub-2a10gsZJ2IeiiK80Wh68qrOzu4IZse6k');

// Creating a credit card instance
let Card = heidelpayInstance.Card();
// Creating a credit card instance
let Card = heidelpayInstance.Card();

// Rendering input fields
Card.create('number', {
containerId: 'card-element-id-number',
onlyIframe: false
});
Card.create('expiry', {
containerId: 'card-element-id-expiry',
onlyIframe: false
});
Card.create('cvc', {
containerId: 'card-element-id-cvc',
onlyIframe: false
});
// Rendering input fields
Card.create('number', {
containerId: 'card-element-id-number',
onlyIframe: false
});
Card.create('expiry', {
containerId: 'card-element-id-expiry',
onlyIframe: false
});
Card.create('cvc', {
containerId: 'card-element-id-cvc',
onlyIframe: false
});

// General event handling
let buttonDisabled = {};
let testButton = document.getElementById("submit-button");
testButton.disabled = true;
// General event handling
let buttonDisabled = {};
let testButton = document.getElementById("submit-button");
testButton.disabled = true;
let $errorHolder = $('#error-holder');

let eventHandlerCardInput = function(e) {
if (e.success) {
buttonDisabled[e.type] = true;
testButton.disabled = false;
} else {
buttonDisabled[e.type] = false;
testButton.disabled = true;
}
testButton.disabled = !(buttonDisabled.number && buttonDisabled.expiry && buttonDisabled.cvc);
};
let eventHandlerCardInput = function(e) {
if (e.success) {
buttonDisabled[e.type] = true;
testButton.disabled = false;
$errorHolder.html('')
} else {
buttonDisabled[e.type] = false;
testButton.disabled = true;
$errorHolder.html(e.error)
}
testButton.disabled = !(buttonDisabled.number && buttonDisabled.expiry && buttonDisabled.cvc);
};

Card.addEventListener('change', eventHandlerCardInput);
Card.addEventListener('change', eventHandlerCardInput);

// Handling the form's submission
let form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
event.preventDefault();
// Creating a credit card resource
Card.createResource()
.then(function(result) {
let hiddenInput = document.createElement('input');
hiddenInput.setAttribute('type', 'hidden');
hiddenInput.setAttribute('name', 'resourceId');
hiddenInput.setAttribute('value', result.id);
form.appendChild(hiddenInput);
form.setAttribute('method', 'POST');
form.setAttribute('action', '<?php echo CONTROLLER_URL; ?>');
// Handling the form's submission
let form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
event.preventDefault();
// Creating a credit card resource
Card.createResource()
.then(function(result) {
let hiddenInput = document.createElement('input');
hiddenInput.setAttribute('type', 'hidden');
hiddenInput.setAttribute('name', 'resourceId');
hiddenInput.setAttribute('value', result.id);
form.appendChild(hiddenInput);
form.setAttribute('method', 'POST');
form.setAttribute('action', '<?php echo CONTROLLER_URL; ?>');

// Submitting the form
form.submit();
})
.catch(function(error) {
errorElement.textContent = error.message;
})
});
</script>
</body>
// Submitting the form
form.submit();
})
.catch(function(error) {
$errorHolder.html(error.message);
})
});
</script>
</body>
</html>
6 changes: 5 additions & 1 deletion examples/CreditCard3DCharge/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
</div>
</div>
</div>
<div class="field" id="error-holder" style="color: #9f3a38"> </div>
<div class="field">
<button id="submit-button" class="heidelpayUI" type="submit">Pay</button>
</div>
Expand Down Expand Up @@ -108,14 +109,17 @@
let buttonDisabled = {};
let testButton = document.getElementById("submit-button");
testButton.disabled = true;
let $errorHolder = $('#error-holder');

let eventHandlerCardInput = function(e) {
if (e.success) {
buttonDisabled[e.type] = true;
testButton.disabled = false;
$errorHolder.html('')
} else {
buttonDisabled[e.type] = false;
testButton.disabled = true;
$errorHolder.html(e.error)
}
testButton.disabled = !(buttonDisabled.number && buttonDisabled.expiry && buttonDisabled.cvc);
};
Expand All @@ -141,7 +145,7 @@
form.submit();
})
.catch(function(error) {
errorElement.textContent = error.message;
$errorHolder.html(error.message);
})
});
</script>
Expand Down
Loading

0 comments on commit ae219cd

Please sign in to comment.