1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\MyCard; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use Omnipay\Common\AbstractGateway; |
7
|
|
|
use Omnipay\MyCard\Message\CompareTransaction; |
8
|
|
|
|
9
|
|
|
class Gateway extends AbstractGateway |
10
|
|
|
{ |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
public function getName() |
14
|
|
|
{ |
15
|
|
|
return 'MyCard'; |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
public function getDefaultParameters() |
20
|
|
|
{ |
21
|
|
|
return [ |
22
|
|
|
'TradeType' => '2', //1:Android SDK (手遊適用) 2:WEB |
23
|
|
|
]; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
public function getAppId() |
28
|
|
|
{ |
29
|
|
|
return $this->getParameter('appId'); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
public function setAppId($value) |
34
|
|
|
{ |
35
|
|
|
return $this->setParameter('appId', $value); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
public function getAppKey() |
40
|
|
|
{ |
41
|
|
|
return $this->getParameter('appKey'); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
public function setAppKey($value) |
46
|
|
|
{ |
47
|
|
|
return $this->setParameter('appKey', $value); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
|
51
|
|
|
public function getTradeType() |
52
|
|
|
{ |
53
|
|
|
return $this->getParameter('tradeType'); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
public function setTradeType($value) |
58
|
|
|
{ |
59
|
|
|
return $this->setParameter('tradeType', $value); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
public function purchase(array $parameters = array()) |
64
|
|
|
{ |
65
|
|
|
return $this->createRequest('\Omnipay\MyCard\Message\PurchaseRequest', $parameters); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
public function acceptNotification(array $parameters = array()) |
70
|
|
|
{ |
71
|
|
|
return $this->createRequest('\Omnipay\MyCard\Message\NotificationRequest', $parameters); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
|
75
|
|
|
public function fetchTransaction(array $parameters = array()) |
76
|
|
|
{ |
77
|
|
|
return $this->createRequest('\Omnipay\MyCard\Message\FetchRequest', $parameters); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
public function compareTransaction() |
82
|
|
|
{ |
83
|
|
|
return new CompareTransaction(); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
} |