forked from fall1600/newebpay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResponse.php
169 lines (146 loc) · 3.09 KB
/
Response.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
namespace fall1600\Package\Newebpay;
class Response
{
/** @var array */
protected $data;
/** @var string */
protected $tradeInfo;
/** @var string */
protected $tradeSha;
/**
* 注入藍新來的回傳值
* @param array $data
* @param string $tradeInfo
* @param string $tradeSha
*/
public function __construct(array $data, string $tradeInfo, string $tradeSha)
{
$this->data = $data;
$this->tradeInfo = $tradeInfo;
$this->tradeSha = $tradeSha;
}
/**
* 回傳狀態
* 成功: SUCCESS
* 失敗: 錯誤代碼
* @return string
*/
public function getStatus()
{
return $this->data['Status'];
}
/**
* 回傳訊息
* @return string
*/
public function getMessage()
{
return $this->data['Message'];
}
/**
* 回傳參數細節
* @return array
*/
public function getResult()
{
return $this->data['Result'];
}
/**
* 商城代號
* @return string|null
*/
public function getMerchantId()
{
return $this->data['Result']['MerchantID'] ?? null;
}
/**
* 交易金額
* @return int|null
*/
public function getAmt()
{
return ((int) $this->data['Result']['Amt']) ?? null;
}
/**
* 交易序號
* @return string|null
*/
public function getTradeNo()
{
return $this->data['Result']['TradeNo'] ?? null;
}
/**
* 用來跟藍新溝通的訂單編號, 也就是OrderInterface 提供的MerchantOrderNo
* @return string|null
*/
public function getMerchantOrderNo()
{
return $this->data['Result']['MerchantOrderNo'] ?? null;
}
/**
* 付款方式
* @return string|null
*/
public function getPaymentType()
{
return $this->data['Result']['PaymentType'] ?? null;
}
public function getResponseType()
{
return $this->data['Result']['ResponseType'] ?? null;
}
/**
* 付款完成時間
* @return string|null
*/
public function getPayTime()
{
return $this->data['Result']['PayTime'] ?? null;
}
/**
* 付款人取號或交易時的ip
* @return string|null
*/
public function getIp()
{
return $this->data['Result']['IP'] ?? null;
}
/**
* 款項保管銀行
* @return string|null
*/
public function getEscrowBank()
{
return $this->data['Result']['EscrowBank'] ?? null;
}
/**
* 離線金流會帶繳費到期日回來, 格式: yyyy-mm-dd
* @return string|null
*/
public function getExpireDate()
{
return $this->data['Result']['ExpireDate'] ?? null;
}
/**
* @return string
*/
public function getTradeInfo()
{
return $this->tradeInfo;
}
/**
* @return string
*/
public function getTradeSha()
{
return $this->tradeSha;
}
/**
* @return array
*/
public function getData()
{
return $this->data;
}
}