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 #56 from heidelpay/develop
Browse files Browse the repository at this point in the history
release v2.0.0
  • Loading branch information
Simon Gabriel authored Jul 1, 2020
2 parents 30b5be4 + 5ac2891 commit 3c3f143
Show file tree
Hide file tree
Showing 27 changed files with 712 additions and 164 deletions.
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
language: php
dist: trusty
matrix:
fast_finish: true
include:
- php: 7.0
env: deps=no
- php: 7.0
env: deps=high
- php: 7.1
env: deps=no
- php: 7.1
Expand All @@ -15,6 +10,14 @@ matrix:
env: deps=no
- php: 7.2
env: deps=high
- php: 7.3
env: deps=no
- php: 7.3
env: deps=high
- php: 7.4
env: deps=no
- php: 7.4
env: deps=high
cache:
directories:
- $HOME/.composer/cache
Expand All @@ -23,8 +26,8 @@ cache:
before_install:
- ./tests/script/travis_before_install.sh
install:
- if [ "$(phpenv version-name)" == "5.6" ]; then travis_wait ./tests/script/travis_install.sh; else ./tests/script/travis_install.sh; fi
- ./tests/script/travis_install.sh
script:
- ./tests/script/travis_script.sh
after_success:
- php vendor/bin/codacycoverage clover tests/_output/coverage.xml
- bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l PHP -r tests/_output/coverage.xml
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ 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).

## [v2.0.0][v2.0.0]

### Removed
- Remove package which led to errors in CI.
- Remove support for PHP 5.6 and 7.0.

### Added
- Parameter group to allow Online Transfer payments (e.g. EPS, Giropay and iDeal) without bank selection in shop.
- Example for EPS and Giropay without bank selection.

### Changed
- Updated dependencies.
- Refactored ArraysMatchConstraint to new dependency version.
- Replaced codacy/coverage with codacy/codacy-coverage-reporter.
- Set integration tests to use PHP 7.1.
- Several minor updates.

## [v1.7.1][v1.7.1]

