1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\SmartPay; |
4
|
|
|
|
5
|
|
|
use Omnipay\Common\AbstractGateway; |
6
|
|
|
use Omnipay\SmartPay\Message\CompletePurchaseRequest; |
7
|
|
|
use Omnipay\SmartPay\Message\PurchaseRequest; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Bank Muscat Payment Gateway |
11
|
|
|
*/ |
12
|
|
|
class Gateway extends AbstractGateway |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Get name |
16
|
|
|
* |
17
|
|
|
* @return string |
18
|
|
|
*/ |
19
|
|
|
public function getName() |
20
|
|
|
{ |
21
|
|
|
return 'SmartPay'; |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Get default parameters |
26
|
|
|
* |
27
|
|
|
* @return array |
28
|
|
|
*/ |
29
|
|
|
public function getDefaultParameters() |
30
|
|
|
{ |
31
|
|
|
return []; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getMerchantId() |
35
|
|
|
{ |
36
|
|
|
return $this->getParameter('merchantId'); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function setMerchantId($merchantId) |
40
|
|
|
{ |
41
|
|
|
return $this->setParameter('merchantId', $merchantId); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function getAccessCode() |
45
|
|
|
{ |
46
|
|
|
return $this->getParameter('accessCode'); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function setAccessCode($accessCode) |
50
|
|
|
{ |
51
|
|
|
return $this->setParameter('accessCode', $accessCode); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getWorkingKey() |
55
|
|
|
{ |
56
|
|
|
return $this->getParameter('workingKey'); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setWorkingKey($workingKey) |
60
|
|
|
{ |
61
|
|
|
return $this->setParameter('workingKey', $workingKey); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Purchase |
66
|
|
|
* |
67
|
|
|
* @param array $parameters Parameters |
68
|
|
|
* |
69
|
|
|
* @return Omnipay\SmartPay\Message\PurchaseRequest |
|
|
|
|
70
|
|
|
*/ |
71
|
|
|
public function purchase(array $parameters = []) |
72
|
|
|
{ |
73
|
|
|
return $this->createRequest( |
|
|
|
|
74
|
|
|
PurchaseRequest::class, |
75
|
|
|
$parameters |
76
|
|
|
); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Complete a purchase process |
81
|
|
|
* |
82
|
|
|
* @param array $parameters |
83
|
|
|
* |
84
|
|
|
* @return Omnipay\SmartPay\Message\CompletePurchaseRequest |
|
|
|
|
85
|
|
|
*/ |
86
|
|
|
public function completePurchase(array $parameters = array()) |
87
|
|
|
{ |
88
|
|
|
return $this->createRequest(CompletePurchaseRequest::class, $parameters); |
|
|
|
|
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|