Beispiel #1
0
 public function testGeneratingACorrectXmlBodyForTheRequest()
 {
     $client = new ClientStub('EXAMPLE_STORE', 'EXAMPLE_MERCHANT_ID', 'xyz', 'searchkey');
     $xmlSample = file_get_contents(__DIR__ . '/../../../fixtures/example.xml');
     $request = $client->performPayment(new Transaction('sale', 'ecom', true, 'ORDER_NUMBER', 'DESCRIPTION', 'USD', 40), new Card('4000000000000002', '123', new \DateTime('2025-5')), new BillingInformation(new Customer('Forenames', 'Surname', 'Mr'), new Address('STREET_ADDRESS_LINE_1', 'STREET_ADDRESS_LINE_2', 'STREET_ADDRESS_LINE_3', 'CITY', 'REGION', 'COUNTRY', '12345'), '*****@*****.**', '192.168.0.1'), new Browser('BROWSER_USER_AGENT_HEADER', 'BROWSER_ACCEPT_HEADER'));
     $xml = new \SimpleXMLElement($request->getBody());
     $xmlSample = new \SimpleXMLElement($xmlSample);
     $this->assertEquals($xmlSample->key, $xml->key);
     $this->assertEquals($xmlSample->tran->type, $xml->tran->type);
     $this->assertEquals($xmlSample->tran->currency, $xml->tran->currency);
     $this->assertEquals($xmlSample->card->number, $xml->card->number);
     $this->assertEquals($xmlSample->card->cvv, $xml->card->cvv);
     $this->assertEquals($xmlSample->card->expiry->month, $xml->card->expiry->month);
     $this->assertEquals($xmlSample->card->expiry->year, $xml->card->expiry->year);
 }