Skip to content

Commit 8df8d0f

Browse files
committed
Removed PHP 5.6 support
Added custom fields for purchase request
1 parent 19f4888 commit 8df8d0f

19 files changed

+405
-294
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
language: php
22

33
php:
4-
- 5.6
54
- 7.0
65
- 7.1
76
- 7.2
87
- 7.3
98
- 7.4
9+
- 8.0
1010

1111
before_script:
1212
- composer install -n --dev --prefer-source

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
},
2020
"require": {
21-
"php": "^5.6|^7",
21+
"php": "^7.0|^7.1|^7.2|^7.3|^7.4|^8.0",
2222
"ext-simplexml": "*",
2323
"ext-dom": "*",
2424
"omnipay/common": "^3.0"
@@ -35,7 +35,7 @@
3535
},
3636
"extra": {
3737
"branch-alias": {
38-
"dev-master": "3.0.x-dev"
38+
"dev-master": "4.0.x-dev"
3939
}
4040
}
4141
}

phpunit.xml.dist

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,4 @@
2222
<directory>./src</directory>
2323
</whitelist>
2424
</filter>
25-
<logging>
26-
<log type="coverage-clover" target="./clover.xml" />
27-
</logging>
28-
</phpunit>
25+
</phpunit>

src/Message/AbstractRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ public function setCancelMethod($value)
154154
/**
155155
* Redirect method conversion table.
156156
*/
157-
private static $methodsTable = array(
157+
private static $methodsTable = [
158158
'1' => '1',
159159
'2' => '2',
160160
'GET' => '0',
161161
'POST' => '1',
162162
'LINK' => '2',
163-
);
163+
];
164164

165165
/**
166166
* Converts redirect method to WebMoney code: 0, 1 or 2.
@@ -171,7 +171,7 @@ public function setCancelMethod($value)
171171
*/
172172
public function formatMethod($method)
173173
{
174-
$method = strtoupper((string) $method);
174+
$method = strtoupper((string)$method);
175175
return isset(self::$methodsTable[$method]) ? self::$methodsTable[$method] : '0';
176176
}
177177

src/Message/CompletePurchaseRequest.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,35 @@ public function getData()
2323
'secretKey'
2424
);
2525

