예제 #1
0
파일: Factory.php 프로젝트: namshi/innovate
 /**
  * create a request for the remote API when providing mpi data
  *
  * @param  Client                    $client
  * @param  string                    $method
  * @param  string                    $uri
  * @param  array                     $headers
  * @param  string                    $storeId
  * @param  string                    $key
  * @param  Transaction               $transaction
  * @param  CreditCardInterface               $card
  * @param  CustomerInformationInterface $billing
  * @param  Browser                   $browser
  * @param  array                     $mpiData
  * @return [type]
  */
 public function createRemoteRequest(HttpClient $client, $method, $uri, $headers, $storeId, $key, Transaction $transaction, CreditCardInterface $card, CustomerInformationInterface $billing, Browser $browser, array $mpiData)
 {
     $request = $client->createRequest($method, $uri, $headers);
     $body = [];
     $body['store'] = $storeId;
     $body['key'] = $key;
     $body['tran'] = $transaction->toArray();
     $body['card'] = $card->toArray();
     $body['billing'] = $billing->toArray();
     $body['browser'] = $browser->toArray();
     $body['mpi'] = $mpiData;
     $encoder = new XmlEncoder('remote');
     $serializer = new Serializer(array(new GetSetMethodNormalizer()), array($encoder));
     $request->setBody($serializer->serialize($body, 'xml'));
     return $request;
 }
 /**
  * Adds the value of browser data to the body
  *
  * @param \Namshi\Innovate\Payment\Browser $browser
  */
 protected function addBrowser(Browser $browser)
 {
     $this->xmlBody['browser'] = $browser->toArray();
 }