Skip to content

Commit e2cc5cc

Browse files
Update mercanet files
1 parent 0192ee0 commit e2cc5cc

11 files changed

+85
-57
lines changed

composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/composer/installed.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,15 +3251,15 @@
32513251
"source": {
32523252
"type": "git",
32533253
"url": "https://github.com/eileenmcnaughton/omnipay-mercanet.git",
3254-
"reference": "a9cdd239f8cd1e1c32bbe08b8d01a5d04d9394cf"
3254+
"reference": "6c6f08560ee59a2fd623c826164a0e838230349e"
32553255
},
32563256
"require": {
32573257
"omnipay/common": "~2.0"
32583258
},
32593259
"require-dev": {
32603260
"omnipay/tests": "~2.0"
32613261
},
3262-
"time": "2017-08-28T05:52:17+00:00",
3262+
"time": "2017-09-04T01:15:41+00:00",
32633263
"type": "library",
32643264
"installation-source": "source",
32653265
"autoload": {

vendor/fuzion/omnipay-mercanet/phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<phpunit backupGlobals="false"
33
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
4+
bootstrap="tests/phpunit/bootstrap.php"
55
colors="true"
66
convertErrorsToExceptions="true"
77
convertNoticesToExceptions="true"

vendor/fuzion/omnipay-mercanet/src/Message/OffsiteAbstractRequest.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ abstract class OffsiteAbstractRequest extends \Omnipay\Common\Message\AbstractRe
1313
/**
1414
* @param mixed $data
1515
*/
16-
public function setData($data) {
16+
public function setData($data)
17+
{
1718
$this->data = $data;
1819
}
1920

@@ -22,15 +23,17 @@ public function setData($data) {
2223
/**
2324
* @param mixed $seal
2425
*/
25-
public function setSeal($seal) {
26+
public function setSeal($seal)
27+
{
2628
$this->seal = $seal;
2729
}
2830

2931
protected $interfaceVersion;
3032
/**
3133
* @param mixed $interfaceVersion
3234
*/
33-
public function setInterfaceVersion($interfaceVersion) {
35+
public function setInterfaceVersion($interfaceVersion)
36+
{
3437
$this->interfaceVersion = $interfaceVersion;
3538
}
3639

@@ -84,8 +87,8 @@ public function setTransactionType($value)
8487
return $this->setParameter('transactionType', $value);
8588
}
8689

87-
public function getSeal($data) {
88-
return hash('sha256', $data . $this->getSecretKey());
90+
public function getSeal($data)
91+
{
92+
return hash('sha256', $data . $this->getSecretKey());
8993
}
90-
9194
}

vendor/fuzion/omnipay-mercanet/src/Message/OffsiteAuthorizeRequest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
*/
99
class OffsiteAuthorizeRequest extends OffsiteAbstractRequest
1010
{
11+
12+
/**
13+
* Endpoint is the remote url.
14+
*
15+
* @var string
16+
*/
17+
public $testEndpoint = 'https://payment-webinit-mercanet.test.sips-atos.com/paymentInit';
18+
19+
public $liveEndpoint = 'https://payment-webinit.mercanet.bnpparibas.net/paymentInit';
20+
1121
/**
1222
* sendData function. In this case, where the browser is to be directly it constructs and returns a response object
1323
* @param mixed $data
@@ -84,7 +94,7 @@ public function getBaseData()
8494
*/
8595
public function getEndpoint()
8696
{
87-
return 'https://payment-webinit-mercanet.test.sips-atos.com/paymentInit';
97+
return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;
8898
}
8999

90100
public function getTransactionType()

vendor/fuzion/omnipay-mercanet/src/Message/OffsiteCompleteAuthorizeRequest.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace Omnipay\Mercanet\Message;
33

4-
use Omnipay\Mercanet\Message\AbstractRequest;
4+
use Guzzle\Http\ClientInterface;
55

66
/**
77
* Sample Complete Authorize Response
@@ -13,18 +13,6 @@
1313
*/
1414
class OffsiteCompleteAuthorizeRequest extends OffsiteAbstractRequest
1515
{
16-
/**
17-
* Create a new Request
18-
*
19-
* @param ClientInterface $httpClient A Guzzle client to make API calls with
20-
* @param HttpRequest $httpRequest A Symfony HTTP request object
21-
*/
22-
public function __construct(ClientInterface $httpClient, HttpRequest $httpRequest)
23-
{
24-
$this->httpClient = $httpClient;
25-
$this->httpRequest = $httpRequest;
26-
$this->initialize();
27-
}
2816

2917
public function sendData($data)
3018
{

vendor/fuzion/omnipay-mercanet/src/Message/OffsiteCompleteAuthorizeResponse.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
class OffsiteCompleteAuthorizeResponse extends AbstractResponse
1111
{
1212

13-
public function __construct(\Omnipay\Common\Message\RequestInterface $request, $data) {
14-
parent::__construct($request, $data);
15-
$this->data = $data;
13+
public function __construct(\Omnipay\Common\Message\RequestInterface $request, $data)
14+
{
15+
parent::__construct($request, $data);
16+
$this->data = $data;
1617
}
1718

1819
/**
@@ -46,15 +47,15 @@ public function getMessage()
4647
return isset($this->data['response_message']) ? $this->data['response_message'] : null;
4748
}
4849

49-
/**
50-
* Check response for a transaction ID.
51-
*
52-
* Most commonly this will be the invoice id.
53-
*
54-
* @return string|null
55-
*/
56-
public function getTransactionId()
57-
{
58-
return isset($this->data['transactionReference']) ? $this->data['transactionReference'] : null;
59-
}
50+
/**
51+
* Check response for a transaction ID.
52+
*
53+
* Most commonly this will be the invoice id.
54+
*
55+
* @return string|null
56+
*/
57+
public function getTransactionId()
58+
{
59+
return isset($this->data['transactionReference']) ? $this->data['transactionReference'] : null;
60+
}
6061
}

vendor/fuzion/omnipay-mercanet/src/Message/OffsiteCompletePurchaseRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ public function sendData($data)
1616
public function getData()
1717
{
1818
if (!$this->getSeal($this->data) === $this->seal) {
19-
throw new InvalidResponseException('Reponse not signed correctly');
19+
throw new InvalidResponseException('Reponse not signed correctly');
2020
}
2121
$parts = explode('|', $this->data);
2222
$data = array();
2323
foreach ($parts as $part) {
24-
$subParts = explode('=', $part);
25-
$data[$subParts[0]] = $subParts[1];
24+
$subParts = explode('=', $part);
25+
$data[$subParts[0]] = $subParts[1];
2626
}
2727
return $data;
2828
}

vendor/fuzion/omnipay-mercanet/src/Message/OffsiteResponse.php

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,36 @@ class OffsiteResponse extends AbstractResponse implements RedirectResponseInterf
1616
*
1717
* @var string
1818
*/
19-
public $endpoint = 'https://payment-webinit-mercanet.test.sips-atos.com/paymentInit';
19+
protected $endpoint;
20+
21+
/**
22+
* @return string
23+
*/
24+
public function getEndpoint()
25+
{
26+
return $this->endpoint;
27+
}
28+
29+
/**
30+
* @param string $endpoint
31+
*/
32+
public function setEndpoint($endpoint)
33+
{
34+
$this->endpoint = $endpoint;
35+
}
2036

2137
public function __construct(RequestInterface $request, $data)
2238
{
2339
$this->request = $request;
2440
$this->data = $data;
41+
$this->endpoint = ($request->getEndPoint());
2542
}
2643

2744
/**
2845
* @return string
2946
*/
30-
public function getSecretKey() {
47+
public function getSecretKey()
48+
{
3149
return $this->data['secret_key'];
3250
}
3351
/**
@@ -64,7 +82,7 @@ public function isTransparentRedirect()
6482

6583
public function getRedirectUrl()
6684
{
67-
return $this->endpoint .'?' . http_build_query($this->data);
85+
return $this->endpoint;
6886
}
6987

7088
/**
@@ -81,14 +99,13 @@ public function getRedirectData()
8199
$allFields = $this->getData();
82100
$formData = array();
83101
foreach ($allFields['data'] as $field => $value) {
84-
$formData[] = "{$field}={$value}";
102+
$formData[] = "{$field}={$value}";
85103
}
86104
$data = implode('|', $formData);
87105
return array(
88-
'data' => $data,
89-
'InterfaceVersion' => 'HP_2.9',
90-
'seal' => hash('sha256', $data . $this->getSecretKey()),
106+
'data' => $data,
107+
'InterfaceVersion' => 'HP_2.9',
108+
'seal' => hash('sha256', $data . $this->getSecretKey()),
91109
);
92110
}
93-
94111
}

vendor/fuzion/omnipay-mercanet/tests/OffsiteGatewayTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ public function setUp()
3030

3131
public function testPurchase()
3232
{
33-
$response = $this->gateway->purchase(array('amount' => '10.00', 'currency' => 978, 'card' => $this->card))->send();
33+
$response = $this->gateway->purchase(array('testMode' => TRUE, 'amount' => '10.00', 'currency' => 978, 'card' => $this->card))->send();
3434
$this->assertInstanceOf('Omnipay\Mercanet\Message\OffsiteAuthorizeResponse', $response);
3535
$this->assertFalse($response->isSuccessful());
3636
$this->assertTrue($response->isRedirect());
3737
$this->assertNotEmpty($response->getRedirectUrl());
38-
$this->assertSame('https://payment-webinit-mercanet.test.sips-atos.com/paymentInit?type=sale&merchant_id=Billy&secret_key=really_secure&total=10.00', $response->getRedirectUrl());
38+
$this->assertSame('https://payment-webinit-mercanet.test.sips-atos.com/paymentInit', $response->getRedirectUrl());
3939
$this->assertTrue($response->isTransparentRedirect());
4040
}
4141

@@ -46,18 +46,18 @@ public function testAuthorize()
4646
$this->assertFalse($response->isSuccessful());
4747
$this->assertTrue($response->isRedirect());
4848
$this->assertNotEmpty($response->getRedirectUrl());
49-
$this->assertSame('https://payment-webinit-mercanet.test.sips-atos.com/paymentInit?type=Authorize&merchant_id=Billy&secret_key=really_secure&total=10.00', $response->getRedirectUrl());
49+
$this->assertSame('https://payment-webinit.mercanet.bnpparibas.net/paymentInit', $response->getRedirectUrl());
5050
$this->assertTrue($response->isTransparentRedirect());
5151
}
5252

5353
public function testCapture()
5454
{
55-
$response = $this->gateway->capture(array('amount' => '10.00', 'currency' => 978, 'card' => $this->card))->send();
55+
$response = $this->gateway->capture(array('amount' => '10.00', 'currency' => 978, 'card' => $this->card, 'testMode' => true))->send();
5656
$this->assertInstanceOf('Omnipay\Mercanet\Message\OffsiteAuthorizeResponse', $response);
5757
$this->assertFalse($response->isSuccessful());
5858
$this->assertTrue($response->isRedirect());
5959
$this->assertNotEmpty($response->getRedirectUrl());
60-
$this->assertSame('https://payment-webinit-mercanet.test.sips-atos.com/paymentInit?type=capture&merchant_id=Billy&secret_key=really_secure&total=10.00', $response->getRedirectUrl());
60+
$this->assertSame('https://payment-webinit-mercanet.test.sips-atos.com/paymentInit', $response->getRedirectUrl());
6161
$this->assertTrue($response->isTransparentRedirect());
6262
}
6363

0 commit comments

Comments
 (0)