Skip to content

Commit 17aefd3

Browse files
committed
refactor
1 parent bab4c1a commit 17aefd3

File tree

4 files changed

+48
-85
lines changed

4 files changed

+48
-85
lines changed

src/Message/AbstractResponse.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace Omnipay\ECPay\Message;
4+
5+
use Omnipay\Common\Message\AbstractResponse as BaseAbstractResponse;
6+
7+
abstract class AbstractResponse extends BaseAbstractResponse
8+
{
9+
/**
10+
* Response code.
11+
*
12+
* @return null|string A response code from the payment gateway
13+
*/
14+
public function getCode()
15+
{
16+
return $this->data['RtnCode'];
17+
}
18+
19+
/**
20+
* Response Message.
21+
*
22+
* @return null|string A response message from the payment gateway
23+
*/
24+
public function getMessage()
25+
{
26+
return $this->data['RtnMsg'];
27+
}
28+
29+
/**
30+
* Get the transaction ID as generated by the merchant website.
31+
*
32+
* @return string
33+
*/
34+
public function getTransactionId()
35+
{
36+
return $this->data['MerchantTradeNo'];
37+
}
38+
39+
/**
40+
* Gateway Reference.
41+
*
42+
* @return null|string A reference provided by the gateway to represent this transaction
43+
*/
44+
public function getTransactionReference()
45+
{
46+
return $this->data['TradeNo'];
47+
}
48+
}

src/Message/CompletePurchaseResponse.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Omnipay\ECPay\Message;
44

55
use Exception;
6-
use Omnipay\Common\Message\AbstractResponse;
76
use Omnipay\Common\Message\NotificationInterface;
87
use Omnipay\ECPay\Traits\HasECPay;
98

@@ -26,36 +25,6 @@ public function getMessage()
2625
return $this->data['RtnMsg'];
2726
}
2827

29-
/**
30-
* Response code.
31-
*
32-
* @return null|string A response code from the payment gateway
33-
*/
34-
public function getCode()
35-
{
36-
return $this->data['RtnCode'];
37-
}
38-
39-
/**
40-
* Gateway Reference.
41-
*
42-
* @return null|string A reference provided by the gateway to represent this transaction
43-
*/
44-
public function getTransactionReference()
45-
{
46-
return $this->data['TradeNo'];
47-
}
48-
49-
/**
50-
* Get the transaction ID as generated by the merchant website.
51-
*
52-
* @return string
53-
*/
54-
public function getTransactionId()
55-
{
56-
return $this->data['MerchantTradeNo'];
57-
}
58-
5928
public function getTransactionStatus()
6029
{
6130
return $this->isSuccessful() ? self::STATUS_COMPLETED : self::STATUS_FAILED;

src/Message/FetchTransactionResponse.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Omnipay\ECPay\Message;
44

5-
use Omnipay\Common\Message\AbstractResponse;
6-
75
class FetchTransactionResponse extends AbstractResponse
86
{
97
public function isSuccessful()
@@ -15,14 +13,4 @@ public function getCode()
1513
{
1614
return $this->data['TradeStatus'];
1715
}
18-
19-
public function getTransactionId()
20-
{
21-
return $this->data['MerchantTradeNo'];
22-
}
23-
24-
public function getTransactionReference()
25-
{
26-
return $this->data['TradeNo'];
27-
}
2816
}

src/Message/RefundResponse.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Omnipay\ECPay\Message;
44

5-
use Omnipay\Common\Message\AbstractResponse;
6-
75
class RefundResponse extends AbstractResponse
86
{
97
/**
@@ -15,44 +13,4 @@ public function isSuccessful()
1513
{
1614
return (string) $this->getCode() === '1';
1715
}
18-
19-
/**
20-
* Response code.
21-
*
22-
* @return null|string A response code from the payment gateway
23-
*/
24-
public function getCode()
25-
{
26-
return $this->data['RtnCode'];
27-
}
28-
29-
/**
30-
* Response Message.
31-
*
32-
* @return null|string A response message from the payment gateway
33-
*/
34-
public function getMessage()
35-
{
36-
return $this->data['RtnMsg'];
37-
}
38-
39-
/**
40-
* Get the transaction ID as generated by the merchant website.
41-
*
42-
* @return string
43-
*/
44-
public function getTransactionId()
45-
{
46-
return $this->data['MerchantTradeNo'];
47-
}
48-
49-
/**
50-
* Gateway Reference.
51-
*
52-
* @return null|string A reference provided by the gateway to represent this transaction
53-
*/
54-
public function getTransactionReference()
55-
{
56-
return $this->data['TradeNo'];
57-
}
5816
}

0 commit comments

Comments
 (0)