public function testAllParametersSetCorrectly() { $transaction = new Transaction('sale', 'ecom', true, 'ORDER_NUMBER', 'DESCRIPTION', 'USD', 20); $arr = $transaction->toArray(); $this->assertEquals('sale', $arr['type']); $this->assertEquals('ORDER_NUMBER', $arr['cartid']); $this->assertEquals('DESCRIPTION', $arr['description']); $this->assertEquals(1, $arr['test']); $this->assertEquals('USD', $arr['currency']); $this->assertEquals(20, $arr['amount']); }
/** * 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 transaction data to the body * * @param \Namshi\Innovate\Payment\Transaction $transaction */ protected function addTransaction(Transaction $transaction) { $this->xmlBody['tran'] = $transaction->toArray(); }