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 #26 from heidelpay/develop
Browse files Browse the repository at this point in the history
v1.5.0
  • Loading branch information
stevenobird authored Apr 13, 2018
2 parents 3c7c809 + d2e9a27 commit f3bea9b
Show file tree
Hide file tree
Showing 35 changed files with 665 additions and 275 deletions.
35 changes: 25 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,43 @@ 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).

## [v1.5.0][v1.5.0]
### Added
- New unit test to cover finalize payment method.

### Changed
- Replaced static strings with constants.

### Removed
- Finalize payment method and tests from direct debit secured.

### Fixed
- Code style issues.
- Overwriting of parameters when calling credit/debit card methods without parameters

## [v1.4.1][v1.4.1]
## Fixed
### Fixed
- Error in DirectDebitB2CSecured during integration test of reversal transaction.
- Fixed a bug which can cause errors due to irregular post parameters.

## Changed
### Changed
- Renamed "Heidelberger Payment GmbH" to "heidelpay GmbH" due to re-branding.
- Changed tlds from de to com.
- Changed documentation and data-privacy-policy links.

## [v1.4.0][v1.4.0]
## Added
### Added
- Transaction type reregistration.
- Unit and integration tests for reregistration transaction.
- `toArray()` method to the AbstractMethod class for Request/Response
- Added important methods to the PaymentMethodInterface.

## Changed
### Changed
- Added debug output to integration tests. Append `--debug` to see them (`codecept run integration --debug`).
- Replaced magic setters.

## [v1.3.0][v1.3.0]
## Added
### Added
- `fromJson()` and `fromPost()` static methods to instantiate `Response` and `Request` objects with a static call.
- Several constants for Api Config, Paymentmethod codes, status/reason codes, ... see the following classes in the `Heidelpay\PhpPaymentApi\Constants` namespace:
- `ApiConfig` includes this sdk's version, live and test api urls
Expand All @@ -37,22 +51,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
- `TransactionMode` includes transaction modes, which are important for the running environment
- `TransactionType` includes codes for transaction types (e.g. Capture, Debit, Reversal, ...)

## Changed
### Changed
- Clearified the exception message in `verifySecurityHash()` (Response script/page should only be called by heidelpay)

## Removed
### Removed
- `AbstractPaymentMethod` class in favor of the `BasicPaymentMethodTrait`

## Deprecated
### Deprecated
- Declared `Response::splitArray()` as deprecated in favor of `fromPost()` and replaced it's code with a `fromPost` call


## [v1.2.0][v1.2.0]
## Added
### Added
- `HttpAdapterInterface` to allow injecting a custom http adapter.
- Criterion `get()` method for custom properties

## Changed
### Changed
- Refactored Requests send method to only create a `CurlAdapter` object when needed.
- Refactored unit tests to inject a `CurlAdapter` object instead of an InterfaceProxy object.

Expand Down Expand Up @@ -95,3 +109,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
[v1.3.0]: https://github.com/heidelpay/php-payment-api/compare/v1.2.0...v1.3.0
[v1.4.0]: https://github.com/heidelpay/php-payment-api/compare/v1.3.0...v1.4.0
[v1.4.1]: https://github.com/heidelpay/php-payment-api/compare/v1.4.0...v1.4.1
[v1.5.0]: https://github.com/heidelpay/php-payment-api/compare/v1.4.0...v1.5.0
5 changes: 3 additions & 2 deletions lib/Adapter/CurlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Heidelpay\PhpPaymentApi\Adapter;

use Heidelpay\PhpPaymentApi\Response;
use Heidelpay\PhpPaymentApi\Constants\ProcessingResult;

