ConfirmResponse   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
ccs 0
cts 19
cp 0
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMessage() 0 3 1
A getCard() 0 3 1
A isSuccessful() 0 3 2
A isPaid() 0 3 1
A getTransactionId() 0 3 1
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
}