1 | <?php |
||
10 | abstract class AbstractRequest extends BaseAbstractRequest |
||
11 | { |
||
12 | use ParameterTrait; |
||
|
|||
13 | |||
14 | /** |
||
15 | * FACPG2 live endpoint URL |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $liveEndpoint = 'https://marlin.firstatlanticcommerce.com/PGServiceXML/'; |
||
20 | |||
21 | /** |
||
22 | * FACPG2 test endpoint URL |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $testEndpoint = 'https://ecm.firstatlanticcommerce.com/PGServiceXML/'; |
||
27 | |||
28 | /** |
||
29 | * FACPG2 XML namespace |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $namespace = 'http://schemas.firstatlanticcommerce.com/gateway/data'; |
||
34 | |||
35 | /** |
||
36 | * FACPG2 XML root |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $requestName; |
||
41 | |||
42 | /** |
||
43 | * Returns the amount formatted to match FAC's expectations. |
||
44 | * |
||
45 | * @return string The amount padded with zeros on the left to 12 digits and no decimal place. |
||
46 | */ |
||
47 | protected function formatAmount() |
||
56 | |||
57 | /** |
||
58 | * Returns the live or test endpoint depending on TestMode. |
||
59 | * |
||
60 | * @return string Endpoint URL |
||
61 | */ |
||
62 | protected function getEndpoint() |
||
66 | |||
67 | /** |
||
68 | * Return the response object |
||
69 | * |
||
70 | * @param \SimpleXMLElement $xml Response xml object |
||
71 | * |
||
72 | * @return ResponseInterface |
||
73 | */ |
||
74 | abstract protected function newResponse($xml); |
||
75 | |||
76 | /** |
||
77 | * Send the request payload |
||
78 | * |
||
79 | * @param array $data Request payload |
||
80 | * |
||
81 | * @return ResponseInterface |
||
82 | */ |
||
83 | public function sendData($data) |
||
93 | |||
94 | /** |
||
95 | * Serializes an array into XML |
||
96 | * |
||
97 | * @param array $data Array to serialize into XML. |
||
98 | * @param \SimpleXMLElement $xml SimpleXMLElement object. |
||
99 | * |
||
100 | * @return string XML |
||
101 | */ |
||
102 | protected function xmlSerialize($data, $xml = null) |
||
129 | |||
130 | /** |
||
131 | * Sets the card. |
||
132 | * |
||
133 | * @param CreditCard $value |
||
134 | * |
||
135 | * @return AbstractRequest Provides a fluent interface |
||
136 | */ |
||
137 | public function setCard($value) |
||
146 | } |
||
147 |