1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\CyberSource; |
4
|
|
|
|
5
|
|
|
use Omnipay\Common\AbstractGateway; |
6
|
|
|
use Omnipay\CyberSource\Message\CompletePurchaseRequest; |
7
|
|
|
use Omnipay\CyberSource\Message\PurchaseRequest; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* CyberSource Secure Acceptance Hosted Checkout Gateway |
11
|
|
|
* |
12
|
|
|
* @link https://www.cybersource.com/developers/getting_started/integration_methods/secure_acceptance_wm/ |
13
|
|
|
*/ |
14
|
|
|
class HostedGateway extends AbstractGateway |
15
|
|
|
{ |
16
|
1 |
|
public function getName() |
17
|
|
|
{ |
18
|
1 |
|
return 'CyberSource Hosted'; |
19
|
|
|
} |
20
|
|
|
|
21
|
23 |
|
public function getDefaultParameters() |
22
|
|
|
{ |
23
|
|
|
return array( |
24
|
23 |
|
'profileId' => '', |
25
|
|
|
'accessKey' => '', |
26
|
|
|
'secretKey' => '', |
27
|
|
|
'testMode' => false, |
28
|
|
|
); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Get the profile ID for the merchant account |
33
|
|
|
* |
34
|
|
|
* @return string |
35
|
|
|
*/ |
36
|
1 |
|
public function getProfileId() |
37
|
|
|
{ |
38
|
1 |
|
return $this->getParameter('profileId'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Set the profile ID for the merchant account |
43
|
|
|
* |
44
|
|
|
* @param string $value ASCII Alphanumeric + punctuation string, maximum 36 characters |
45
|
|
|
* |
46
|
|
|
* @return AbstractRequest |
47
|
|
|
*/ |
48
|
3 |
|
public function setProfileId($value) |
49
|
|
|
{ |
50
|
3 |
|
return $this->setParameter('profileId', $value); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Get the secret key for the merchant account |
55
|
|
|
* |
56
|
|
|
* @return string |
57
|
|
|
*/ |
58
|
1 |
|
public function getSecretKey() |
59
|
|
|
{ |
60
|
1 |
|
return $this->getParameter('secretKey'); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Set the secret key for the merchant account |
65
|
|
|
* |
66
|
|
|
* @param string $value Alphanumeric string, maximum 32 characters |
67
|
|
|
* |
68
|
|
|
* @return AbstractRequest |
69
|
|
|
*/ |
70
|
3 |
|
public function setSecretKey($value) |
71
|
|
|
{ |
72
|
3 |
|
return $this->setParameter('secretKey', $value); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Get the access key for the merchant account |
77
|
|
|
* |
78
|
|
|
* @return string |
79
|
|
|
*/ |
80
|
1 |
|
public function getAccessKey() |
81
|
|
|
{ |
82
|
1 |
|
return $this->getParameter('accessKey'); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Set the access key for the merchant account |
87
|
|
|
* |
88
|
|
|
* @param string $value Alphanumeric string, maximum 32 characters |
89
|
|
|
* |
90
|
|
|
* @return AbstractRequest |
91
|
|
|
*/ |
92
|
3 |
|
public function setAccessKey($value) |
93
|
|
|
{ |
94
|
3 |
|
return $this->setParameter('accessKey', $value); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Redirect the customer to CyberSource to make a purchase |
99
|
|
|
* |
100
|
|
|
* @param array $parameters |
101
|
|
|
* |
102
|
|
|
* @return \Omnipay\Common\Message\AbstractRequest |
103
|
|
|
*/ |
104
|
3 |
|
public function purchase(array $parameters = array()) |
105
|
|
|
{ |
106
|
3 |
|
return $this->createRequest('\Omnipay\CyberSource\Message\PurchaseRequest', $parameters); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Complete a purchase process |
111
|
|
|
* |
112
|
|
|
* @param array $parameters |
113
|
|
|
* |
114
|
|
|
* @return \Omnipay\Common\Message\AbstractRequest |
115
|
|
|
*/ |
116
|
6 |
|
public function completePurchase(array $parameters = array()) |
117
|
|
|
{ |
118
|
6 |
|
return $this->createRequest('\Omnipay\CyberSource\Message\CompletePurchaseRequest', $parameters); |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|