@@ -8,23 +8,20 @@ discard block |
||
8 | 8 | /** |
9 | 9 | * First Atlantic Commerce Payment Gateway 2 (XML POST Service) |
10 | 10 | */ |
11 | -class Gateway extends AbstractGateway |
|
12 | -{ |
|
11 | +class Gateway extends AbstractGateway { |
|
13 | 12 | use ParameterTrait; |
14 | 13 | |
15 | 14 | /** |
16 | 15 | * @return string Gateway name. |
17 | 16 | */ |
18 | - public function getName() |
|
19 | - { |
|
17 | + public function getName() { |
|
20 | 18 | return 'First Atlantic Commerce Payment Gateway 2'; |
21 | 19 | } |
22 | 20 | |
23 | 21 | /** |
24 | 22 | * @return array Default parameters. |
25 | 23 | */ |
26 | - public function getDefaultParameters() |
|
27 | - { |
|
24 | + public function getDefaultParameters() { |
|
28 | 25 | return [ |
29 | 26 | 'merchantId' => null, |
30 | 27 | 'merchantPassword' => null, |
@@ -41,8 +38,7 @@ discard block |
||
41 | 38 | * |
42 | 39 | * @return \Omnipay\FirstAtlanticCommerce\Message\AuthorizeRequest |
43 | 40 | */ |
44 | - public function authorize(array $parameters = []) |
|
45 | - { |
|
41 | + public function authorize(array $parameters = []) { |
|
46 | 42 | return $this->createRequest('\Omnipay\FirstAtlanticCommerce\Message\AuthorizeRequest', $parameters); |
47 | 43 | } |
48 | 44 | |
@@ -53,8 +49,7 @@ discard block |
||
53 | 49 | * |
54 | 50 | * @return \Omnipay\FirstAtlanticCommerce\Message\CaptureRequest |
55 | 51 | */ |
56 | - public function capture(array $parameters = []) |
|
57 | - { |
|
52 | + public function capture(array $parameters = []) { |
|
58 | 53 | return $this->createRequest('\Omnipay\FirstAtlanticCommerce\Message\CaptureRequest', $parameters); |
59 | 54 | } |
60 | 55 | |
@@ -65,8 +60,7 @@ discard block |
||
65 | 60 | * |
66 | 61 | * @return \Omnipay\FirstAtlanticCommerce\Message\PurchaseRequest |
67 | 62 | */ |
68 | - public function purchase(array $parameters = []) |
|
69 | - { |
|
63 | + public function purchase(array $parameters = []) { |
|
70 | 64 | return $this->createRequest('\Omnipay\FirstAtlanticCommerce\Message\PurchaseRequest', $parameters); |
71 | 65 | } |
72 | 66 | |
@@ -77,8 +71,7 @@ discard block |
||
77 | 71 | * |
78 | 72 | * @return \Omnipay\FirstAtlanticCommerce\Message\RefundRequest |
79 | 73 | */ |
80 | - public function refund(array $parameters = []) |
|
81 | - { |
|
74 | + public function refund(array $parameters = []) { |
|
82 | 75 | return $this->createRequest('\Omnipay\FirstAtlanticCommerce\Message\RefundRequest', $parameters); |
83 | 76 | } |
84 | 77 | |
@@ -89,8 +82,7 @@ discard block |
||
89 | 82 | * |
90 | 83 | * @return \Omnipay\FirstAtlanticCommerce\Message\VoidRequest |
91 | 84 | */ |
92 | - public function void(array $parameters = []) |
|
93 | - { |
|
85 | + public function void(array $parameters = []) { |
|
94 | 86 | return $this->createRequest('\Omnipay\FirstAtlanticCommerce\Message\VoidRequest', $parameters); |
95 | 87 | } |
96 | 88 | |
@@ -101,8 +93,7 @@ discard block |
||
101 | 93 | * |
102 | 94 | * @return \Omnipay\FirstAtlanticCommerce\Message\StatusRequest |
103 | 95 | */ |
104 | - public function status(array $parameters = []) |
|
105 | - { |
|
96 | + public function status(array $parameters = []) { |
|
106 | 97 | return $this->createRequest('\Omnipay\FirstAtlanticCommerce\Message\StatusRequest', $parameters); |
107 | 98 | } |
108 | 99 | |
@@ -113,8 +104,7 @@ discard block |
||
113 | 104 | * |
114 | 105 | * @return \Omnipay\FirstAtlanticCommerce\Message\CreateCardRequest |
115 | 106 | */ |
116 | - public function createCard(array $parameters = []) |
|
117 | - { |
|
107 | + public function createCard(array $parameters = []) { |
|
118 | 108 | return $this->createRequest('\Omnipay\FirstAtlanticCommerce\Message\CreateCardRequest', $parameters); |
119 | 109 | } |
120 | 110 | |
@@ -125,8 +115,7 @@ discard block |
||
125 | 115 | * |
126 | 116 | * @return \Omnipay\FirstAtlanticCommerce\Message\UpdateCardRequest |
127 | 117 | */ |
128 | - public function updateCard(array $parameters = []) |
|
129 | - { |
|
118 | + public function updateCard(array $parameters = []) { |
|
130 | 119 | return $this->createRequest('\Omnipay\FirstAtlanticCommerce\Message\UpdateCardRequest', $parameters); |
131 | 120 | } |
132 | 121 | } |
@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use Omnipay\Common\CreditCard as BaseCreditCard; |
6 | 6 | use Omnipay\Common\Exception\InvalidCreditCardException; |
7 | 7 | |
8 | -class CreditCard extends BaseCreditCard |
|
9 | -{ |
|
8 | +class CreditCard extends BaseCreditCard { |
|
10 | 9 | /** |
11 | 10 | * Validate this credit card. If the card is invalid, InvalidCreditCardException is thrown. |
12 | 11 | * |
@@ -18,50 +17,39 @@ discard block |
||
18 | 17 | * @param string ... Optional variable length list of required parameters |
19 | 18 | * @throws InvalidCreditCardException |
20 | 19 | */ |
21 | - public function validate() |
|
22 | - { |
|
20 | + public function validate() { |
|
23 | 21 | $parameters = func_get_args(); |
24 | 22 | |
25 | - if ( count($parameters) == 0 ) |
|
26 | - { |
|
23 | + if ( count($parameters) == 0 ) { |
|
27 | 24 | $parameters = ['number', 'cvv', 'expiryMonth', 'expiryYear']; |
28 | 25 | } |
29 | 26 | |
30 | - foreach ($parameters as $key) |
|
31 | - { |
|
27 | + foreach ($parameters as $key) { |
|
32 | 28 | $value = $this->parameters->get($key); |
33 | 29 | |
34 | - if ( empty($value) ) |
|
35 | - { |
|
30 | + if ( empty($value) ) { |
|
36 | 31 | throw new InvalidCreditCardException("The $key parameter is required"); |
37 | 32 | } |
38 | 33 | } |
39 | 34 | |
40 | - if ( isset($parameters['expiryMonth']) && isset($parameters['expiryYear']) ) |
|
41 | - { |
|
42 | - if ( $this->getExpiryDate('Ym') < gmdate('Ym') ) |
|
43 | - { |
|
35 | + if ( isset($parameters['expiryMonth']) && isset($parameters['expiryYear']) ) { |
|
36 | + if ( $this->getExpiryDate('Ym') < gmdate('Ym') ) { |
|
44 | 37 | throw new InvalidCreditCardException('Card has expired'); |
45 | 38 | } |
46 | 39 | } |
47 | 40 | |
48 | - if ( isset($parameters['number']) ) |
|
49 | - { |
|
50 | - if ( !Helper::validateLuhn( $this->getNumber() ) ) |
|
51 | - { |
|
41 | + if ( isset($parameters['number']) ) { |
|
42 | + if ( !Helper::validateLuhn( $this->getNumber() ) ) { |
|
52 | 43 | throw new InvalidCreditCardException('Card number is invalid'); |
53 | 44 | } |
54 | 45 | |
55 | - if ( !is_null( $this->getNumber() ) && !preg_match( '/^\d{12,19}$/i', $this->getNumber() ) ) |
|
56 | - { |
|
46 | + if ( !is_null( $this->getNumber() ) && !preg_match( '/^\d{12,19}$/i', $this->getNumber() ) ) { |
|
57 | 47 | throw new InvalidCreditCardException('Card number should have 12 to 19 digits'); |
58 | 48 | } |
59 | 49 | } |
60 | 50 | |
61 | - if ( isset($parameters['cvv']) ) |
|
62 | - { |
|
63 | - if ( !is_null( $this->getCvv() ) && !preg_match( '/^\d{3,4}$/i', $this->getCvv() ) ) |
|
64 | - { |
|
51 | + if ( isset($parameters['cvv']) ) { |
|
52 | + if ( !is_null( $this->getCvv() ) && !preg_match( '/^\d{3,4}$/i', $this->getCvv() ) ) { |
|
65 | 53 | throw new InvalidCreditCardException('Card CVV should have 3 to 4 digits'); |
66 | 54 | } |
67 | 55 | } |
@@ -7,8 +7,7 @@ |
||
7 | 7 | /** |
8 | 8 | * FACPG2 Reversal Request |
9 | 9 | */ |
10 | -class VoidRequest extends TransactionModificationRequest |
|
11 | -{ |
|
10 | +class VoidRequest extends TransactionModificationRequest { |
|
12 | 11 | /** |
13 | 12 | * Flag as a reversal |
14 | 13 | * |
@@ -9,8 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * FACPG2 Authorize Request |
11 | 11 | */ |
12 | -class AuthorizeRequest extends AbstractRequest |
|
13 | -{ |
|
12 | +class AuthorizeRequest extends AbstractRequest { |
|
14 | 13 | /** |
15 | 14 | * @var string; |
16 | 15 | */ |
@@ -29,8 +28,7 @@ discard block |
||
29 | 28 | * @return string base64 encoded sha1 hash of the merchantPassword, merchantId, |
30 | 29 | * acquirerId, transactionId, amount and currency code. |
31 | 30 | */ |
32 | - protected function generateSignature() |
|
33 | - { |
|
31 | + protected function generateSignature() { |
|
34 | 32 | $signature = $this->getMerchantPassword(); |
35 | 33 | $signature .= $this->getMerchantId(); |
36 | 34 | $signature .= $this->getAcquirerId(); |
@@ -46,19 +44,16 @@ discard block |
||
46 | 44 | * |
47 | 45 | * @return array |
48 | 46 | */ |
49 | - public function getData() |
|
50 | - { |
|
47 | + public function getData() { |
|
51 | 48 | $this->validate('merchantId', 'merchantPassword', 'acquirerId', 'transactionId', 'amount', 'currency', 'card'); |
52 | 49 | |
53 | 50 | // Check for AVS and require billingAddress1 and billingPostcode |
54 | - if ( $this->getRequireAvsCheck() ) |
|
55 | - { |
|
51 | + if ( $this->getRequireAvsCheck() ) { |
|
56 | 52 | $this->getCard()->validate('billingAddress1', 'billingPostcode'); |
57 | 53 | } |
58 | 54 | |
59 | 55 | // Tokenized cards require the CVV and nothing else, token replaces the card number |
60 | - if ( $this->getCardReference() ) |
|
61 | - { |
|
56 | + if ( $this->getCardReference() ) { |
|
62 | 57 | $this->validate('cardReference'); |
63 | 58 | $this->getCard()->validate('cvv', 'expiryMonth', 'expiryYear'); |
64 | 59 | |
@@ -67,9 +62,7 @@ discard block |
||
67 | 62 | 'CardExpiryDate' => $this->getCard()->getExpiryDate('my'), |
68 | 63 | 'CardNumber' => $this->getCardReference() |
69 | 64 | ]; |
70 | - } |
|
71 | - else |
|
72 | - { |
|
65 | + } else { |
|
73 | 66 | $this->getCard()->validate(); |
74 | 67 | |
75 | 68 | $cardDetails = [ |
@@ -81,8 +74,7 @@ discard block |
||
81 | 74 | } |
82 | 75 | |
83 | 76 | // Only pass the StartDate if year/month are set otherwise it returns 1299 |
84 | - if ( $this->getCard()->getStartYear() && $this->getCard()->getStartMonth() ) |
|
85 | - { |
|
77 | + if ( $this->getCard()->getStartYear() && $this->getCard()->getStartMonth() ) { |
|
86 | 78 | $cardDetails['StartDate'] = $this->getCard()->getStartDate('my'); |
87 | 79 | } |
88 | 80 | |
@@ -112,8 +104,7 @@ discard block |
||
112 | 104 | ]; |
113 | 105 | |
114 | 106 | // FAC only accepts two digit state abbreviations from the USA |
115 | - if ( $billingDetails['BillToCountry'] == 840 ) |
|
116 | - { |
|
107 | + if ( $billingDetails['BillToCountry'] == 840 ) { |
|
117 | 108 | $billingDetails['BillToState'] = $this->formatState(); |
118 | 109 | } |
119 | 110 | |
@@ -133,24 +124,17 @@ discard block |
||
133 | 124 | * |
134 | 125 | * @return int ISO 3166-1 numeric country |
135 | 126 | */ |
136 | - protected function formatCountry() |
|
137 | - { |
|
127 | + protected function formatCountry() { |
|
138 | 128 | $country = $this->getCard()->getCountry(); |
139 | 129 | |
140 | - if ( !is_null($country) && !is_numeric($country) ) |
|
141 | - { |
|
130 | + if ( !is_null($country) && !is_numeric($country) ) { |
|
142 | 131 | $iso3166 = new ISO3166; |
143 | 132 | |
144 | - if ( strlen($country) == 2 ) |
|
145 | - { |
|
133 | + if ( strlen($country) == 2 ) { |
|
146 | 134 | $country = $iso3166->getByAlpha2($country)['numeric']; |
147 | - } |
|
148 | - elseif ( strlen($country) == 3 ) |
|
149 | - { |
|
135 | + } elseif ( strlen($country) == 3 ) { |
|
150 | 136 | $country = $iso3166->getByAlpha3($country)['numeric']; |
151 | - } |
|
152 | - else |
|
153 | - { |
|
137 | + } else { |
|
154 | 138 | throw new InvalidRequestException("The country parameter must be ISO 3166-1 numeric, aplha2 or alpha3."); |
155 | 139 | } |
156 | 140 | } |
@@ -165,12 +149,10 @@ discard block |
||
165 | 149 | * |
166 | 150 | * @return string State abbreviation |
167 | 151 | */ |
168 | - public function formatState() |
|
169 | - { |
|
152 | + public function formatState() { |
|
170 | 153 | $state = $this->getCard()->getState(); |
171 | 154 | |
172 | - if ( strlen($state) != 2 ) |
|
173 | - { |
|
155 | + if ( strlen($state) != 2 ) { |
|
174 | 156 | throw new InvalidRequestException("The state must be a two character abbreviation."); |
175 | 157 | } |
176 | 158 | |
@@ -185,12 +167,10 @@ discard block |
||
185 | 167 | * |
186 | 168 | * @return string Postal code |
187 | 169 | */ |
188 | - public function formatPostcode() |
|
189 | - { |
|
170 | + public function formatPostcode() { |
|
190 | 171 | $postal = preg_replace( '/[\s\-]/', '', $this->getCard()->getPostcode() ); |
191 | 172 | |
192 | - if ( preg_match('/[^a-z0-9]/i', $postal) ) |
|
193 | - { |
|
173 | + if ( preg_match('/[^a-z0-9]/i', $postal) ) { |
|
194 | 174 | throw new InvalidRequestException("The postal code must be alpha-numeric."); |
195 | 175 | } |
196 | 176 | |
@@ -202,8 +182,7 @@ discard block |
||
202 | 182 | * |
203 | 183 | * @return string Endpoint URL |
204 | 184 | */ |
205 | - protected function getEndpoint() |
|
206 | - { |
|
185 | + protected function getEndpoint() { |
|
207 | 186 | return parent::getEndpoint() . 'Authorize'; |
208 | 187 | } |
209 | 188 | |
@@ -212,8 +191,7 @@ discard block |
||
212 | 191 | * |
213 | 192 | * @return int Transaction Code |
214 | 193 | */ |
215 | - protected function getTransactionCode() |
|
216 | - { |
|
194 | + protected function getTransactionCode() { |
|
217 | 195 | return $this->getRequireAvsCheck() ? $this->transactionCode + 1 : $this->transactionCode; |
218 | 196 | } |
219 | 197 | |
@@ -224,8 +202,7 @@ discard block |
||
224 | 202 | * |
225 | 203 | * @return AuthorizeResponse |
226 | 204 | */ |
227 | - protected function newResponse($xml) |
|
228 | - { |
|
205 | + protected function newResponse($xml) { |
|
229 | 206 | return new AuthorizeResponse($this, $xml); |
230 | 207 | } |
231 | 208 | } |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * FACPG2 Tokenize Request |
9 | 9 | */ |
10 | -class CreateCardRequest extends AbstractRequest |
|
11 | -{ |
|
10 | +class CreateCardRequest extends AbstractRequest { |
|
12 | 11 | /** |
13 | 12 | * @var string; |
14 | 13 | */ |
@@ -20,8 +19,7 @@ discard block |
||
20 | 19 | * @return string base64 encoded sha1 hash of the merchantPassword, merchantId, |
21 | 20 | * and acquirerId. |
22 | 21 | */ |
23 | - protected function generateSignature() |
|
24 | - { |
|
22 | + protected function generateSignature() { |
|
25 | 23 | $signature = $this->getMerchantPassword(); |
26 | 24 | $signature .= $this->getMerchantId(); |
27 | 25 | $signature .= $this->getAcquirerId(); |
@@ -34,8 +32,7 @@ discard block |
||
34 | 32 | * |
35 | 33 | * @return array |
36 | 34 | */ |
37 | - public function getData() |
|
38 | - { |
|
35 | + public function getData() { |
|
39 | 36 | $this->validate('merchantId', 'merchantPassword', 'acquirerId', 'customerReference', 'card'); |
40 | 37 | $this->getCard()->validate(); |
41 | 38 | |
@@ -55,8 +52,7 @@ discard block |
||
55 | 52 | * |
56 | 53 | * @return string |
57 | 54 | */ |
58 | - public function getCustomerReference() |
|
59 | - { |
|
55 | + public function getCustomerReference() { |
|
60 | 56 | return $this->getParameter('customerReference'); |
61 | 57 | } |
62 | 58 | |
@@ -65,8 +61,7 @@ discard block |
||
65 | 61 | * |
66 | 62 | * @param string $value |
67 | 63 | */ |
68 | - public function setCustomerReference($value) |
|
69 | - { |
|
64 | + public function setCustomerReference($value) { |
|
70 | 65 | return $this->setParameter('customerReference', $value); |
71 | 66 | } |
72 | 67 | |
@@ -75,8 +70,7 @@ discard block |
||
75 | 70 | * |
76 | 71 | * @return string Endpoint URL |
77 | 72 | */ |
78 | - protected function getEndpoint() |
|
79 | - { |
|
73 | + protected function getEndpoint() { |
|
80 | 74 | return parent::getEndpoint() . 'Tokenize'; |
81 | 75 | } |
82 | 76 | |
@@ -87,8 +81,7 @@ discard block |
||
87 | 81 | * |
88 | 82 | * @return CreateCardResponse |
89 | 83 | */ |
90 | - protected function newResponse($xml) |
|
91 | - { |
|
84 | + protected function newResponse($xml) { |
|
92 | 85 | return new CreateCardResponse($this, $xml); |
93 | 86 | } |
94 | 87 |
@@ -9,18 +9,15 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * FACPG2 Transaction Modification Response |
11 | 11 | */ |
12 | -class TransactionModificationResponse extends AbstractResponse |
|
13 | -{ |
|
12 | +class TransactionModificationResponse extends AbstractResponse { |
|
14 | 13 | /** |
15 | 14 | * Constructor |
16 | 15 | * |
17 | 16 | * @param RequestInterface $request |
18 | 17 | * @param string $data |
19 | 18 | */ |
20 | - public function __construct(RequestInterface $request, $data) |
|
21 | - { |
|
22 | - if ( empty($data) ) |
|
23 | - { |
|
19 | + public function __construct(RequestInterface $request, $data) { |
|
20 | + if ( empty($data) ) { |
|
24 | 21 | throw new InvalidResponseException(); |
25 | 22 | } |
26 | 23 | |
@@ -33,8 +30,7 @@ discard block |
||
33 | 30 | * |
34 | 31 | * @return boolean |
35 | 32 | */ |
36 | - public function isSuccessful() |
|
37 | - { |
|
33 | + public function isSuccessful() { |
|
38 | 34 | return isset($this->data['ResponseCode']) && '1' === $this->data['ResponseCode']; |
39 | 35 | } |
40 | 36 | |
@@ -43,8 +39,7 @@ discard block |
||
43 | 39 | * |
44 | 40 | * @return string |
45 | 41 | */ |
46 | - public function getCode() |
|
47 | - { |
|
42 | + public function getCode() { |
|
48 | 43 | return isset($this->data['ReasonCode']) ? $this->data['ReasonCode'] : null; |
49 | 44 | } |
50 | 45 | |
@@ -53,8 +48,7 @@ discard block |
||
53 | 48 | * |
54 | 49 | * @return string |
55 | 50 | */ |
56 | - public function getMessage() |
|
57 | - { |
|
51 | + public function getMessage() { |
|
58 | 52 | return isset($this->data['ReasonCodeDescription']) ? $this->data['ReasonCodeDescription'] : null; |
59 | 53 | } |
60 | 54 | } |
@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use Omnipay\Common\Message\AbstractResponse as BaseAbstractResponse; |
6 | 6 | use SimpleXMLElement; |
7 | 7 | |
8 | -abstract class AbstractResponse extends BaseAbstractResponse |
|
9 | -{ |
|
8 | +abstract class AbstractResponse extends BaseAbstractResponse { |
|
10 | 9 | /** |
11 | 10 | * Seserializes XML to an array |
12 | 11 | * |
@@ -14,23 +13,19 @@ discard block |
||
14 | 13 | * |
15 | 14 | * @return array data |
16 | 15 | */ |
17 | - protected function xmlDeserialize($xml) |
|
18 | - { |
|
16 | + protected function xmlDeserialize($xml) { |
|
19 | 17 | $array = []; |
20 | 18 | |
21 | - if (!$xml instanceof SimpleXMLElement) |
|
22 | - { |
|
19 | + if (!$xml instanceof SimpleXMLElement) { |
|
23 | 20 | $xml = new SimpleXMLElement($xml); |
24 | 21 | } |
25 | 22 | |
26 | - foreach ($xml->children() as $key => $child) |
|
27 | - { |
|
23 | + foreach ($xml->children() as $key => $child) { |
|
28 | 24 | $value = (string) $child; |
29 | 25 | $_children = $this->xmlDeserialize($child); |
30 | 26 | $_push = ( $_hasChild = ( count($_children) > 0 ) ) ? $_children : $value; |
31 | 27 | |
32 | - if ( $_hasChild && !empty($value) && $value !== '' ) |
|
33 | - { |
|
28 | + if ( $_hasChild && !empty($value) && $value !== '' ) { |
|
34 | 29 | $_push[] = $value; |
35 | 30 | } |
36 | 31 |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * FACPG2 Transaction Modification Request |
9 | 9 | */ |
10 | -class TransactionModificationRequest extends AbstractRequest |
|
11 | -{ |
|
10 | +class TransactionModificationRequest extends AbstractRequest { |
|
12 | 11 | /** |
13 | 12 | * @var string; |
14 | 13 | */ |
@@ -26,8 +25,7 @@ discard block |
||
26 | 25 | * |
27 | 26 | * @return array |
28 | 27 | */ |
29 | - public function getData() |
|
30 | - { |
|
28 | + public function getData() { |
|
31 | 29 | $this->validate('merchantId', 'merchantPassword', 'acquirerId', 'transactionId', 'amount'); |
32 | 30 | |
33 | 31 | $data = [ |
@@ -48,8 +46,7 @@ discard block |
||
48 | 46 | * |
49 | 47 | * @return string Endpoint URL |
50 | 48 | */ |
51 | - protected function getEndpoint() |
|
52 | - { |
|
49 | + protected function getEndpoint() { |
|
53 | 50 | return parent::getEndpoint() . 'TransactionModification'; |
54 | 51 | } |
55 | 52 | |
@@ -58,8 +55,7 @@ discard block |
||
58 | 55 | * |
59 | 56 | * @return int Modification Type |
60 | 57 | */ |
61 | - protected function getModificationType() |
|
62 | - { |
|
58 | + protected function getModificationType() { |
|
63 | 59 | return $this->modificationType; |
64 | 60 | } |
65 | 61 | |
@@ -70,8 +66,7 @@ discard block |
||
70 | 66 | * |
71 | 67 | * @return ResponseInterface |
72 | 68 | */ |
73 | - protected function newResponse($xml) |
|
74 | - { |
|
69 | + protected function newResponse($xml) { |
|
75 | 70 | return new TransactionModificationResponse($this, $xml); |
76 | 71 | } |
77 | 72 | } |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | use Omnipay\FirstAtlanticCommerce\ParameterTrait; |
8 | 8 | use SimpleXMLElement; |
9 | 9 | |
10 | -abstract class AbstractRequest extends BaseAbstractRequest |
|
11 | -{ |
|
10 | +abstract class AbstractRequest extends BaseAbstractRequest { |
|
12 | 11 | use ParameterTrait; |
13 | 12 | |
14 | 13 | /** |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * |
45 | 44 | * @return string The amount padded with zeros on the left to 12 digits and no decimal place. |
46 | 45 | */ |
47 | - protected function formatAmount() |
|
48 | - { |
|
46 | + protected function formatAmount() { |
|
49 | 47 | $amount = $this->getAmount(); |
50 | 48 | |
51 | 49 | $amount = str_replace('.', '', $amount); |
@@ -59,8 +57,7 @@ discard block |
||
59 | 57 | * |
60 | 58 | * @return string Endpoint URL |
61 | 59 | */ |
62 | - protected function getEndpoint() |
|
63 | - { |
|
60 | + protected function getEndpoint() { |
|
64 | 61 | return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint; |
65 | 62 | } |
66 | 63 | |
@@ -80,8 +77,7 @@ discard block |
||
80 | 77 | * |
81 | 78 | * @return ResponseInterface |
82 | 79 | */ |
83 | - public function sendData($data) |
|
84 | - { |
|
80 | + public function sendData($data) { |
|
85 | 81 | $httpResponse = $this->httpClient->post( |
86 | 82 | $this->getEndpoint(), |
87 | 83 | ['Content-Type' => 'text/xml; charset=utf-8'], |
@@ -99,27 +95,20 @@ discard block |
||
99 | 95 | * |
100 | 96 | * @return string XML |
101 | 97 | */ |
102 | - protected function xmlSerialize($data, $xml = null) |
|
103 | - { |
|
104 | - if ( !$xml instanceof SimpleXMLElement ) |
|
105 | - { |
|
98 | + protected function xmlSerialize($data, $xml = null) { |
|
99 | + if ( !$xml instanceof SimpleXMLElement ) { |
|
106 | 100 | $xml = new SimpleXMLElement('<'. $this->requestName .' xmlns="'. $this->namespace .'" />'); |
107 | 101 | } |
108 | 102 | |
109 | - foreach ($data as $key => $value) |
|
110 | - { |
|
111 | - if ( !isset($value) ) |
|
112 | - { |
|
103 | + foreach ($data as $key => $value) { |
|
104 | + if ( !isset($value) ) { |
|
113 | 105 | continue; |
114 | 106 | } |
115 | 107 | |
116 | - if ( is_array($value) ) |
|
117 | - { |
|
108 | + if ( is_array($value) ) { |
|
118 | 109 | $node = $xml->addChild($key); |
119 | 110 | $this->xmlSerialize($value, $node); |
120 | - } |
|
121 | - else |
|
122 | - { |
|
111 | + } else { |
|
123 | 112 | $xml->addChild($key, $value); |
124 | 113 | } |
125 | 114 | } |
@@ -134,10 +123,8 @@ discard block |
||
134 | 123 | * |
135 | 124 | * @return AbstractRequest Provides a fluent interface |
136 | 125 | */ |
137 | - public function setCard($value) |
|
138 | - { |
|
139 | - if ($value && !$value instanceof CreditCard) |
|
140 | - { |
|
126 | + public function setCard($value) { |
|
127 | + if ($value && !$value instanceof CreditCard) { |
|
141 | 128 | $value = new CreditCard($value); |
142 | 129 | } |
143 | 130 |