26-
return array(
27-
'LMI_PAYEE_PURSE' => $this->httpRequest->request->get('LMI_PAYEE_PURSE'),
28-
'LMI_PAYMENT_AMOUNT' => $this->httpRequest->request->get('LMI_PAYMENT_AMOUNT'),
29-
'LMI_PAYMENT_NO' => $this->httpRequest->request->get('LMI_PAYMENT_NO'),
30-
'LMI_MODE' => $this->httpRequest->request->get('LMI_MODE'),
31-
'LMI_SYS_INVS_NO' => $this->httpRequest->request->get('LMI_SYS_INVS_NO'),
32-
'LMI_SYS_TRANS_NO' => $this->httpRequest->request->get('LMI_SYS_TRANS_NO'),
33-
'LMI_PAYER_PURSE' => $this->httpRequest->request->get('LMI_PAYER_PURSE'),
34-
'LMI_PAYER_WM' => $this->httpRequest->request->get('LMI_PAYER_WM'),
35-
'LMI_CAPITALLER_WMID' => $this->httpRequest->request->get('LMI_CAPITALLER_WMID'),
36-
'LMI_PAYMER_NUMBER' => $this->httpRequest->request->get('LMI_PAYMER_NUMBER'),
37-
'LMI_PAYMER_EMAIL' => $this->httpRequest->request->get('LMI_PAYMER_EMAIL'),
38-
'LMI_EURONOTE_NUMBER' => $this->httpRequest->request->get('LMI_EURONOTE_NUMBER'),
39-
'LMI_EURONOTE_EMAIL' => $this->httpRequest->request->get('LMI_EURONOTE_EMAIL'),
40-
'LMI_WMCHECK_NUMBER' => $this->httpRequest->request->get('LMI_WMCHECK_NUMBER'),
26+
return [
27+
'LMI_PAYEE_PURSE' => $this->httpRequest->request->get('LMI_PAYEE_PURSE'),
28+
'LMI_PAYMENT_AMOUNT' => $this->httpRequest->request->get('LMI_PAYMENT_AMOUNT'),
29+
'LMI_PAYMENT_NO' => $this->httpRequest->request->get('LMI_PAYMENT_NO'),
30+
'LMI_MODE' => $this->httpRequest->request->get('LMI_MODE'),
31+
'LMI_SYS_INVS_NO' => $this->httpRequest->request->get('LMI_SYS_INVS_NO'),
32+
'LMI_SYS_TRANS_NO' => $this->httpRequest->request->get('LMI_SYS_TRANS_NO'),
33+
'LMI_PAYER_PURSE' => $this->httpRequest->request->get('LMI_PAYER_PURSE'),
34+
'LMI_PAYER_WM' => $this->httpRequest->request->get('LMI_PAYER_WM'),
35+
'LMI_CAPITALLER_WMID' => $this->httpRequest->request->get('LMI_CAPITALLER_WMID'),
36+
'LMI_PAYMER_NUMBER' => $this->httpRequest->request->get('LMI_PAYMER_NUMBER'),
37+
'LMI_PAYMER_EMAIL' => $this->httpRequest->request->get('LMI_PAYMER_EMAIL'),
38+
'LMI_EURONOTE_NUMBER' => $this->httpRequest->request->get('LMI_EURONOTE_NUMBER'),
39+
'LMI_EURONOTE_EMAIL' => $this->httpRequest->request->get('LMI_EURONOTE_EMAIL'),
40+
'LMI_WMCHECK_NUMBER' => $this->httpRequest->request->get('LMI_WMCHECK_NUMBER'),
4141
'LMI_TELEPAT_PHONENUMBER' => $this->httpRequest->request->get('LMI_TELEPAT_PHONENUMBER'),
42-
'LMI_TELEPAT_ORDERID' => $this->httpRequest->request->get('LMI_TELEPAT_ORDERID'),
43-
'LMI_PAYMENT_CREDITDAYS' => $this->httpRequest->request->get('LMI_PAYMENT_CREDITDAYS'),
44-
'LMI_HASH' => $this->httpRequest->request->get('LMI_HASH'),
45-
'LMI_SYS_TRANS_DATE' => $this->httpRequest->request->get('LMI_SYS_TRANS_DATE'),
46-
'LMI_SECRET_KEY' => $this->httpRequest->request->get('LMI_SECRET_KEY'),
47-
'LMI_SDP_TYPE' => $this->httpRequest->request->get('LMI_SDP_TYPE'),
48-
'LMI_PAYMENT_DESC' => $this->httpRequest->request->get('LMI_PAYMENT_DESC'),
49-
'LMI_PAYER_COUNTRYID' => $this->httpRequest->request->get('LMI_PAYER_COUNTRYID'),
50-
'LMI_PAYER_PCOUNTRYID' => $this->httpRequest->request->get('LMI_PAYER_PCOUNTRYID'),
51-
'LMI_PAYER_IP' => $this->httpRequest->request->get('LMI_PAYER_IP'),
52-
'LMI_LANG' => $this->httpRequest->request->get('LMI_LANG'),
53-
'LMI_DBLCHK' => $this->httpRequest->request->get('LMI_DBLCHK'),
54-
);
42+
'LMI_TELEPAT_ORDERID' => $this->httpRequest->request->get('LMI_TELEPAT_ORDERID'),
43+
'LMI_PAYMENT_CREDITDAYS' => $this->httpRequest->request->get('LMI_PAYMENT_CREDITDAYS'),
44+
'LMI_HASH' => $this->httpRequest->request->get('LMI_HASH'),
45+
'LMI_SYS_TRANS_DATE' => $this->httpRequest->request->get('LMI_SYS_TRANS_DATE'),
46+
'LMI_SECRET_KEY' => $this->httpRequest->request->get('LMI_SECRET_KEY'),
47+
'LMI_SDP_TYPE' => $this->httpRequest->request->get('LMI_SDP_TYPE'),
48+
'LMI_PAYMENT_DESC' => $this->httpRequest->request->get('LMI_PAYMENT_DESC'),
49+
'LMI_PAYER_COUNTRYID' => $this->httpRequest->request->get('LMI_PAYER_COUNTRYID'),
50+
'LMI_PAYER_PCOUNTRYID' => $this->httpRequest->request->get('LMI_PAYER_PCOUNTRYID'),
51+
'LMI_PAYER_IP' => $this->httpRequest->request->get('LMI_PAYER_IP'),
52+
'LMI_LANG' => $this->httpRequest->request->get('LMI_LANG'),
53+
'LMI_DBLCHK' => $this->httpRequest->request->get('LMI_DBLCHK'),
54+
];
5555
}
5656

