ConfirmResponse::getMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Omnipay\MyCard\Message;
4
5
6
/*
7
 *
8
 * 确认返回格式:
9
 * array[
10
 *	  "ReturnCode" => "MBP006"
11
 *	  "ReturnMsg" => "查無授權交易,交易狀態可能不符合"
12
 *	  "FacTradeSeq" => ""
13
 *	  "TradeSeq" => ""
14
 *	  "MyCardTradeNo" => null
15
 *	  "SerialId" => ""
16
 * ]
17
 *
18
 */
19
use Omnipay\Common\Message\AbstractResponse;
20
21
class ConfirmResponse extends AbstractResponse
22
{
23
24
    // 二次确认会失败 ReturnCode=MBP006
25
    public function isSuccessful()
26
    {
27
        return ($this->getData()['ReturnCode'] == 1) ? true : false;
28
    }
29
30
31
    public function isPaid()
32
    {
33
        return $this->isSuccessful();
34
    }
35
36
37
    public function getTransactionId()
38
    {
39
        return $this->getData()['FacTradeSeq'];
40
    }
41
42
43
    public function getCard()
44
    {
45
        return $this->getData()['MyCardTradeNo'];
46
    }
47
48
49
    public function getMessage()
50
    {
51
        return $this->getData()['ReturnMsg'];
52
    }
53
54
}