PurchaseRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 22
ccs 0
cts 15
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sendData() 0 4 1
A getData() 0 11 2
1
<?php
2
3
namespace Omnipay\MyCard\Message;
4
5
6
class PurchaseRequest extends AbstractRequest
7
{
8
9
    public function getData()
10
    {
11
        $token = new TokenRequest($this->httpClient, $this->httpRequest);
12
        $token->initialize($this->getParameters());
13
        $tokenData = $token->getToken();
14
        $this->setToken($tokenData['AuthCode']);
15
        $this->setTransactionReference($tokenData['TradeSeq']);
16
17
        return [
18
            // 厂商是否自定义充值页面
19
            'customPage' => ($tokenData['InGameSaveType'] == 1) ? true : false
20
        ];
21
    }
22
23
24
    public function sendData($parameters)
25
    {
26
        $parameters['token'] = $this->getToken();
27
        return new PurchaseResponse($this, $parameters);
28
    }
29
30
}