Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed May 28, 2021
2 parents 1e01e6d + 448a47a commit 2124191
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 41 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## [Unreleased][unreleased]
-

## [2.2.0] - 2021-05-28
- Deprecated gateway in favor of DigiWallet.
- Improved error handling.
- Added documentation.

## [2.1.1] - 2021-04-26
- Happy 2021.

Expand Down Expand Up @@ -73,7 +78,8 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## 1.0.0 - 2015-01-19
- First release.

[unreleased]: https://github.com/wp-pay-gateways/targetpay/compare/2.1.1...HEAD
[unreleased]: https://github.com/wp-pay-gateways/targetpay/compare/2.2.0...HEAD
[2.2.0]: https://github.com/wp-pay-gateways/targetpay/compare/2.1.1...2.2.0
[2.1.1]: https://github.com/wp-pay-gateways/targetpay/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/wp-pay-gateways/targetpay/compare/2.0.3...2.1.0
[2.0.3]: https://github.com/wp-pay-gateways/targetpay/compare/2.0.2...2.0.3
Expand Down
9 changes: 9 additions & 0 deletions DEPRECATED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Deprecated

## Update May 6, 2021

> De naam ‘DigiWallet’ bestaat nog niet lang. Sinds april 2018 is de naam ‘DigiWallet’ actief geworden. Echter bieden wij al veel langer betaaloplossingen. Dit deden wij alleen onder de naam TargetPay. Nu vraag jij je vast af: waarom de naam veranderen?
>
> TargetPay bood naast betaalmethodes voor de bank ook mobiele betalingen aan. Hierbij kun je denken aan 0900-nummers en afrekenen via betaalde SMS berichten. Deze mobiele diensten worden nu aangeboden via TeleConcept. Een andere nieuwe merknaam die zich specifiek richt op mobiele betalingen. DigiWallet houdt zich dus alleen bezig met betalingen via de bank.
**Source:** https://www.digiwallet.nl/nl/blog/wat-is-digiwallet
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wp-pay-gateways/targetpay",
"description": "TargetPay driver for the WordPress payment processing library.",
"keywords": ["wordpress", "wp", "pay", "targetpay", "gateway", "pronamic"],
"keywords": ["wordpress", "wp", "pay", "targetpay", "gateway", "pronamic", "deprecated"],
"homepage": "http://www.wp-pay.org/gateways/targetpay/",
"license": "GPL-3.0-or-later",
"authors": [
Expand Down
Binary file added docs/TargetPay_Bancontact_V1.2_nl.pdf
Binary file not shown.
Binary file added docs/TargetPay_iDEAL_V1.1_nl.pdf
Binary file not shown.
Binary file added docs/TargetPay_iDEAL_V3.0_nl.pdf
Binary file not shown.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "targetpay",
"version": "2.1.1",
"description": "TargetPay driver for the WordPress payment processing library.",
"version": "2.2.0",
"description": "✗ [DEPRECATED] TargetPay driver for the WordPress payment processing library.",
"repository": {
"type": "git",
"url": "https://github.com/wp-pay-gateways/targetpay"
Expand All @@ -12,7 +12,8 @@
"pay",
"targetpay",
"gateway",
"pronamic"
"pronamic",
"deprecated"
],
"author": {
"name": "Pronamic",
Expand Down
9 changes: 2 additions & 7 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Company: Pronamic
*
* @author Remco Tolsma
* @version 2.0.3
* @version 2.2.0
* @since 1.0.0
*/
class Client {
Expand Down Expand Up @@ -122,12 +122,7 @@ public function start_transaction( IDealStartParameters $parameters ) {

return $result;
} else {
$code = $status;
$description = substr( $data, 7 );

$error = new Error( $code, $description );

throw new \Exception( 'targetpay', (string) $error );
throw new Error( $data );
}
}
}
Expand Down
52 changes: 24 additions & 28 deletions src/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,57 +9,62 @@
* Company: Pronamic
*
* @author Remco Tolsma
* @version 2.0.0
* @version 2.2.0
* @since 1.0.0
*/
class Error {
class Error extends \Exception {
/**
* Code
* Error code.
*
* @var string
* @var string|null
*/
private $code;
private $error_code;

/**
* Description
* Description.
*
* @var string
* @var string|null
*/
private $description;

/**
* Constructs and initializes an TargetPay client object
* Constructs and initializes an TargetPay error.
*
* @param string $code Error code.
* @param string $description Error description.
* @param string $value Value.
*/
public function __construct( $code, $description ) {
$this->code = $code;
$this->description = $description;
public function __construct( $value ) {
parent::__construct( $value );

$space_position = \strpos( $value, ' ' );

if ( false !== $space_position ) {
$this->error_code = \substr( $value, 0, $space_position );
$this->description = \substr( $value, $space_position + 1 );
}
}

/**
* Get code.
*
* @return string
* @return string|null
*/
public function get_code() {
return $this->code;
return $this->error_code;
}

/**
* Set code.
*
* @param string $code Code.
* @param string|null $code Code.
*/
public function set_code( $code ) {
$this->code = $code;
$this->error_code = $code;
}

/**
* Get description.
*
* @return string
* @return string|null
*/
public function get_description() {
return $this->description;
Expand All @@ -68,18 +73,9 @@ public function get_description() {
/**
* Set description.
*
* @param string $description Description.
* @param string|null $description Description.
*/
public function set_description( $description ) {
$this->description = $description;
}

/**
* Create an string representation of this TargetPay error object.
*
* @return string
*/
public function __toString() {
return $this->get_code() . ' ' . $this->get_description();
}
}
3 changes: 2 additions & 1 deletion src/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Company: Pronamic
*
* @author Remco Tolsma
* @version 2.0.3
* @version 2.2.0
* @since 1.0.0
*/
class Integration extends AbstractGatewayIntegration {
Expand All @@ -30,6 +30,7 @@ public function __construct( $args = array() ) {
'dashboard_url' => 'https://www.targetpay.com/login',
'provider' => 'targetpay',
'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-targetpay-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ),
'deprecated' => true,
)
);

Expand Down
33 changes: 33 additions & 0 deletions tests/src/ErrorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Pronamic\WordPress\Pay\Gateways\TargetPay;

/**
* Title: TargetPay error test
* Description:
* Copyright: 2005-2021 Pronamic
* Company: Pronamic
*
* @author Remco Tolsma
* @version 2.2.0
* @since 2.0.0
*/
class ErrorTest extends \PHPUnit_Framework_TestCase {
/**
* Test error.
*/
public function test_error() {
$error = new Error( 'TP0001 No layoutcode specified' );

$this->assertEquals( 'TP0001', $error->get_code() );
}

/**
* Test invalid error.
*/
public function test_invalid_error() {
$error = new Error( '' );

$this->assertNull( $error->get_code() );
}
}

0 comments on commit 2124191

Please sign in to comment.