/**
* Standard curl adapter
Expand Down Expand Up @@ -40,7 +41,7 @@ public function sendPost($uri = null, $post = null)

if (!extension_loaded('curl')) {
$result = array(
'PROCESSING_RESULT' => 'NOK',
'PROCESSING_RESULT' => ProcessingResult::NOK,
'PROCESSING_RETURN' => 'Connection error php-curl not installed',
'PROCESSING_RETURN_CODE' => 'CON.ERR.CUR'
);
Expand Down Expand Up @@ -79,7 +80,7 @@ public function sendPost($uri = null, $post = null)
: 'DEF';

$result = array(
'PROCESSING_RESULT' => 'NOK',
'PROCESSING_RESULT' => ProcessingResult::NOK,
'PROCESSING_RETURN' => 'Connection error http status ' . $error,
'PROCESSING_RETURN_CODE' => 'CON.ERR.' . $errorCode
);
Expand Down
2 changes: 1 addition & 1 deletion lib/Constants/ApiConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class ApiConfig
{
const SDK_VERSION = 'v1.4.1';
const SDK_VERSION = 'v1.5.0';

const LIVE_URL = 'https://heidelpay.hpcgw.net/ngw/post';
const TEST_URL = 'https://test-heidelpay.hpcgw.net/ngw/post';
Expand Down
63 changes: 43 additions & 20 deletions lib/PaymentMethods/CreditCardPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType;

/**
* Credit Card Payment Class
*
* This class will be used for every credit card transaction
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
Expand Down Expand Up @@ -75,9 +73,16 @@ class CreditCardPaymentMethod implements PaymentMethodInterface
public function authorize($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null)
{
$this->getRequest()->getFrontend()->setEnabled('TRUE');
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
$this->getRequest()->getFrontend()->setCssPath($cssPath);

if ($paymentFrameOrigin !== null) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
}
if ($preventAsyncRedirect !== $this->getRequest()->getFrontend()->getPreventAsyncRedirect()) {
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
}
if ($cssPath !== null) {
$this->getRequest()->getFrontend()->setCssPath($cssPath);
}

return $this->authorizeParent();
}
Expand All @@ -98,9 +103,15 @@ public function authorize($paymentFrameOrigin = null, $preventAsyncRedirect = 'F
*/
public function debit($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null)
{
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
$this->getRequest()->getFrontend()->setCssPath($cssPath);
if ($paymentFrameOrigin !== null) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
}
if ($preventAsyncRedirect !== $this->getRequest()->getFrontend()->getPreventAsyncRedirect()) {
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
}
if ($cssPath !== null) {
$this->getRequest()->getFrontend()->setCssPath($cssPath);
}

return $this->debitParent();
}
Expand All @@ -123,9 +134,15 @@ public function debit($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE
*/
public function registration($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE', $cssPath = null)
{
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
$this->getRequest()->getFrontend()->setCssPath($cssPath);
if ($paymentFrameOrigin !== null) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
}
if ($preventAsyncRedirect !== $this->getRequest()->getFrontend()->getPreventAsyncRedirect()) {
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
}
if ($cssPath !== null) {
$this->getRequest()->getFrontend()->setCssPath($cssPath);
}

return $this->registrationParent();
}
Expand All @@ -138,23 +155,29 @@ public function registration($paymentFrameOrigin = null, $preventAsyncRedirect =
* to use a payment frame solution to handle the customers credit card information.
*
* @param mixed $referenceId
* @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com
* @param mixed $PreventAsyncRedirect prevention of redirecting the customer
* @param null|mixed $CssPath css url to style the Heidelpay payment frame
* @param null|mixed $paymentFrameOrigin uri of your application like http://dev.heidelpay.com
* @param mixed $preventAsyncRedirect prevention of redirecting the customer
* @param null|mixed $cssPath css url to style the Heidelpay payment frame
*
* @return ReregistrationTransactionType
*
* @throws \Exception
*/
public function reregistration(
$referenceId,
$PaymentFrameOrigin = null,
$PreventAsyncRedirect = 'FALSE',
$CssPath = null
$paymentFrameOrigin = null,
$preventAsyncRedirect = 'FALSE',
$cssPath = null
) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($PaymentFrameOrigin);
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($PreventAsyncRedirect);
$this->getRequest()->getFrontend()->setCssPath($CssPath);
if ($paymentFrameOrigin !== null) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
}
if ($preventAsyncRedirect !== $this->getRequest()->getFrontend()->getPreventAsyncRedirect()) {
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
}
if ($cssPath !== null) {
$this->getRequest()->getFrontend()->setCssPath($cssPath);
}

return $this->reregistrationParent($referenceId);
}
Expand Down
63 changes: 43 additions & 20 deletions lib/PaymentMethods/DebitCardPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType;

/**
* Debit Card Payment Class
*
* This class will be used for every debit card transaction
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
Expand Down Expand Up @@ -79,9 +77,16 @@ public function authorize($paymentFrameOrigin = null, $preventAsyncRedirect = 'F
* to use a payment frame for the input of credit card information
*/
$this->getRequest()->getFrontend()->setEnabled('TRUE');
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
$this->getRequest()->getFrontend()->setCssPath($cssPath);

if ($paymentFrameOrigin !== null) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
}
if ($preventAsyncRedirect !== $this->getRequest()->getFrontend()->getPreventAsyncRedirect()) {
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
}
if ($cssPath !== null) {
$this->getRequest()->getFrontend()->setCssPath($cssPath);
}

return $this->authorizeParent();
}
Expand All @@ -106,9 +111,15 @@ public function debit($paymentFrameOrigin = null, $preventAsyncRedirect = 'FALSE
* Because of the payment card industriy restictions (Aka pci3) you have
* to use a payment frame for the input of credit card information
*/
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
$this->getRequest()->getFrontend()->setCssPath($cssPath);
if ($paymentFrameOrigin !== null) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
}
if ($preventAsyncRedirect !== $this->getRequest()->getFrontend()->getPreventAsyncRedirect()) {
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
}
if ($cssPath !== null) {
$this->getRequest()->getFrontend()->setCssPath($cssPath);
}

