|
1
|
|
|
<?php namespace Ogone\FlexCheckout; |
|
2
|
|
|
|
|
3
|
|
|
use Ogone\AbstractPaymentRequest; |
|
4
|
|
|
use Ogone\ShaComposer\ShaComposer; |
|
5
|
|
|
|
|
6
|
|
|
class FlexCheckoutPaymentRequest extends AbstractPaymentRequest |
|
7
|
|
|
{ |
|
8
|
|
|
const TEST = "https://ogone.test.v-psp.com/Tokenization/HostedPage"; |
|
9
|
|
|
const PRODUCTION = "https://secure.ogone.com/Tokenization/HostedPage"; |
|
10
|
|
|
|
|
11
|
|
|
protected $payment_methods = [ |
|
12
|
|
|
"CreditCard", |
|
13
|
|
|
"DirectDebit", |
|
14
|
|
|
]; |
|
15
|
|
|
|
|
16
|
|
|
public function __construct(ShaComposer $shaComposer) |
|
17
|
|
|
{ |
|
18
|
|
|
$this->shaComposer = $shaComposer; |
|
19
|
|
|
$this->ogoneUri = self::TEST; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function getCheckoutUrl() |
|
23
|
|
|
{ |
|
24
|
|
|
return $this->getOgoneUri()."?". http_build_query($this->toArray()); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function getRequiredFields() |
|
28
|
|
|
{ |
|
29
|
|
|
return array( |
|
30
|
|
|
'account.pspid', |
|
31
|
|
|
'alias.aliasid', |
|
32
|
|
|
'alias.orderid', |
|
33
|
|
|
'card.paymentmethod', |
|
34
|
|
|
'parameters.accepturl', |
|
35
|
|
|
'parameters.exceptionurl', |
|
36
|
|
|
); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function getValidOgoneUris() |
|
40
|
|
|
{ |
|
41
|
|
|
return array(self::TEST, self::PRODUCTION); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function setPspId($pspid) |
|
45
|
|
|
{ |
|
46
|
|
|
$this->parameters['account.pspid'] = $pspid; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function setOrderId($orderid) |
|
50
|
|
|
{ |
|
51
|
|
|
$this->parameters['alias.orderid'] = $orderid; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function setAliasId(Alias $alias) |
|
55
|
|
|
{ |
|
56
|
|
|
$this->parameters['alias.aliasid'] = $alias->getAlias(); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function setPm($payment_method) |
|
60
|
|
|
{ |
|
61
|
|
|
if (!in_array($payment_method, $this->payment_methods)) { |
|
62
|
|
|
throw new \InvalidArgumentException("Unknown Payment method [$payment_method]."); |
|
63
|
|
|
} |
|
64
|
|
|
$this->parameters['card.paymentmethod'] = $payment_method; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function setAccepturl($accepturl) |
|
68
|
|
|
{ |
|
69
|
|
|
$this->validateUri($accepturl); |
|
70
|
|
|
$this->parameters['parameters.accepturl'] = $accepturl; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function setExceptionurl($exceptionurl) |
|
74
|
|
|
{ |
|
75
|
|
|
$this->validateUri($exceptionurl); |
|
76
|
|
|
$this->parameters['parameters.exceptionurl'] = $exceptionurl; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function setLanguage($language) |
|
80
|
|
|
{ |
|
81
|
|
|
$this->parameters['layout.language'] = $language; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function setShaSign() |
|
85
|
|
|
{ |
|
86
|
|
|
$this->parameters['shasignature.shasign'] = parent::getShaSign(); |
|
|
|
|
|
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
protected function getValidOperations() |
|
90
|
|
|
{ |
|
91
|
|
|
return []; |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.