diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..eed12a0
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+* text=auto
+
+*.http text eol=crlf
diff --git a/.travis.yml b/.travis.yml
index 9e2b6a2..cbdc760 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,21 +1,22 @@
language: php
-
php:
- - 5.3
- - 5.4
- - 5.5
- - hhvm
-
+- 5.3
+- 5.4
+- 5.5
env:
+ matrix:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=latest WP_MULTISITE=1
- WP_VERSION=3.5.1 WP_MULTISITE=0
- WP_VERSION=3.5.1 WP_MULTISITE=1
-
+ global:
+ - secure: GZuBoHlpcrgIBwu4Y254Enq2ahpC36jnyXhB2YJLI1+3xqmf4qq7IjxuOLmZkIHA/VCls7L7+avarrw/lT/z7ZeaCVJ0x/oK34WcHm84dP21wIe+jPlom7TN1leWTNbqAXfrrYvQJGEF9JweKw5WWRBhvXtgXiT2ckvBijuVAdA=
+ - secure: DAcE4hAgVJPQOU+qvU77S6rseu+9Mc9sKamPZRUEVNFY+xU/B5ZuVivRJd0VtGHzgRqsZXRMXih96Nau5TSSxV28C/Sd8bnu0VzA1UnV07uKhwOyb7vRi+KbdNN0ICFPuqw7RFgoqytV4BpKRer+ZQDohpN7XdiBumrrrBREZyk=
+ - secure: OgtWjiebuZowAhHEthCbFocW/4LnapqqXNlZr9+KI93IgpHoubiimO0WSNL3S2//CO47qyuENNYOmUQWlXcQ1qIlhB/fzZ911CDU0oT2f1CSFihoUemRXRXYbuXHD52kT7eQttqHYCVmPWeH++B5r7kzYa2kNgP9fCJ3Vk29nCc=
+ - secure: h3rVFMIzYoTE9Y/WEhVUKV1LU7Oq5m0MI/2ufTTR+yFrX9qIX08QbE6ZnDvCihOVDCDT0rx6AcnaB+u1ay2gTsedmHw44GJbI37xiLFx+C9F6edXtTjlUkF/WG/06N/NYmb1lsxb2sgmMXl8vOcT1CpBnvxr07eDpzGG534fdXQ=
before_script:
- - composer install
- - wget https://raw.githubusercontent.com/wp-cli/sample-plugin/master/bin/install-wp-tests.sh
- - bash install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
-
+- composer install
+- wget https://raw.githubusercontent.com/wp-cli/sample-plugin/master/bin/install-wp-tests.sh
+- bash install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
after_script:
- - php vendor/bin/coveralls
+- php vendor/bin/coveralls
diff --git a/CHANGELOG.md b/CHANGELOG.md
index baa1918..074bfed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog
+## 1.2.0
+* Added support for direct transaction request for iDEAL.
+
## 1.1.1
* Updated WordPress pay core library to version 1.1.1.
* If payment description is empty the payment ID is used.
diff --git a/Gruntfile.js b/Gruntfile.js
index 210c38f..3fa6f18 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -12,12 +12,16 @@ module.exports = function( grunt ) {
// PHP Code Sniffer
phpcs: {
application: {
- dir: [ 'src', 'tests' ],
+ src: [
+ 'src/**/*',
+ 'tests/**/*',
+ '!tests/Mock/**',
+ '!node_modules/**',
+ '!vendor/**'
+ ],
},
options: {
- standard: 'phpcs.ruleset.xml',
- extensions: 'php',
- ignore: 'node_modules'
+ standard: 'phpcs.ruleset.xml'
}
},
diff --git a/README.md b/README.md
index 222d6f8..37baaa8 100644
--- a/README.md
+++ b/README.md
@@ -3,14 +3,16 @@
**MultiSafepay Connect driver for the WordPress payment processing library.**
[![Build Status](https://travis-ci.org/wp-pay-gateways/multisafepay-connect.svg?branch=develop)](https://travis-ci.org/wp-pay-gateways/multisafepay-connect)
-[![Coverage Status](https://coveralls.io/repos/wp-pay-gateways/multisafepay-connect/badge.png?branch=develop)](https://coveralls.io/r/wp-pay-gateways/multisafepay-connect?branch=develop)
-[![Latest Stable Version](https://poser.pugx.org/wp-pay-gateways/multisafepay-connect/v/stable.svg)](https://packagist.org/packages/wp-pay-gateways/multisafepay-connect)
-[![Total Downloads](https://poser.pugx.org/wp-pay-gateways/multisafepay-connect/downloads.svg)](https://packagist.org/packages/wp-pay-gateways/multisafepay-connect)
-[![Latest Unstable Version](https://poser.pugx.org/wp-pay-gateways/multisafepay-connect/v/unstable.svg)](https://packagist.org/packages/wp-pay-gateways/multisafepay-connect)
-[![License](https://poser.pugx.org/wp-pay-gateways/multisafepay-connect/license.svg)](https://packagist.org/packages/wp-pay-gateways/multisafepay-connect)
+[![Coverage Status](https://coveralls.io/repos/wp-pay-gateways/multisafepay-connect/badge.svg?branch=develop)](https://coveralls.io/r/wp-pay-gateways/multisafepay-connect?branch=develop)
+[![Latest Stable Version](https://poser.pugx.org/wp-pay-gateways/multisafepay-connect/v/stable)](https://packagist.org/packages/wp-pay-gateways/multisafepay-connect)
+[![Total Downloads](https://poser.pugx.org/wp-pay-gateways/multisafepay-connect/downloads)](https://packagist.org/packages/wp-pay-gateways/multisafepay-connect)
+[![Latest Unstable Version](https://poser.pugx.org/wp-pay-gateways/multisafepay-connect/v/unstable)](https://packagist.org/packages/wp-pay-gateways/multisafepay-connect)
+[![License](https://poser.pugx.org/wp-pay-gateways/multisafepay-connect/license)](https://packagist.org/packages/wp-pay-gateways/multisafepay-connect)
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
## Documentation
* [MultiSafepay](https://multisafepay.com/)
* [MultiSafepay API](https://multisafepay.com/nl/Artikelen-Support-Zakelijk/asp-en-php-download-zakelijk.html)
+ * [MutliSafepay - Implementation manual Connect (UK)](http://www.wp-pay.org/wp-content/uploads/2015/04/multisafepay-connect-en.pdf)
+ * [MultiSafepay Implementatie handleiding Connect (NL)](http://www.wp-pay.org/wp-content/uploads/2015/04/multisafepay-connect-nl.pdf)
diff --git a/composer.json b/composer.json
index 1ead690..5e940c3 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,7 @@
},
"require": {
"php": ">=5.2.4",
- "wp-pay/core": ">=1.2.0",
+ "wp-pay/core": ">=1.2.1",
"wp-pay-gateways/multisafepay": ">=1.1.1"
},
"require-dev": {
diff --git a/composer.lock b/composer.lock
index 8b0fa3d..8b044bd 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "fd3e777da81c2c4adf12f150fbf49fc8",
+ "hash": "ae7ff658e00a5dce199fb8e59a5e4cf2",
"packages": [
{
"name": "wp-pay-gateways/multisafepay",
@@ -66,16 +66,16 @@
},
{
"name": "wp-pay/core",
- "version": "1.2.0",
+ "version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/wp-pay/core.git",
- "reference": "dcbe422c099b4d3471fa863fe81bbc329ca435b9"
+ "reference": "d40c40f742e5bddea6e10751b515c865fb56915f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/wp-pay/core/zipball/dcbe422c099b4d3471fa863fe81bbc329ca435b9",
- "reference": "dcbe422c099b4d3471fa863fe81bbc329ca435b9",
+ "url": "https://api.github.com/repos/wp-pay/core/zipball/d40c40f742e5bddea6e10751b515c865fb56915f",
+ "reference": "d40c40f742e5bddea6e10751b515c865fb56915f",
"shasum": ""
},
"require": {
@@ -115,7 +115,7 @@
"wordpress",
"wp"
],
- "time": "2015-03-26 13:39:06"
+ "time": "2015-04-29 14:48:49"
}
],
"packages-dev": [
@@ -329,17 +329,17 @@
},
{
"name": "symfony/config",
- "version": "v2.6.5",
+ "version": "v2.6.6",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
- "reference": "7a47189c7667ca69bcaafd19ef8a8941db449a2c"
+ "reference": "d91be01336605db8da21b79bc771e46a7276d1bc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Config/zipball/7a47189c7667ca69bcaafd19ef8a8941db449a2c",
- "reference": "7a47189c7667ca69bcaafd19ef8a8941db449a2c",
+ "url": "https://api.github.com/repos/symfony/Config/zipball/d91be01336605db8da21b79bc771e46a7276d1bc",
+ "reference": "d91be01336605db8da21b79bc771e46a7276d1bc",
"shasum": ""
},
"require": {
@@ -376,21 +376,21 @@
],
"description": "Symfony Config Component",
"homepage": "http://symfony.com",
- "time": "2015-03-12 10:28:44"
+ "time": "2015-03-30 15:54:10"
},
{
"name": "symfony/console",
- "version": "v2.6.5",
+ "version": "v2.6.6",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
- "reference": "53f86497ccd01677e22435cfb7262599450a90d1"
+ "reference": "5b91dc4ed5eb08553f57f6df04c4730a73992667"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Console/zipball/53f86497ccd01677e22435cfb7262599450a90d1",
- "reference": "53f86497ccd01677e22435cfb7262599450a90d1",
+ "url": "https://api.github.com/repos/symfony/Console/zipball/5b91dc4ed5eb08553f57f6df04c4730a73992667",
+ "reference": "5b91dc4ed5eb08553f57f6df04c4730a73992667",
"shasum": ""
},
"require": {
@@ -434,11 +434,11 @@
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
- "time": "2015-03-13 17:37:22"
+ "time": "2015-03-30 15:54:10"
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.6.5",
+ "version": "v2.6.6",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
@@ -497,17 +497,17 @@
},
{
"name": "symfony/filesystem",
- "version": "v2.6.5",
+ "version": "v2.6.6",
"target-dir": "Symfony/Component/Filesystem",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem.git",
- "reference": "fdc5f151bc2db066b51870d5bea3773d915ced0b"
+ "reference": "4983964b3693e4f13449cb3800c64a9112c301b4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Filesystem/zipball/fdc5f151bc2db066b51870d5bea3773d915ced0b",
- "reference": "fdc5f151bc2db066b51870d5bea3773d915ced0b",
+ "url": "https://api.github.com/repos/symfony/Filesystem/zipball/4983964b3693e4f13449cb3800c64a9112c301b4",
+ "reference": "4983964b3693e4f13449cb3800c64a9112c301b4",
"shasum": ""
},
"require": {
@@ -543,21 +543,21 @@
],
"description": "Symfony Filesystem Component",
"homepage": "http://symfony.com",
- "time": "2015-03-12 10:28:44"
+ "time": "2015-03-22 16:55:57"
},
{
"name": "symfony/stopwatch",
- "version": "v2.6.5",
+ "version": "v2.6.6",
"target-dir": "Symfony/Component/Stopwatch",
"source": {
"type": "git",
"url": "https://github.com/symfony/Stopwatch.git",
- "reference": "ba4e774f71e2ce3e3f65cabac4031b9029972af5"
+ "reference": "5f196e84b5640424a166d2ce9cca161ce1e9d912"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/ba4e774f71e2ce3e3f65cabac4031b9029972af5",
- "reference": "ba4e774f71e2ce3e3f65cabac4031b9029972af5",
+ "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/5f196e84b5640424a166d2ce9cca161ce1e9d912",
+ "reference": "5f196e84b5640424a166d2ce9cca161ce1e9d912",
"shasum": ""
},
"require": {
@@ -593,21 +593,21 @@
],
"description": "Symfony Stopwatch Component",
"homepage": "http://symfony.com",
- "time": "2015-02-24 11:52:21"
+ "time": "2015-03-22 16:55:57"
},
{
"name": "symfony/yaml",
- "version": "v2.6.5",
+ "version": "v2.6.6",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "0cd8e72071e46e15fc072270ae39ea1b66b10a9d"
+ "reference": "174f009ed36379a801109955fc5a71a49fe62dd4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/0cd8e72071e46e15fc072270ae39ea1b66b10a9d",
- "reference": "0cd8e72071e46e15fc072270ae39ea1b66b10a9d",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/174f009ed36379a801109955fc5a71a49fe62dd4",
+ "reference": "174f009ed36379a801109955fc5a71a49fe62dd4",
"shasum": ""
},
"require": {
@@ -643,7 +643,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
- "time": "2015-03-12 10:28:44"
+ "time": "2015-03-30 15:54:10"
}
],
"aliases": [],
diff --git a/package.json b/package.json
index 97e2a5a..ec03545 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "multisafepay-connect",
- "version": "1.1.1",
+ "version": "1.2.0",
"description": "MultiSafepay Connect driver for the WordPress payment processing library.",
"repository": {
"type": "git",
@@ -37,7 +37,7 @@
"grunt": "~0.4.5",
"grunt-phplint": "0.0.5",
"grunt-phpmd": "^0.1.1",
- "grunt-phpcs": "^0.2.3",
- "grunt-contrib-jshint": "^0.11.0"
+ "grunt-phpcs": "^0.4.0",
+ "grunt-contrib-jshint": "^0.11.2"
}
}
diff --git a/phpcs.ruleset.xml b/phpcs.ruleset.xml
index 10076c9..0b4f0c5 100644
--- a/phpcs.ruleset.xml
+++ b/phpcs.ruleset.xml
@@ -5,4 +5,8 @@
+
+
+ */tests/*
+
diff --git a/src/Client.php b/src/Client.php
index 1f37b79..619ea2d 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -49,10 +49,16 @@ public function get_error() {
private function parse_xml( $xml ) {
switch ( $xml->getName() ) {
- case Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionRequestMessage::NAME:
- return Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionResponseMessage::parse( $xml );;
- case Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_StatusRequestMessage::NAME:
- return Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_StatusResponseMessage::parse( $xml );;
+ case Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_IDealIssuersRequestMessage::NAME :
+ return Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_IDealIssuersResponseMessage::parse( $xml );
+ case Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_GatewaysRequestMessage::NAME :
+ return Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_GatewaysResponseMessage::parse( $xml );
+ case Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionRequestMessage::NAME :
+ return Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionResponseMessage::parse( $xml );
+ case Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionRequestMessage::NAME :
+ return Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionResponseMessage::parse( $xml );
+ case Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_StatusRequestMessage::NAME :
+ return Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_StatusResponseMessage::parse( $xml );
}
return false;
@@ -60,10 +66,10 @@ private function parse_xml( $xml ) {
/////////////////////////////////////////////////
- private function reuqest( $message ) {
+ private function request( $message ) {
$return = false;
- $result = Pronamic_WP_Util::remote_get_body( $this->api_url, 200, array(
+ $result = Pronamic_WP_Pay_Util::remote_get_body( $this->api_url, 200, array(
'method' => 'POST',
'body' => (string) $message,
) );
@@ -71,7 +77,7 @@ private function reuqest( $message ) {
if ( is_wp_error( $result ) ) {
$this->error = $result;
} else {
- $xml = Pronamic_WP_Util::simplexml_load_string( $result );
+ $xml = Pronamic_WP_Pay_Util::simplexml_load_string( $result );
if ( is_wp_error( $xml ) ) {
$this->error = $xml;
@@ -85,6 +91,36 @@ private function reuqest( $message ) {
/////////////////////////////////////////////////
+ /**
+ * Get iDEAL issuers
+ *
+ * @since 1.2.0
+ */
+ public function get_ideal_issuers( $merchant ) {
+ $request = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_IDealIssuersRequestMessage( $merchant );
+
+ $response = $this->request( $request );
+
+ return $response->issuers;
+ }
+
+ /////////////////////////////////////////////////
+
+ /**
+ * Get gateways
+ *
+ * @since 1.2.0
+ */
+ public function get_gateways( $merchant, $customer ) {
+ $request = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_GatewaysRequestMessage( $merchant, $customer );
+
+ $response = $this->request( $request );
+
+ return $response->gateways;
+ }
+
+ /////////////////////////////////////////////////
+
/**
* Start transaction
*
@@ -93,12 +129,10 @@ private function reuqest( $message ) {
public function start_transaction( $message ) {
$return = false;
- $response = $this->reuqest( $message );
+ $response = $this->request( $message );
if ( $response ) {
- $transaction = $response->transaction;
-
- $return = $transaction;
+ $return = $response;
}
return $return;
@@ -114,7 +148,7 @@ public function start_transaction( $message ) {
public function get_status( $message ) {
$return = false;
- $response = $this->reuqest( $message );
+ $response = $this->request( $message );
if ( $response ) {
$return = $response;
diff --git a/src/Gateway.php b/src/Gateway.php
index 44eba97..304af3a 100644
--- a/src/Gateway.php
+++ b/src/Gateway.php
@@ -33,7 +33,53 @@ public function __construct( Pronamic_WP_Pay_Gateways_MultiSafepay_Config $confi
$this->set_slug( self::SLUG );
$this->client = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Client();
- $this->client->api_url = $config->api_url;
+ $this->client->api_url = $config->api_url;
+ }
+
+ /////////////////////////////////////////////////
+
+ /**
+ * Get issuers
+ *
+ * @see Pronamic_WP_Pay_Gateway::get_issuers()
+ * @since 1.2.0
+ */
+ public function get_issuers() {
+ $groups = array();
+
+ // Merchant
+ $merchant = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Merchant();
+ $merchant->account = $this->config->account_id;
+ $merchant->site_id = $this->config->site_id;
+ $merchant->site_secure_code = $this->config->site_code;
+
+ $result = $this->client->get_ideal_issuers( $merchant );
+
+ if ( $result ) {
+ $groups[] = array(
+ 'options' => $result,
+ );
+ }
+
+ return $groups;
+ }
+
+ /////////////////////////////////////////////////
+
+ /**
+ * Get issuer field
+ *
+ * @since 1.2.0
+ */
+ public function get_issuer_field() {
+ return array(
+ 'id' => 'pronamic_ideal_issuer_id',
+ 'name' => 'pronamic_ideal_issuer_id',
+ 'label' => __( 'Choose your bank', 'pronamic_ideal' ),
+ 'required' => true,
+ 'type' => 'select',
+ 'choices' => $this->get_transient_issuers()
+ );
}
/////////////////////////////////////////////////
@@ -61,14 +107,6 @@ public function start( Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Pay
$customer->ip_address = Pronamic_WP_Pay_Server::get( 'REMOTE_ADDR', FILTER_VALIDATE_IP );
$customer->forwarded_ip = Pronamic_WP_Pay_Server::get( 'HTTP_X_FORWARDED_FOR', FILTER_VALIDATE_IP );
$customer->first_name = $data->getCustomerName();
- $customer->last_name = '';
- $customer->address_1 = 'Test';
- $customer->address_2 = '';
- $customer->house_number = '1';
- $customer->zip_code = '1234 AB';
- $customer->city = 'Test';
- $customer->country = 'Test';
- $customer->phone = '';
$customer->email = $data->get_email();
$transaction = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Transaction();
@@ -76,29 +114,36 @@ public function start( Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Pay
$transaction->currency = $data->get_currency();
$transaction->amount = $data->get_amount();
$transaction->description = $transaction_description;
- $transaction->var1 = '';
- $transaction->var2 = '';
- $transaction->var3 = '';
- $transaction->items = '';
- $transaction->manual = 'false';
- $transaction->gateway = '';
- $transaction->days_active = '';
- $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionRequestMessage( $merchant, $customer, $transaction );
+ if ( Pronamic_WP_Pay_PaymentMethods::IDEAL === $payment_method ) {
+ $gateway_info = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_GatewayInfo();
+ $gateway_info->issuer_id = $data->get_issuer_id();
- global $pronamic_pay_version;
+ $transaction->gateway = Pronamic_WP_Pay_Gateways_MultiSafepay_Gateways::IDEAL;
- $message->set_user_agent( 'Pronamic Pay' . ' ' . $pronamic_pay_version );
+ $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionRequestMessage( $merchant, $customer, $transaction, $gateway_info );
+ } else {
+ $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionRequestMessage( $merchant, $customer, $transaction );
+ }
$signature = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Signature::generate( $transaction->amount, $transaction->currency, $merchant->account, $merchant->site_id, $transaction->id );
$message->signature = $signature;
- $result = $this->client->start_transaction( $message );
+ $response = $this->client->start_transaction( $message );
- if ( $result ) {
- $payment->set_transaction_id( $result->id );
- $payment->set_action_url( $result->payment_url );
+ if ( $response ) {
+ $transaction = $response->transaction;
+
+ $payment->set_transaction_id( $transaction->id );
+
+ if ( $transaction->payment_url ) {
+ $payment->set_action_url( $result->payment_url );
+ }
+
+ if ( $response->gateway_info && $response->gateway_info->redirect_url ) {
+ $payment->set_action_url( $response->gateway_info->redirect_url );
+ }
} else {
$this->error = $this->client->get_error();
}
diff --git a/src/GatewayInfo.php b/src/GatewayInfo.php
new file mode 100644
index 0000000..c1730c7
--- /dev/null
+++ b/src/GatewayInfo.php
@@ -0,0 +1,18 @@
+merchant = $merchant;
+ $this->customer = $customer;
+ $this->transaction = $transaction;
+ $this->gateway_info = $gateway_info;
+ }
+
+ //////////////////////////////////////////////////
+
+ /**
+ * Get document
+ *
+ * @see Pronamic_Gateways_IDealAdvancedV3_XML_RequestMessage::get_document()
+ */
+ public function get_document() {
+ $document = parent::get_document();
+
+ // Root
+ $root = $document->documentElement;
+
+ // Merchant
+ $merchant = $this->merchant;
+
+ $element = Pronamic_WP_Pay_XML_Util::add_element( $document, $document->documentElement, 'merchant' );
+ Pronamic_WP_Pay_XML_Util::add_elements( $document, $element, array(
+ 'account' => $merchant->account,
+ 'site_id' => $merchant->site_id,
+ 'site_secure_code' => $merchant->site_secure_code,
+ 'notification_url' => $merchant->notification_url,
+ 'redirect_url' => $merchant->redirect_url,
+ 'cancel_url' => $merchant->cancel_url,
+ 'close_window' => $merchant->close_window,
+ ) );
+
+ // Customer
+ $customer = $this->customer;
+
+ $element = Pronamic_WP_Pay_XML_Util::add_element( $document, $document->documentElement, 'customer' );
+ Pronamic_WP_Pay_XML_Util::add_elements( $document, $element, array(
+ 'locale' => $customer->locale,
+ 'ipaddress' => $customer->ip_address,
+ 'forwardedip' => $customer->forwarded_ip,
+ 'firstname' => $customer->first_name,
+ 'lastname' => $customer->last_name,
+ 'address1' => $customer->address_1,
+ 'address2' => $customer->address_2,
+ 'housenumber' => $customer->house_number,
+ 'zipcode' => $customer->zip_code,
+ 'city' => $customer->city,
+ 'country' => $customer->country,
+ 'phone' => $customer->phone,
+ 'email' => $customer->email,
+ ) );
+
+ // Transaction
+ $transaction = $this->transaction;
+
+ $element = Pronamic_WP_Pay_XML_Util::add_element( $document, $document->documentElement, 'transaction' );
+ Pronamic_WP_Pay_XML_Util::add_elements( $document, $element, array(
+ 'id' => $transaction->id,
+ 'currency' => $transaction->currency,
+ 'amount' => Pronamic_WP_Pay_Util::amount_to_cents( $transaction->amount ),
+ 'description' => $transaction->description,
+ 'var1' => $transaction->var1,
+ 'var2' => $transaction->var2,
+ 'var3' => $transaction->var3,
+ 'items' => $transaction->items,
+ 'manual' => $transaction->manual,
+ 'gateway' => $transaction->gateway,
+ 'daysactive' => $transaction->days_active,
+ ) );
+
+ // Gateway info
+ if ( $this->gateway_info ) {
+ $gateway_info = $this->gateway_info;
+
+ $element = Pronamic_WP_Pay_XML_Util::add_element( $document, $document->documentElement, 'gatewayinfo' );
+ Pronamic_WP_Pay_XML_Util::add_elements( $document, $element, array(
+ 'issuerid' => $gateway_info->issuer_id,
+ ) );
+ }
+
+ // Signature
+ $element = Pronamic_WP_Pay_XML_Util::add_element( $document, $document->documentElement, 'signature', $this->signature );
+
+ // Return
+ return $document;
+ }
+}
diff --git a/src/XML/DirectTransactionResponseMessage.php b/src/XML/DirectTransactionResponseMessage.php
new file mode 100644
index 0000000..f87c9e5
--- /dev/null
+++ b/src/XML/DirectTransactionResponseMessage.php
@@ -0,0 +1,40 @@
+result = Pronamic_WP_Pay_XML_Security::filter( $xml['result'] );
+
+ // Transaction
+ $message->transaction = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_TransactionParser::parse( $xml->transaction );
+
+ // Gateway info
+ if ( $xml->gatewayinfo ) {
+ $message->gateway_info = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_GatewayInfo();
+ $message->gateway_info->redirect_url = Pronamic_WP_Pay_XML_Security::filter( $xml->gatewayinfo->redirecturl );
+ $message->gateway_info->ext_var = Pronamic_WP_Pay_XML_Security::filter( $xml->gatewayinfo->extvar );
+ $message->gateway_info->issuer_id = Pronamic_WP_Pay_XML_Security::filter( $xml->gatewayinfo->issuerid );
+ }
+
+ // Return
+ return $message;
+ }
+}
diff --git a/src/XML/GatewaysRequestMessage.php b/src/XML/GatewaysRequestMessage.php
new file mode 100644
index 0000000..c8350e6
--- /dev/null
+++ b/src/XML/GatewaysRequestMessage.php
@@ -0,0 +1,67 @@
+merchant = $merchant;
+ $this->customer = $customer;
+ }
+
+ //////////////////////////////////////////////////
+
+ /**
+ * Get document
+ *
+ * @see Pronamic_Gateways_IDealAdvancedV3_XML_RequestMessage::get_document()
+ */
+ public function get_document() {
+ $document = parent::get_document();
+
+ // Root
+ $root = $document->documentElement;
+
+ // Merchant
+ $merchant = $this->merchant;
+
+ $element = Pronamic_WP_Pay_XML_Util::add_element( $document, $document->documentElement, 'merchant' );
+ Pronamic_WP_Pay_XML_Util::add_elements( $document, $element, array(
+ 'account' => $merchant->account,
+ 'site_id' => $merchant->site_id,
+ 'site_secure_code' => $merchant->site_secure_code,
+ ) );
+
+ // Customer
+ $customer = $this->customer;
+
+ $element = Pronamic_WP_Pay_XML_Util::add_element( $document, $document->documentElement, 'customer' );
+ Pronamic_WP_Pay_XML_Util::add_elements( $document, $element, array(
+ 'country' => $customer->country,
+ 'locale' => $customer->locale,
+ ) );
+
+ // Return
+ return $document;
+ }
+}
diff --git a/src/XML/GatewaysResponseMessage.php b/src/XML/GatewaysResponseMessage.php
new file mode 100644
index 0000000..2e5786c
--- /dev/null
+++ b/src/XML/GatewaysResponseMessage.php
@@ -0,0 +1,34 @@
+gateways = array();
+
+ foreach ( $xml->gateways->gateway as $gateway ) {
+ $id = Pronamic_WP_Pay_XML_Security::filter( $gateway->id );
+ $description = Pronamic_WP_Pay_XML_Security::filter( $gateway->description );
+
+ $message->gateways[ $id ] = $description;
+ }
+
+ return $message;
+ }
+}
diff --git a/src/XML/IDealIssuersRequestMessage.php b/src/XML/IDealIssuersRequestMessage.php
new file mode 100644
index 0000000..60b464e
--- /dev/null
+++ b/src/XML/IDealIssuersRequestMessage.php
@@ -0,0 +1,57 @@
+merchant = $merchant;
+ }
+
+ //////////////////////////////////////////////////
+
+ /**
+ * Get document
+ *
+ * @see Pronamic_Gateways_IDealAdvancedV3_XML_RequestMessage::get_document()
+ */
+ public function get_document() {
+ $document = parent::get_document();
+
+ // Root
+ $root = $document->documentElement;
+
+ // Merchant
+ $merchant = $this->merchant;
+
+ $element = Pronamic_WP_Pay_XML_Util::add_element( $document, $document->documentElement, 'merchant' );
+ Pronamic_WP_Pay_XML_Util::add_elements( $document, $element, array(
+ 'account' => $merchant->account,
+ 'site_id' => $merchant->site_id,
+ 'site_secure_code' => $merchant->site_secure_code,
+ ) );
+
+ // Return
+ return $document;
+ }
+}
diff --git a/src/XML/IDealIssuersResponseMessage.php b/src/XML/IDealIssuersResponseMessage.php
new file mode 100644
index 0000000..f6d9400
--- /dev/null
+++ b/src/XML/IDealIssuersResponseMessage.php
@@ -0,0 +1,32 @@
+issuers = array();
+
+ foreach ( $xml->issuers->issuer as $issuer ) {
+ $code = Pronamic_WP_Pay_XML_Security::filter( $issuer->code );
+ $description = Pronamic_WP_Pay_XML_Security::filter( $issuer->description );
+
+ $message->issuers[ $code ] = $description;
+ }
+
+ return $message;
+ }
+}
diff --git a/src/XML/Message.php b/src/XML/Message.php
index 939c7d0..04d7638 100644
--- a/src/XML/Message.php
+++ b/src/XML/Message.php
@@ -3,10 +3,11 @@
/**
* Title: MultiSafepay Connect XML message
* Description:
- * Copyright: Copyright (c) 2005 - 2011
+ * Copyright: Copyright (c) 2005 - 2015
* Company: Pronamic
* @author Remco Tolsma
- * @version 1.0
+ * @version 1.0.0
+ * @since 1.0.0
*/
class Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_Message {
/**
@@ -48,6 +49,12 @@ class Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_Message {
*/
public function __construct( $name ) {
$this->name = $name;
+
+ // User Agent
+ // @since 1.2.0
+ global $pronamic_pay_version;
+
+ $this->set_user_agent( 'Pronamic Pay' . ' ' . $pronamic_pay_version );
}
//////////////////////////////////////////////////
diff --git a/src/XML/RedirectTransactionRequestMessage.php b/src/XML/RedirectTransactionRequestMessage.php
index 9c16b12..6e6c05e 100644
--- a/src/XML/RedirectTransactionRequestMessage.php
+++ b/src/XML/RedirectTransactionRequestMessage.php
@@ -1,12 +1,13 @@
assertInstanceOf( 'SimpleXMLElement', $simplexml );
+
+ return $simplexml;
+ }
+
+ /**
+ * @depends test_init
+ */
+ function test_parser( $simplexml ) {
+ $message = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionResponseMessage::parse( $simplexml );
+
+ $this->assertInstanceOf( 'Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionResponseMessage', $message );
+
+ return $message;
+ }
+
+ /**
+ * @depends test_parser
+ */
+ function test_values( $message ) {
+ $expected = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionResponseMessage();
+ $expected->result = 'ok';
+
+ $expected->transaction = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Transaction();
+ $expected->transaction->id = '554202bb33498';
+
+ $expected->gateway_info = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_GatewayInfo();
+ $expected->gateway_info->redirect_url = 'http://testpay.multisafepay.com/simulator/ideal?trxid=10447735643871196&ideal=prob&issuerid=3151&merchantReturnURL=https%3A%2F%2Ftestpay%2Emultisafepay%2Ecom%2Fdirect%2Fcomplete%2F%3Fid%3D9943038943576689';
+ $expected->gateway_info->ext_var = 'https://testpay.multisafepay.com/direct/complete/';
+ $expected->gateway_info->issuer_id = '3151';
+
+ $this->assertEquals( $expected, $message );
+ }
+}
diff --git a/tests/DirectTransactionTest.php b/tests/DirectTransactionTest.php
new file mode 100644
index 0000000..0df71aa
--- /dev/null
+++ b/tests/DirectTransactionTest.php
@@ -0,0 +1,117 @@
+mode = getenv( 'MULTISAFEPAY_MODE' );
+ $config->account_id = getenv( 'MULTISAFEPAY_ACCOUNT_ID' );
+ $config->site_id = getenv( 'MULTISAFEPAY_SITE_ID' );
+ $config->site_code = getenv( 'MULTISAFEPAY_SECURE_CODE' );
+
+ if ( 'test' === $config->mode ) {
+ $config->api_url = Pronamic_WP_Pay_Gateways_MultiSafepay_MultiSafepay::API_TEST_URL;
+ } else {
+ $config->api_url = Pronamic_WP_Pay_Gateways_MultiSafepay_MultiSafepay::API_PRODUCTION_URL;
+ }
+
+ // Client
+ $client = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Client();
+ $client->api_url = $config->api_url;
+
+ // Message
+ $merchant = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Merchant();
+ $merchant->account = $config->account_id;
+ $merchant->site_id = $config->site_id;
+ $merchant->site_secure_code = $config->site_code;
+ $merchant->notification_url = home_url();
+ $merchant->redirect_url = home_url();
+ $merchant->cancel_url = home_url();
+ $merchant->close_window = 'false';
+
+ $customer = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Customer();
+ $customer->locale = get_locale();
+ $customer->ip_address = Pronamic_WP_Pay_Server::get( 'REMOTE_ADDR', FILTER_VALIDATE_IP );
+ $customer->forwarded_ip = Pronamic_WP_Pay_Server::get( 'HTTP_X_FORWARDED_FOR', FILTER_VALIDATE_IP );
+ $customer->first_name = '';
+ $customer->last_name = '';
+ $customer->address_1 = 'Test';
+ $customer->address_2 = '';
+ $customer->house_number = '1';
+ $customer->zip_code = '1234 AB';
+ $customer->city = 'Test';
+ $customer->country = 'Test';
+ $customer->phone = '';
+ $customer->email = get_option( 'admin_email' );
+
+ $transaction = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Transaction();
+ $transaction->id = uniqid();
+ $transaction->currency = 'EUR';
+ $transaction->amount = 123;
+ $transaction->description = 'Test';
+ $transaction->var1 = '';
+ $transaction->var2 = '';
+ $transaction->var3 = '';
+ $transaction->items = '';
+ $transaction->manual = 'false';
+ $transaction->gateway = '';
+ $transaction->days_active = '';
+ $transaction->gateway = Pronamic_WP_Pay_Gateways_MultiSafepay_Gateways::IDEAL;
+ //$transaction->gateway = Pronamic_WP_Pay_Gateways_MultiSafepay_Gateways::MASTERCARD;
+ //$transaction->gateway = Pronamic_WP_Pay_Gateways_MultiSafepay_Gateways::BANK_TRANSFER;
+
+ //$gateway_info = null;
+ $gateway_info = new stdClass();
+ $gateway_info->issuer_id = '3151';
+
+ $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionRequestMessage( $merchant, $customer, $transaction, $gateway_info );
+
+ $signature = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Signature::generate( $transaction->amount, $transaction->currency, $merchant->account, $merchant->site_id, $transaction->id );
+
+ $message->signature = $signature;
+
+ // Response
+ $response = $client->start_transaction( $message );
+
+ // Expected
+ $expected = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionResponseMessage();
+ $expected->result = 'ok';
+
+ $expected->transaction = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Transaction();
+ $expected->transaction->id = '554202bb33498';
+
+ $expected->gateway_info = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_GatewayInfo();
+ $expected->gateway_info->issuer_id = '3151';
+ $expected->gateway_info->redirect_url = 'http://testpay.multisafepay.com/simulator/ideal?trxid=10447735643871196&ideal=prob&issuerid=3151&merchantReturnURL=https%3A%2F%2Ftestpay%2Emultisafepay%2Ecom%2Fdirect%2Fcomplete%2F%3Fid%3D9943038943576689';
+ $expected->gateway_info->ext_var = 'https://testpay.multisafepay.com/direct/complete/';
+
+ // Assert
+ $this->assertEquals( $expected, $response );
+ }
+}
diff --git a/tests/GatewayTest.php b/tests/GatewayTest.php
new file mode 100644
index 0000000..50bf0ca
--- /dev/null
+++ b/tests/GatewayTest.php
@@ -0,0 +1,54 @@
+mode = getenv( 'MULTISAFEPAY_MODE' );
+ $config->account_id = getenv( 'MULTISAFEPAY_ACCOUNT_ID' );
+ $config->site_id = getenv( 'MULTISAFEPAY_SITE_ID' );
+ $config->site_code = getenv( 'MULTISAFEPAY_SECURE_CODE' );
+
+ if ( 'test' === $config->mode ) {
+ $config->api_url = Pronamic_WP_Pay_Gateways_MultiSafepay_MultiSafepay::API_TEST_URL;
+ } else {
+ $config->api_url = Pronamic_WP_Pay_Gateways_MultiSafepay_MultiSafepay::API_PRODUCTION_URL;
+ }
+
+ $gateway = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Gateway( $config );
+
+ $issuers = $gateway->get_issuers();
+
+ $expected = array(
+ array(
+ 'options' => array(
+ '3151' => 'Test bank',
+ ),
+ ),
+ );
+
+ $this->assertEquals( $expected, $issuers );
+ }
+}
diff --git a/tests/GatewaysTest.php b/tests/GatewaysTest.php
new file mode 100644
index 0000000..c86cbfa
--- /dev/null
+++ b/tests/GatewaysTest.php
@@ -0,0 +1,73 @@
+mode = getenv( 'MULTISAFEPAY_MODE' );
+ $config->account_id = getenv( 'MULTISAFEPAY_ACCOUNT_ID' );
+ $config->site_id = getenv( 'MULTISAFEPAY_SITE_ID' );
+ $config->site_code = getenv( 'MULTISAFEPAY_SECURE_CODE' );
+
+ if ( 'test' === $config->mode ) {
+ $config->api_url = Pronamic_WP_Pay_Gateways_MultiSafepay_MultiSafepay::API_TEST_URL;
+ } else {
+ $config->api_url = Pronamic_WP_Pay_Gateways_MultiSafepay_MultiSafepay::API_PRODUCTION_URL;
+ }
+
+ // Client
+ $client = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Client();
+ $client->api_url = $config->api_url;
+
+ // Merchant
+ $merchant = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Merchant();
+ $merchant->account = $config->account_id;
+ $merchant->site_id = $config->site_id;
+ $merchant->site_secure_code = $config->site_code;
+
+ // Customer
+ $customer = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Customer();
+ $customer->locale = get_locale();
+
+ // Gateways
+ $gateways = $client->get_gateways( $merchant, $customer );
+
+ $expected = array(
+ 'VISA' => 'Visa',
+ 'GIROPAY' => 'Giropay',
+ 'PAYAFTER' => 'Pay After Delivery',
+ 'IDEAL' => 'iDEAL',
+ 'DIRECTBANK' => 'SOFORT Banking',
+ 'BANKTRANS' => 'Wire Transfer',
+ 'MASTERCARD' => 'MasterCard',
+ );
+
+ $this->assertEquals( $expected, $gateways );
+ }
+}
diff --git a/tests/IDealIssuersParserTest.php b/tests/IDealIssuersParserTest.php
new file mode 100644
index 0000000..b0c0674
--- /dev/null
+++ b/tests/IDealIssuersParserTest.php
@@ -0,0 +1,44 @@
+assertInstanceOf( 'SimpleXMLElement', $simplexml );
+
+ return $simplexml;
+ }
+
+ /**
+ * @depends test_init
+ */
+ function test_parser( $simplexml ) {
+ $message = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_IDealIssuersResponseMessage::parse( $simplexml );
+
+ $this->assertInstanceOf( 'Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_IDealIssuersResponseMessage', $message );
+
+ return $message;
+ }
+
+ /**
+ * @depends test_parser
+ */
+ function test_values( $message ) {
+ $expected = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_IDealIssuersResponseMessage();
+ $expected->issuers = array(
+ '0031' => 'ABN AMRO',
+ '0751' => 'SNS Bank',
+ '0721' => 'ING',
+ '0021' => 'Rabobank',
+ '0091' => 'Friesland Bank',
+ '0761' => 'ASN Bank',
+ '0771' => 'SNS Regio Bank',
+ '0511' => 'Triodos Bank',
+ '0161' => 'Van Lanschot Bankiers',
+ );
+
+ $this->assertEquals( $expected, $message );
+ }
+}
diff --git a/tests/Mock/direct-transaction-request.xml b/tests/Mock/direct-transaction-request.xml
new file mode 100644
index 0000000..2db3d96
--- /dev/null
+++ b/tests/Mock/direct-transaction-request.xml
@@ -0,0 +1,30 @@
+
+
+
+
+ 123
+ EUR
+ 123
+ Betaling voor uw bestelling bij uwwebwinkel.nl
+ IDEAL
+
+
+
+ 123456
+ 789
+ 112233
+ http://yourwebwinkel.com/?type=initial
+ http://yourwebwinkel.com /success.php
+ http://yourwebwinkel.com /checkout_shipping.php
+
+
+
+ 127.0.0.1
+
+
+
+ 0151
+
+
+ added5ba83e577c1b54f4cbbcc818fc3
+
diff --git a/tests/Mock/direct-transaction-response.http b/tests/Mock/direct-transaction-response.http
new file mode 100644
index 0000000..246b43d
--- /dev/null
+++ b/tests/Mock/direct-transaction-response.http
@@ -0,0 +1,10 @@
+HTTP/1.1 200 OK
+Date: Thu, 30 Apr 2015 10:25:39 GMT
+Server: Apache
+Accept-Ranges: bytes
+Content-Length: 589
+Connection: close
+Content-Type: text/xml
+
+
+554202bb334989943038943576689http://testpay.multisafepay.com/simulator/ideal?trxid=10447735643871196&ideal=prob&issuerid=3151&merchantReturnURL=https%3A%2F%2Ftestpay%2Emultisafepay%2Ecom%2Fdirect%2Fcomplete%2F%3Fid%3D9943038943576689https://testpay.multisafepay.com/direct/complete/3151
diff --git a/tests/Mock/direct-transaction-response.xml b/tests/Mock/direct-transaction-response.xml
new file mode 100644
index 0000000..182ccc0
--- /dev/null
+++ b/tests/Mock/direct-transaction-response.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ 554202bb33498
+
+
+ 9943038943576689
+
+
+ http://testpay.multisafepay.com/simulator/ideal?trxid=10447735643871196&ideal=prob&issuerid=3151&merchantReturnURL=https%3A%2F%2Ftestpay%2Emultisafepay%2Ecom%2Fdirect%2Fcomplete%2F%3Fid%3D9943038943576689
+ https://testpay.multisafepay.com/direct/complete/
+ 3151
+
+
diff --git a/tests/Mock/gateways-request.xml b/tests/Mock/gateways-request.xml
new file mode 100644
index 0000000..c0d7bf5
--- /dev/null
+++ b/tests/Mock/gateways-request.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ 123456
+ 789
+ 112233
+
+
+ NL
+ nl_NL
+
+
diff --git a/tests/Mock/gateways-response.http b/tests/Mock/gateways-response.http
new file mode 100644
index 0000000..d4aef5d
--- /dev/null
+++ b/tests/Mock/gateways-response.http
@@ -0,0 +1,11 @@
+HTTP/1.1 200 OK
+Date: Thu, 30 Apr 2015 12:08:56 GMT
+Server: Apache
+Accept-Ranges: bytes
+Content-Length: 629
+Connection: close
+Content-Type: text/xml
+
+
+VISAVisaGIROPAYGiropayPAYAFTERPay After DeliveryIDEALiDEALDIRECTBANKSOFORT BankingBANKTRANSWire TransferMASTERCARDMasterCard
+
diff --git a/tests/Mock/gateways-response.xml b/tests/Mock/gateways-response.xml
new file mode 100644
index 0000000..0fbea3a
--- /dev/null
+++ b/tests/Mock/gateways-response.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+ IDEAL
+ iDEAL
+
+
+ MASTERCARD
+ Visa via Multipay
+
+
+ BANKTRANS
+ Bank Transfer
+
+
+ VISA
+ Visa CreditCards
+
+
+
diff --git a/tests/Mock/ideal-issuers-request.xml b/tests/Mock/ideal-issuers-request.xml
new file mode 100644
index 0000000..5c8e621
--- /dev/null
+++ b/tests/Mock/ideal-issuers-request.xml
@@ -0,0 +1,9 @@
+
+
+
+
+ 123456
+ 789
+ 112233
+
+
diff --git a/tests/Mock/ideal-issuers-response.http b/tests/Mock/ideal-issuers-response.http
new file mode 100644
index 0000000..03fc058
--- /dev/null
+++ b/tests/Mock/ideal-issuers-response.http
@@ -0,0 +1,11 @@
+HTTP/1.1 200 OK
+Date: Wed, 29 Apr 2015 18:38:08 GMT
+Server: Apache
+Accept-Ranges: bytes
+Content-Length: 196
+Connection: close
+Content-Type: text/xml
+
+
+3151
Test bank
+
diff --git a/tests/Mock/ideal-issuers-response.xml b/tests/Mock/ideal-issuers-response.xml
new file mode 100644
index 0000000..b765ade
--- /dev/null
+++ b/tests/Mock/ideal-issuers-response.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+ 0031
+ ABN AMRO
+
+
+ 0751
+ SNS Bank
+
+
+ 0721
+ ING
+
+
+ 0021
+ Rabobank
+
+
+ 0091
+ Friesland Bank
+
+
+ 0761
+ ASN Bank
+
+
+ 0771
+ SNS Regio Bank
+
+
+ 0511
+ Triodos Bank
+
+
+ 0161
+ Van Lanschot Bankiers
+
+
+
\ No newline at end of file
diff --git a/tests/StatusesTest.php b/tests/StatusesTest.php
new file mode 100644
index 0000000..b7a05c9
--- /dev/null
+++ b/tests/StatusesTest.php
@@ -0,0 +1,34 @@
+assertEquals( $expected, $status );
+ }
+
+ public function status_matrix_provider() {
+ return array(
+ array( Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Statuses::COMPLETED, Pronamic_WP_Pay_Statuses::SUCCESS ),
+ array( Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Statuses::INITIALIZED, Pronamic_WP_Pay_Statuses::OPEN ),
+ array( Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Statuses::UNCLEARED, Pronamic_WP_Pay_Statuses::OPEN ),
+ array( Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Statuses::VOID, Pronamic_WP_Pay_Statuses::CANCELLED ),
+ array( Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Statuses::DECLINED, Pronamic_WP_Pay_Statuses::FAILURE ),
+ array( Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Statuses::REFUNDED, Pronamic_WP_Pay_Statuses::CANCELLED ),
+ array( Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Statuses::EXPIRED, Pronamic_WP_Pay_Statuses::EXPIRED ),
+ array( 'not existing response code', null ),
+ );
+ }
+}
\ No newline at end of file