Skip to content

Commit 07a1a26

Browse files
committed
Issue #123 / PR #128 Some general refactoring and SHA hash tests added.
1 parent 6b97fbd commit 07a1a26

18 files changed

+376
-262
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,16 @@ $data = $response->getData();
111111

112112
$data['paymentProfile']['customerProfileId'];
113113
$data['paymentProfile']['customerPaymentProfileId'];
114-
//Now you can use these 2 fields to reference this customer and this payment profile for later use with
115-
//the rest of the CIM driver features as usual.
114+
115+
// Now you can use these 2 fields to reference this customer and this payment profile for later use with
116+
// the rest of the CIM driver features as usual.
116117
```
117118

118119
## DPM and SIM Signatures
119120

120121
DPM and SIM used to sign their requests with the `transactionKey` using the mdh HMAC algorithm.
121122
From early 2019, this algorithm is being removed completely.
122-
Instead, the SHA-512 HMAC algorithm is used to sign the DPM and SIM requsts,
123+
Instead, the SHA-512 HMAC algorithm is used to sign the DPM and SIM requests,
123124
and to validate the received notifications.
124125

125126
To start using the SHA-512 signing, set your `signatureKey` in the gateway:

src/Message/DPMAuthorizeRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Authorize.Net DPM Authorize Request.
77
* Takes the data that will be used to create the direct-post form.
88
*/
9+
910
class DPMAuthorizeRequest extends SIMAuthorizeRequest
1011
{
1112
protected $action = 'AUTH_ONLY';

src/Message/DPMCompleteRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Authorize.Net DPM Complete Authorize Request
77
*/
8-
class DPMCompleteRequest extends SIMCompleteAuthorizeRequest
8+
class DPMCompleteRequest extends SIMCompleteRequest
99
{
1010
public function sendData($data)
1111
{

src/Message/DPMCompleteResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
/**
66
* SIM and DPM both have identical needs when handling the notify request.
77
*/
8-
class DPMCompleteResponse extends SIMCompleteAuthorizeResponse
8+
class DPMCompleteResponse extends SIMCompleteResponse
99
{
1010
}

src/Message/SIMAbstractRequest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
namespace Omnipay\AuthorizeNet\Message;
44

5-
use Omnipay\Common\Message\AbstractRequest;
6-
75
/**
86
* Authorize.Net SIM Abstract Request
97
*/
8+
9+
use Omnipay\Common\Message\AbstractRequest;
10+
1011
abstract class SIMAbstractRequest extends AbstractRequest
1112
{
1213
/**

src/Message/SIMAuthorizeRequest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public function getData()
5454
}
5555

5656
$data = array_merge($data, $this->getBillingData());
57-
$data['x_fp_hash'] = $this->getHash($data);
57+
58+
$data['x_fp_hash'] = $this->createHash($data);
5859

5960
return $data;
6061
}
@@ -64,10 +65,11 @@ public function getData()
6465
* modified en-route.
6566
* It uses the TransactionKey, which is a shared secret between the merchant
6667
* and Authorize.Net The sequence and timestamp provide additional salt.
68+
*
6769
* @param $data
6870
* @return string
6971
*/
70-
public function getHash($data)
72+
public function createHash($data)
7173
{
7274
$fingerprint = implode(
7375
'^',

src/Message/SIMAuthorizeResponse.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public function getRedirectData()
4747

4848
public function getTransactionId()
4949
{
50-
return isset($this->data[SIMAbstractRequest::TRANSACTION_ID_PARAM]) ? $this->data[SIMAbstractRequest::TRANSACTION_ID_PARAM] : null;
50+
return isset($this->data[SIMAbstractRequest::TRANSACTION_ID_PARAM])
51+
? $this->data[SIMAbstractRequest::TRANSACTION_ID_PARAM]
52+
: null;
5153
}
5254
}

src/Message/SIMCompleteAuthorizeRequest.php

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)