5757
/**

src/Message/CompletePurchaseResponse.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getCurrency()
6262

6363
public function getTestMode()
6464
{
65-
return (bool) $this->getMode();
65+
return (bool)$this->getMode();
6666
}
6767

6868
public function getMode()
@@ -114,18 +114,20 @@ private function calculateHash()
114114
throw new InvalidResponseException('Invalid signature type');
115115
}
116116

117-
return strtoupper(hash(
118-
$hashType,
119-
$this->data['LMI_PAYEE_PURSE'].
120-
$this->data['LMI_PAYMENT_AMOUNT'].
121-
$this->data['LMI_PAYMENT_NO'].
122-
$this->data['LMI_MODE'].
123-
$this->data['LMI_SYS_INVS_NO'].
124-
$this->data['LMI_SYS_TRANS_NO'].
125-
$this->data['LMI_SYS_TRANS_DATE'].
126-
$this->request->getSecretkey().
127-
$this->data['LMI_PAYER_PURSE'].
128-
$this->data['LMI_PAYER_WM']
129-
));
117+
return strtoupper(
118+
hash(
119+
$hashType,
120+
$this->data['LMI_PAYEE_PURSE'] .
121+
$this->data['LMI_PAYMENT_AMOUNT'] .
122+
$this->data['LMI_PAYMENT_NO'] .
123+
$this->data['LMI_MODE'] .
124+
$this->data['LMI_SYS_INVS_NO'] .
125+
$this->data['LMI_SYS_TRANS_NO'] .
126+
$this->data['LMI_SYS_TRANS_DATE'] .
127+
$this->request->getSecretkey() .
128+
$this->data['LMI_PAYER_PURSE'] .
129+
$this->data['LMI_PAYER_WM']
130+
)
131+
);
130132
}
131133
}

src/Message/FetchTransactionRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ protected function calculateSignature($algorithm)
7070
{
7171
return hash(
7272
$algorithm,
73-
$this->getWebMoneyId().
74-
$this->getMerchantPurse().
75-
$this->getTransactionId().
73+
$this->getWebMoneyId() .
74+
$this->getMerchantPurse() .
75+
$this->getTransactionId() .
7676
$this->getSecretKey()
7777
);
7878
}

src/Message/FetchTransactionResponse.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,33 @@ public function isSuccessful()
2828

2929
public function getCode()
3030
{
31-
return (int) $this->data->retval;
31+
return (int)$this->data->retval;
3232
}
3333

3434
public function getMessage()
3535
{
36-
$message = (string) $this->data->retdesc;
36+
$message = (string)$this->data->retdesc;
3737

3838
return $message ? $message : null;
3939
}
4040

4141
public function getTransactionReference()
4242
{
43-
return $this->data->operation ? (string) $this->data->operation->attributes()->wmtransid : null;
43+
return $this->data->operation ? (string)$this->data->operation->attributes()->wmtransid : null;
4444
}
4545

4646
public function getDescription()
4747
{
48-
return $this->data->operation ? (string) $this->data->operation->purpose : null;
48+
return $this->data->operation ? (string)$this->data->operation->purpose : null;
4949
}
5050

5151
public function getAmount()
5252
{
53-
return $this->data->operation ? (string) $this->data->operation->amount : null;
53+
return $this->data->operation ? (string)$this->data->operation->amount : null;
5454
}
5555

5656
public function getClientIp()
5757
{
58-
return $this->data->operation ? (string) $this->data->operation->IPAddress : null;
58+
return $this->data->operation ? (string)$this->data->operation->IPAddress : null;
5959
}
6060
}

src/Message/PayoutRequest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function getRequestNumber()
5858
{
5959
$requestNumber = $this->getParameter('requestNumber');
6060

61-
return $requestNumber ? $requestNumber : (string) time();
61+
return $requestNumber ? $requestNumber : (string)time();
6262
}
6363

6464
/**
@@ -87,7 +87,7 @@ public function setRequestNumber($value)
8787
*/
8888
public function getProtectionPeriod()
8989
{
90-
return (int) $this->getParameter('protectionPeriod');
90+
return (int)$this->getParameter('protectionPeriod');
9191
}
9292