return $this->debitParent();
}
Expand All @@ -135,9 +146,15 @@ public function registration($paymentFrameOrigin = null, $preventAsyncRedirect =
* Because of the payment card industriy restictions (Aka pci3) you have
* to use a payment frame for the input of credit card information
*/
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
$this->getRequest()->getFrontend()->setCssPath($cssPath);
if ($paymentFrameOrigin !== null) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
}
if ($preventAsyncRedirect !== $this->getRequest()->getFrontend()->getPreventAsyncRedirect()) {
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
}
if ($cssPath !== null) {
$this->getRequest()->getFrontend()->setCssPath($cssPath);
}

return $this->registrationParent();
}
Expand All @@ -150,23 +167,29 @@ public function registration($paymentFrameOrigin = null, $preventAsyncRedirect =
* to use a payment frame solution to handle the customers credit card information.
*
* @param mixed $referenceId
* @param null|mixed $PaymentFrameOrigin uri of your application like http://dev.heidelpay.com
* @param mixed $PreventAsyncRedirect prevention of redirecting the customer
* @param null|mixed $CssPath css url to style the Heidelpay payment frame
* @param null|mixed $paymentFrameOrigin uri of your application like http://dev.heidelpay.com
* @param mixed $preventAsyncRedirect prevention of redirecting the customer
* @param null|mixed $cssPath css url to style the Heidelpay payment frame
*
* @return ReregistrationTransactionType
*
* @throws \Exception
*/
public function reregistration(
$referenceId,
$PaymentFrameOrigin = null,
$PreventAsyncRedirect = 'FALSE',
$CssPath = null
$paymentFrameOrigin = null,
$preventAsyncRedirect = 'FALSE',
$cssPath = null
) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($PaymentFrameOrigin);
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($PreventAsyncRedirect);
$this->getRequest()->getFrontend()->setCssPath($CssPath);
if ($paymentFrameOrigin !== null) {
$this->getRequest()->getFrontend()->setPaymentFrameOrigin($paymentFrameOrigin);
}
if ($preventAsyncRedirect !== $this->getRequest()->getFrontend()->getPreventAsyncRedirect()) {
$this->getRequest()->getFrontend()->setPreventAsyncRedirect($preventAsyncRedirect);
}
if ($cssPath !== null) {
$this->getRequest()->getFrontend()->setCssPath($cssPath);
}

return $this->reregistrationParent($referenceId);
}
Expand Down
4 changes: 0 additions & 4 deletions lib/PaymentMethods/DirectDebitB2CSecuredPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
use Heidelpay\PhpPaymentApi\TransactionTypes\ReversalTransactionType;
use Heidelpay\PhpPaymentApi\TransactionTypes\CaptureTransactionType;
use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType;
use Heidelpay\PhpPaymentApi\TransactionTypes\FinalizeTransactionType;

/**
* Direct debit secured for B2C payment Class
*
* Direct debit secured for B2C payment method
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
Expand All @@ -42,7 +39,6 @@ class DirectDebitB2CSecuredPaymentMethod implements PaymentMethodInterface
use ReversalTransactionType;
use CaptureTransactionType;
use RebillTransactionType;
use FinalizeTransactionType;

/**
* @var string Payment Code for this payment method
Expand Down
2 changes: 0 additions & 2 deletions lib/PaymentMethods/DirectDebitPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use Heidelpay\PhpPaymentApi\TransactionTypes\RebillTransactionType;

/**
* Direct debit payment Class
*
* Direct debit payment method
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
Expand Down
2 changes: 0 additions & 2 deletions lib/PaymentMethods/EPSPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType;

/**
* EPS Payment Class
*
* EPS is a payment method in Austria.
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
Expand Down
2 changes: 0 additions & 2 deletions lib/PaymentMethods/GiropayPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType;

/**
* Giropay Payment Class
*
* Giropay is a payment method from giropay GmbH in Germany.
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
Expand Down
2 changes: 0 additions & 2 deletions lib/PaymentMethods/IDealPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use Heidelpay\PhpPaymentApi\TransactionTypes\RefundTransactionType;

/**
* iDeal Payment Class
*
* iDeal is a online payment method in the netherlands.
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
Expand Down
2 changes: 0 additions & 2 deletions lib/PaymentMethods/InvoiceB2CSecuredPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use Heidelpay\PhpPaymentApi\TransactionTypes\FinalizeTransactionType;

/**
* Invoice B2C secured Payment Class
*
* This payment method is for the secured B2C invoice.
*
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
Expand Down
Loading

0 comments on commit f3bea9b

Please sign in to comment.