Skip to content

Commit aae12f0

Browse files
committed
Style fixes
1 parent c2d3cb6 commit aae12f0

File tree

8 files changed

+76
-46
lines changed

8 files changed

+76
-46
lines changed

src/Message/AcceptNotification.php

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88
use Omnipay\Common\Message\NotificationInterface;
99
use Symfony\Component\HttpFoundation\Request as HttpRequest;
1010

11-
class AcceptNotification extends PurchaseRequest implements NotificationInterface {
11+
class AcceptNotification extends PurchaseRequest implements NotificationInterface
12+
{
1213
protected $data;
1314

1415
protected $transaction;
1516

16-
public function getData() {
17+
public function getData()
18+
{
1719
return $this->data;
1820
}
1921

20-
public function sendData($data) {
22+
public function sendData($data)
23+
{
2124
$sessionId = $this->httpRequest->query->get('sessionId') ?? $this->httpRequest->request->get('sessionId') ?? '';
2225

2326
if (empty($sessionId)) {
@@ -32,8 +35,7 @@ public function sendData($data) {
3235

3336
try {
3437
$httpResponse = $this->httpClient->request('GET', $this->getEndpoint('sessions/' . $sessionId), $headers);
35-
}
36-
catch (\Exception $exception) {
38+
} catch (\Exception $exception) {
3739
throw new InvalidRequestException($exception->getMessage());
3840
}
3941

@@ -45,31 +47,37 @@ public function sendData($data) {
4547
return $this;
4648
}
4749

48-
public function getTransaction() {
50+
public function getTransaction()
51+
{
4952
return $this->transaction;
5053
}
5154

52-
public function getTransactionReference() {
55+
public function getTransactionReference()
56+
{
5357
return $this->getTransaction()['id'] ?? '';
5458
}
5559

56-
public function getTransactionStatus() {
57-
if ($this->getTransaction() && $this->getAuthorised() && $this->getResponseText() === 'APPROVED') {
60+
public function getTransactionStatus()
61+
{
62+
if ($this->getTransaction() && $this->getAuthorised() && $this->getResponseText() === 'APPROVED') {
5863
return static::STATUS_COMPLETED;
5964
}
6065

6166
return static::STATUS_FAILED;
6267
}
6368

64-
public function getAuthorised() {
69+
public function getAuthorised()
70+
{
6571
return $this->getTransaction()['authorised'] ?? false;
6672
}
6773

68-
public function getResponseText() {
74+
public function getResponseText()
75+
{
6976
return strtoupper($this->getTransaction()['responseText']) ?? '';
7077
}
7178

72-
public function getMessage() {
79+
public function getMessage()
80+
{
7381
return $this->getResponseText() ?? '';
7482
}
7583

@@ -107,4 +115,4 @@ public function getTransactionResult()
107115
{
108116
return $this->getTransaction() ?? [];
109117
}
110-
}
118+
}

src/Message/BaseRequest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ public function getLanguage()
7979

8080
/**
8181
* @param $list
82-
* Possible methods: ['card', 'account2account', 'alipay', 'applepay', 'googlepay', 'paypal', 'interac', 'unionpay', 'oxipay', 'visacheckout', 'wechat']
82+
* Possible methods: ['card', 'account2account', 'alipay', 'applepay', 'googlepay', 'paypal', 'interac',
83+
* 'unionpay', 'oxipay', 'visacheckout', 'wechat']
8384
*
8485
* @return PurchaseRequest
8586
*/
@@ -91,8 +92,8 @@ public function setPaymentMethods($list)
9192
'oxipay', 'visacheckout', 'wechat'
9293
];
9394

94-
foreach ( $list as $method ) {
95-
if ( !in_array($method, $options) ) {
95+
foreach ($list as $method) {
96+
if (!in_array($method, $options)) {
9697
throw new InvalidRequestException("Unknown payment method: {$method}");
9798
}
9899
}
@@ -160,7 +161,7 @@ public function setStoredCardIndicator($value)
160161
'resubmission', 'reauthorisation', 'delayedcharges', 'noshow'
161162
];
162163

163-
if ( ! in_array($value, $options) ) {
164+
if (! in_array($value, $options)) {
164165
throw new InvalidRequestException("Invalid option '{$value}' set for StoredCardIndicator.");
165166
}
166167

@@ -192,7 +193,7 @@ public function setRecurringFrequency($value)
192193
'twomonthly', 'threemonthly', 'fourmonthly', 'sixmonthly', 'annually'
193194
];
194195

195-
if ( ! in_array($value, $options) ) {
196+
if (! in_array($value, $options)) {
196197
throw new InvalidRequestException("Invalid option '{$value}' set for RecurringFrequency.");
197198
}
198199

src/Message/CompletePurchaseRequest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ class CompletePurchaseRequest extends PurchaseRequest
1212
public function getData()
1313
{
1414
return [
15-
'sessionId' => $this->getParameter('sessionId') ?? $this->httpRequest->query->get('sessionId') ?? $this->httpRequest->request->get('sessionId') ?? '',
16-
'username' => $this->getParameter('username') ?? $this->httpRequest->query->get('username') ?? $this->httpRequest->request->get('username') ?? '',
15+
'sessionId' => $this->getParameter('sessionId')
16+
?? $this->httpRequest->query->get('sessionId')
17+
?? $this->httpRequest->request->get('sessionId')
18+
?? '',
19+
'username' => $this->getParameter('username')
20+
?? $this->httpRequest->query->get('username')
21+
?? $this->httpRequest->request->get('username')
22+
?? '',
1723
];
1824
}
1925
public function sendData($data)
2026
{
21-
if ( !$data['sessionId'] ) {
27+
if (!$data['sessionId']) {
2228
throw new InvalidRequestException('Session id is required');
2329
}
2430

src/Message/CompletePurchaseResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function getCardType()
114114

115115
public function getCardReference()
116116
{
117-
if ( !in_array($this->getTransactionMethod(), ['card', 'visacheckout']) ) {
117+
if (!in_array($this->getTransactionMethod(), ['card', 'visacheckout'])) {
118118
return null;
119119
}
120120

src/Message/PurchaseRequest.php

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,57 +26,57 @@ public function getData()
2626
],
2727
];
2828

29-
if ( (bool) $this->getCreateToken() ) {
29+
if ((bool) $this->getCreateToken()) {
3030
$data['storeCard'] = true;
3131
}
3232

33-
if ( $this->getStoredCardIndicator() ) {
33+
if ($this->getStoredCardIndicator()) {
3434
$data['storedCardIndicator'] = $this->getStoredCardIndicator();
3535
}
3636

37-
if ( $this->getRecurringExpiry() ) {
37+
if ($this->getRecurringExpiry()) {
3838
$data['recurringExpiry'] = $this->getRecurringExpiry();
3939
}
4040

41-
if ( $this->getRecurringFrequency() ) {
41+
if ($this->getRecurringFrequency()) {
4242
$data['recurringFrequency'] = $this->getRecurringFrequency();
4343
}
4444

45-
if ( $this->getToken() || $this->getCardReference() ) {
45+
if ($this->getToken() || $this->getCardReference()) {
4646
$data['cardId'] = $this->getToken() ?? $this->getCardReference();
4747
}
4848

49-
if ( is_array($this->getPaymentMethods()) ) {
49+
if (is_array($this->getPaymentMethods())) {
5050
$data['methods'] = $this->getPaymentMethods();
5151
}
5252

53-
if ( is_array($this->getCardTypes()) ) {
53+
if (is_array($this->getCardTypes())) {
5454
$data['cardTypes'] = $this->getCardTypes();
5555
}
5656

57-
if ( is_array($this->getMetadata()) ) {
57+
if (is_array($this->getMetadata())) {
5858
$data['metaData'] = $this->getMetadata();
5959
}
6060

6161
$merchantReference = $this->getMerchantReference() ?? $this->getDescription();
6262

63-
if ( $merchantReference ) {
63+
if ($merchantReference) {
6464
$data['merchantReference'] = $merchantReference;
6565
}
6666

67-
if ( $this->getReturnUrl() ) {
67+
if ($this->getReturnUrl()) {
6868
$data['callbackUrls']['approved'] = $this->getReturnUrl();
6969
}
7070

71-
if ( $this->getDeclineUrl() ) {
71+
if ($this->getDeclineUrl()) {
7272
$data['callbackUrls']['declined'] = $this->getDeclineUrl();
7373
}
7474

75-
if ( $this->getCancelUrl() ) {
75+
if ($this->getCancelUrl()) {
7676
$data['callbackUrls']['cancelled'] = $this->getCancelUrl();
7777
}
7878

79-
if ( $this->getNotifyUrl() ) {
79+
if ($this->getNotifyUrl()) {
8080
$data['notificationUrl'] = $this->getNotifyUrl();
8181
}
8282

@@ -163,7 +163,12 @@ public function sendData($data)
163163
'Authorization' => 'Basic ' . $this->getAuthorization(),
164164
];
165165

166-
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint('sessions'), $headers, json_encode($data));
166+
$httpResponse = $this->httpClient->request(
167+
'POST',
168+
$this->getEndpoint('sessions'),
169+
$headers,
170+
json_encode($data)
171+
);
167172

168173
try {
169174
$responseData = json_decode($httpResponse->getBody()->getContents());

src/Message/PurchaseResponse.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@
99
/**
1010
* Windcave HPP Redirect Response
1111
*/
12-
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface {
12+
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
13+
{
1314

14-
public function isSuccessful() {
15+
public function isSuccessful()
16+
{
1517
return false;
1618
}
1719

18-
public function isRedirect() {
20+
public function isRedirect()
21+
{
1922
return true;
2023
}
2124

22-
public function getRedirectUrl() {
23-
foreach ( $this->data->links ?? [] as $link ) {
25+
public function getRedirectUrl()
26+
{
27+
foreach ($this->data->links ?? [] as $link) {
2428
if ($link->rel === 'hpp') {
2529
return $link->href;
2630
}
@@ -29,7 +33,8 @@ public function getRedirectUrl() {
2933
throw new InvalidResponseException('Invalid response from windcave server');
3034
}
3135

32-
public function getRedirectData() {
36+
public function getRedirectData()
37+
{
3338
return [];
3439
}
35-
}
40+
}

src/Message/RefundRequest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ public function sendData($data)
3333
'Authorization' => 'Basic ' . $this->getAuthorization(),
3434
];
3535

36-
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint('transactions'), $headers, json_encode($data));
36+
$httpResponse = $this->httpClient->request(
37+
'POST',
38+
$this->getEndpoint('transactions'),
39+
$headers,
40+
json_encode($data)
41+
);
3742

3843
try {
3944
$responseData = json_decode($httpResponse->getBody()->getContents());
@@ -43,4 +48,4 @@ public function sendData($data)
4348

4449
return $this->response = new RefundResponse($this, $responseData ?? []);
4550
}
46-
}
51+
}

src/Message/RefundResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ public function getTransactionReference()
2626
{
2727
return $this->data->id ?? null;
2828
}
29-
}
29+
}

0 commit comments

Comments
 (0)