@@ -118,6 +118,7 @@ public function setTransactionReference($value)
118118 $ transactionRef = new TransactionReference ();
119119 $ transactionRef ->setTransId ($ value );
120120 }
121+
121122 return $ this ->setParameter ('transactionReference ' , $ transactionRef );
122123 }
123124
@@ -130,6 +131,7 @@ public function setCardReference($value)
130131 if (!($ value instanceof CardReference)) {
131132 $ value = new CardReference ($ value );
132133 }
134+
133135 return parent ::setCardReference ($ value );
134136 }
135137
@@ -140,15 +142,18 @@ public function setCardReference($value)
140142 public function getCardReference ($ serialize = true )
141143 {
142144 $ value = parent ::getCardReference ();
145+
143146 if ($ serialize ) {
144147 $ value = (string )$ value ;
145148 }
149+
146150 return $ value ;
147151 }
148152
149153 public function sendData ($ data )
150154 {
151155 $ headers = array ('Content-Type ' => 'text/xml; charset=utf-8 ' );
156+
152157 $ data = $ data ->saveXml ();
153158 $ httpResponse = $ this ->httpClient ->post ($ this ->getEndpoint (), $ headers , $ data )->send ();
154159
@@ -162,10 +167,12 @@ public function sendData($data)
162167 public function getBaseData ()
163168 {
164169 $ data = new \SimpleXMLElement ('< ' . $ this ->requestType . '/> ' );
170+
165171 $ data ->addAttribute ('xmlns ' , 'AnetApi/xml/v1/schema/AnetApiSchema.xsd ' );
166172 $ this ->addAuthentication ($ data );
167173 $ this ->addReferenceId ($ data );
168174 $ this ->addTransactionType ($ data );
175+
169176 return $ data ;
170177 }
171178
@@ -178,6 +185,7 @@ protected function addAuthentication(\SimpleXMLElement $data)
178185 protected function addReferenceId (\SimpleXMLElement $ data )
179186 {
180187 $ txnId = $ this ->getTransactionId ();
188+
181189 if (!empty ($ txnId )) {
182190 $ data ->refId = $ this ->getTransactionId ();
183191 }
@@ -189,6 +197,7 @@ protected function addTransactionType(\SimpleXMLElement $data)
189197 // The extending class probably hasn't specified an "action"
190198 throw new InvalidRequestException ();
191199 }
200+
192201 $ data ->transactionRequest ->transactionType = $ this ->action ;
193202 }
194203
@@ -213,6 +222,8 @@ protected function addBillingData(\SimpleXMLElement $data)
213222 /** @var CreditCard $card */
214223 if ($ card = $ this ->getCard ()) {
215224 // A card is present, so include billing and shipping details
225+ $ req ->customer ->email = $ card ->getEmail ();
226+
216227 $ req ->billTo ->firstName = $ card ->getBillingFirstName ();
217228 $ req ->billTo ->lastName = $ card ->getBillingLastName ();
218229 $ req ->billTo ->company = $ card ->getBillingCompany ();
0 commit comments