### Added
Expand Down Expand Up @@ -165,3 +182,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[v1.6.0]: https://github.com/heidelpay/php-payment-api/compare/v1.5.0...v1.6.0
[v1.6.1]: https://github.com/heidelpay/php-payment-api/compare/v1.6.0...v1.6.1
[v1.6.2]: https://github.com/heidelpay/php-payment-api/compare/v1.6.1...v1.6.2
[v1.7.0]: https://github.com/heidelpay/php-payment-api/compare/v1.6.2...v1.7.0
[v1.7.1]: https://github.com/heidelpay/php-payment-api/compare/v1.7.0...v1.7.1
[v2.0.0]: https://github.com/heidelpay/php-payment-api/compare/v1.7.1...v2.0.0
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
[![Build Status](https://travis-ci.org/heidelpay/php-payment-api.svg?branch=master)](https://travis-ci.org/heidelpay/php-payment-api)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/b1678b370db5462781415cd8800d56f3)](https://www.codacy.com/app/heidelpay/php-payment-api?utm_source=github.com&utm_medium=referral&utm_content=heidelpay/php-payment-api&utm_campaign=Badge_Coverage)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b1678b370db5462781415cd8800d56f3)](https://www.codacy.com/app/heidelpay/php-payment-api?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=heidelpay/php-payment-api&amp;utm_campaign=Badge_Grade)
[![PHP 5.6](https://img.shields.io/badge/php-5.6-blue.svg)](http://www.php.net)
[![PHP 7.0](https://img.shields.io/badge/php-7.0-blue.svg)](http://www.php.net)
[![PHP 7.1](https://img.shields.io/badge/php-7.1-blue.svg)](http://www.php.net)
[![PHP 7.1](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net)
[![PHP 7.2](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net)
[![PHP 7.3](https://img.shields.io/badge/php-7.3-blue.svg)](http://www.php.net)
[![PHP 7.4](https://img.shields.io/badge/php-7.4-blue.svg)](http://www.php.net)
![Logo](http://dev.heidelpay.com/devHeidelpay_400_180.jpg)

# Welcome to the heidelpay payment api for php
Expand Down Expand Up @@ -36,8 +36,7 @@ This is the php payment api for heidelpay. The library will help you to easily i
* Payolution invoice

### SYSTEM REQUIREMENTS

php-payment-api requires PHP 5.6 or higher; we recommend using the latest stable PHP version whenever possible.
php-payment-api requires PHP 7.1 or higher; we recommend using the latest stable PHP version whenever possible.

## SECURITY ADVICE
If you want to store the output of this library e.g. into a database, please make sure that your
Expand Down
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
"description": "New client library for heidelpay payments replacing heidelpay/php-api.",
"license": "proprietary",
"require": {
"php": ">=5.6.0",
"php": ">=7.1",
"lib-curl": "*",
"lib-openssl": "*",
"ext-SimpleXML": "*",
"ext-json": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
"heidelpay/phpdocumentor": "2.9.1",
"codeception/codeception": "~2.3.9",
"codeception/aspect-mock": "~3.0.0",
"codacy/coverage": "^1.4",
"heidelpay/php-basket-api": "^1.0"
"friendsofphp/php-cs-fixer": "^2.16",
"codeception/codeception": "^4.1",
"codeception/aspect-mock": "^3.1",
"heidelpay/php-basket-api": "^1.0",
"monolog/monolog": "^1.25",
"codeception/module-asserts": "^1.2",
"phpunit/phpunit": "^7.5"
},
"suggest": {
"heidelpay/php-message-code-mapper": "You can use this package to provide user-friendly messages instead of error codes.",
Expand Down
4 changes: 0 additions & 4 deletions example/CreditCardRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,3 @@
<script type="text/javascript" src="./js/creditCardFrame.js"></script>
</body>
</html>




135 changes: 135 additions & 0 deletions example/EpsAuthorizeWithoutForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php
/**
* This example shows an example implementation for the eps payment type WITHOUT bank selection in the shop
* but with redirect to the eps page providing the selection there.
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
* @copyright Copyright © 2019-present heidelpay GmbH. All rights reserved.
*
* @link http://dev.heidelpay.com/heidelpay-php-payment-api/
*
* @author Simon Gabriel
*
* @category example
*/
namespace Heidelpay\Example\PhpPaymentApi;

/**
* For security reason all examples are disabled by default.
*/
use Heidelpay\PhpPaymentApi\PaymentMethods\EPSPaymentMethod;

require_once './_enableExamples.php';
if (defined('HEIDELPAY_PHP_PAYMENT_API_EXAMPLES') && HEIDELPAY_PHP_PAYMENT_API_EXAMPLES !== true) {
exit();
}

/** Require the composer autoloader file */
require_once __DIR__ . '/../../../autoload.php';

/** create a new instance of the payment method */
$eps = new EPSPaymentMethod();
$epsRequest = $eps->getRequest();

/**
* Set up your authentication data for heidelpay api
*
* @link https://dev.heidelpay.com/testumgebung/#Authentifizierungsdaten
*/
$epsRequest->authentification(
'31HA07BC8142C5A171745D00AD63D182', // SecuritySender
'31ha07bc8142c5a171744e5aef11ffd3', // UserLogin
'93167DE7', // UserPassword
'31HA07BC816492169CE30CFBBF83B1D5', // TransactionChannel
true // enable/disable sandbox mode
);

$epsRequest->getFrontend()->setResponseUrl('http://technik.heidelpay.de/jonas/responseAdvanced/response.php');

// set up customer information required for risk checks
$epsRequest->customerAddress(
'Hans', // Given name
'Zimmer', // Family name
null, // Company Name
'12344', // Customer id of your application
'Salzachstraße 13', // Billing address street
'',
'1200', // Billing address post code
'Wien', // Billing address city
'AT', // Billing address country code
'support@heidelpay.com' // Customer mail address
);

// set up basket or transaction information
$epsRequest->basketData(
'2843294932', // Reference Id of your application
23.12, // Amount of this request
'EUR', // Currency code of this request
'39542395235ßfsokkspreipsr' // A secret passphrase from your application
);

// set bank country
$epsRequest->getAccount()->setCountry('AT');

// disable frontend mode -> this shows that there is no additional input necessary by the customer prior to the redirect to the eps page.
$epsRequest->getFrontend()->setEnabled('FALSE');

// perform the authorize transaction to retrieve the redirect url and parameters
$eps->authorize();

// get the redirect url and necessary parameters from the response.
$redirectGroup = $eps->getResponse()->getProcessing()->getRedirect();
$redirectUrl = $redirectGroup->getUrl();
$redirectParams = $redirectGroup->getParameter();

echo '<strong>RedirectUrl:</strong> ' . $redirectUrl;
ksort($redirectParams);
foreach($redirectParams as $key=>$value) {
echo '<br><strong>RedirectParam</strong> ' . $key . ': ' . $value;
}

/**
* Attention:
* Unfortunately Sandbox-mode and Live-mode have to be handled differently.
* In case of ..
* 1. .. a sandbox transaction no redirect parameters exist and you have to perform a GET-Redirect to the redirect url.
* 2. .. a live mode transaction there will be redirect parameters and you have to submit them via POST-request to the redirect url.
*
* The following example shows one possible solution to this task.
*/
?>

<html>
<head>
<title>EPS authorize example</title>
</head>

<body>
<!-- create a form which contains any parameters needed for the redirect -->
<form id="payment-form" action="<?php echo $redirectUrl; ?>" method="post">
<?php
foreach ($redirectParams as $key=>$param) {
echo '<input hidden="true" name="' . $key . '" value="'. $param . '"/>';
}
?>
<button type="submit">Pay</button>
</form>

<script>
var form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
event.preventDefault();

// get the number ob redirect parameters
var redirectParameterCount = form.getElementsByTagName('input').length;
if (redirectParameterCount === 0) {
// ... perform a get redirect if there are no parameters needed for the redirect ==> Sandbox mode
window.location.href = form.getAttribute('action');
} else {
// ... submit the form via post with all redirect parameters ==> Live mode
form.submit();
}
});
</script>
</body>
</html>
Loading

0 comments on commit 3c3f143

Please sign in to comment.