9393
/**
@@ -143,7 +143,7 @@ public function setProtectionCode($value)
143143
*/
144144
public function getInvoiceId()
145145
{
146-
return (int) $this->getParameter('invoiceId');
146+
return (int)$this->getParameter('invoiceId');
147147
}
148148

149149
/**
@@ -175,7 +175,7 @@ public function setInvoiceId($value)
175175
*/
176176
public function getOnlyAuth()
177177
{
178-
return (int) $this->getParameter('onlyAuth');
178+
return (int)$this->getParameter('onlyAuth');
179179
}
180180

181181
/**
@@ -289,10 +289,10 @@ public function sendData($data)
289289
$client = $this->getHttpClient();
290290
$client->setConfig([
291291
Client::CURL_OPTIONS => [
292-
CURLOPT_CAINFO => $this->getCertificatePath('WMUsedRootCAs.crt'),
293-
CURLOPT_SSLCERT => $this->getSslFile(),
294-
CURLOPT_SSLKEY => $this->getSslKey(),
295-
CURLOPT_SSLVERSION => 1,
292+
CURLOPT_CAINFO => $this->getCertificatePath('WMUsedRootCAs.crt'),
293+
CURLOPT_SSLCERT => $this->getSslFile(),
294+
CURLOPT_SSLKEY => $this->getSslKey(),
295+
CURLOPT_SSLVERSION => 1,
296296
CURLOPT_SSL_VERIFYHOST => 2,
297297
CURLOPT_SSL_VERIFYPEER => 1,
298298
],

src/Message/PayoutResponse.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,33 @@ public function isSuccessful()
2828

2929
public function getCode()
3030
{
31-
return (int) $this->data->retval;
31+
return (int)$this->data->retval;
3232
}
3333

3434
public function getMessage()
3535
{
36-
$message = (string) $this->data->retdesc;
36+
$message = (string)$this->data->retdesc;
3737

3838
return $message ? $message : null;
3939
}
4040

4141
public function getTransactionId()
4242
{
43-
return $this->data->operation ? (string) $this->data->operation->tranid : null;
43+
return $this->data->operation ? (string)$this->data->operation->tranid : null;
4444
}
4545

4646
public function getTransactionReference()
4747
{
48-
return $this->data->operation ? (string) $this->data->operation->attributes()->id : null;
48+
return $this->data->operation ? (string)$this->data->operation->attributes()->id : null;
4949
}
5050

5151
public function getDescription()
5252
{
53-
return $this->data->operation ? (string) $this->data->operation->desc : null;
53+
return $this->data->operation ? (string)$this->data->operation->desc : null;
5454
}
5555

5656
public function getAmount()
5757
{
58-
return $this->data->operation ? (string) $this->data->operation->amount : null;
58+
return $this->data->operation ? (string)$this->data->operation->amount : null;
5959
}
6060
}

0 commit comments

Comments
 (0)