1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\FirstAtlanticCommerce\Message; |
4
|
|
|
|
5
|
|
|
use Omnipay\FirstAtlanticCommerce\Message\AbstractRequest; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* FACPG2 Transaction Modification Request |
9
|
|
|
*/ |
10
|
|
|
class TransactionModificationRequest extends AbstractRequest |
11
|
|
|
{ |
12
|
|
|
/** |
|
|
|
|
13
|
|
|
* @var string; |
|
|
|
|
14
|
|
|
*/ |
|
|
|
|
15
|
|
|
protected $requestName = 'TransactionModificationRequest'; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
|
|
|
|
18
|
|
|
* Modification Type |
|
|
|
|
19
|
|
|
* |
|
|
|
|
20
|
|
|
* @var int; |
|
|
|
|
21
|
|
|
*/ |
|
|
|
|
22
|
|
|
protected $modificationType; |
|
|
|
|
23
|
|
|
|
24
|
|
|
/** |
|
|
|
|
25
|
|
|
* Validate and construct the data for the request |
|
|
|
|
26
|
|
|
* |
|
|
|
|
27
|
|
|
* @return array |
|
|
|
|
28
|
|
|
*/ |
|
|
|
|
29
|
|
|
public function getData() |
|
|
|
|
30
|
|
|
{ |
|
|
|
|
31
|
|
|
$this->validate('merchantId', 'merchantPassword', 'acquirerId', 'transactionId', 'amount'); |
|
|
|
|
32
|
|
|
|
33
|
|
|
$data = [ |
|
|
|
|
34
|
|
|
'AcquirerId' => $this->getAcquirerId(), |
|
|
|
|
35
|
|
|
'Amount' => $this->formatAmount(), |
|
|
|
|
36
|
|
|
'CurrencyExponent' => $this->getCurrencyDecimalPlaces(), |
|
|
|
|
37
|
|
|
'MerchantId' => $this->getMerchantId(), |
|
|
|
|
38
|
|
|
'ModificationType' => $this->getModificationType(), |
|
|
|
|
39
|
|
|
'OrderNumber' => $this->getTransactionId(), |
|
|
|
|
40
|
|
|
'Password' => $this->getMerchantPassword() |
|
|
|
|
41
|
|
|
]; |
|
|
|
|
42
|
|
|
|
43
|
|
|
return $data; |
|
|
|
|
44
|
|
|
} |
|
|
|
|
45
|
|
|
|
46
|
|
|
/** |
|
|
|
|
47
|
|
|
* Returns endpoint for authorize requests |
|
|
|
|
48
|
|
|
* |
|
|
|
|
49
|
|
|
* @return string Endpoint URL |
|
|
|
|
50
|
|
|
*/ |
|
|
|
|
51
|
|
|
protected function getEndpoint() |
|
|
|
|
52
|
|
|
{ |
|
|
|
|
53
|
|
|
return parent::getEndpoint() . 'TransactionModification'; |
|
|
|
|
54
|
|
|
} |
|
|
|
|
55
|
|
|
|
56
|
|
|
/** |
|
|
|
|
57
|
|
|
* Returns the modification type |
|
|
|
|
58
|
|
|
* |
|
|
|
|
59
|
|
|
* @return int Modification Type |
|
|
|
|
60
|
|
|
*/ |
|
|
|
|
61
|
|
|
protected function getModificationType() |
|
|
|
|
62
|
|
|
{ |
|
|
|
|
63
|
|
|
return $this->modificationType; |
|
|
|
|
64
|
|
|
} |
|
|
|
|
65
|
|
|
|
66
|
|
|
/** |
|
|
|
|
67
|
|
|
* Return the transaction modification response object |
|
|
|
|
68
|
|
|
* |
|
|
|
|
69
|
|
|
* @param \SimpleXMLElement $xml Response xml object |
|
|
|
|
70
|
|
|
* |
|
|
|
|
71
|
|
|
* @return ResponseInterface |
|
|
|
|
72
|
|
|
*/ |
|
|
|
|
73
|
|
|
protected function newResponse($xml) |
|
|
|
|
74
|
|
|
{ |
|
|
|
|
75
|
|
|
return new TransactionModificationResponse($this, $xml); |
|
|
|
|
76
|
|
|
} |
|
|
|
|
77
|
|
|
} |
78
|
|
|
|