Exemplo n.º 1
0
 /**
  * @dataProvider actionProvider
  */
 public function testDeserializeResponse($class, $method, $func)
 {
     $error = new Error('DATA_ERROR', '24998', 'Demo-card or demo-mode transactions are not allowed without demo terminal mode.');
     $error->advices = ["Inspect your card number or remove attribute mode=''demo'' of tag 'CC_TRANSACTION'"];
     $processing = new ProcessingStatus('8WERH84', 'INFO', 'NOK');
     $processing->guWid = 'C895978124540997772104';
     $processing->timeStamp = new \DateTime('2009-06-19 13:12:57', new \DateTimeZone('UTC'));
     $processing->error = $error;
     $transaction = new Transaction();
     $transaction->mode = Transaction::MODE_DEMO;
     $transaction->id = '9457892347623478';
     $transaction->processingStatus = $processing;
     $action = new $class($transaction);
     $action->id = 'authentication 1';
     $job = call_user_func_array(['\\Wirecard\\Element\\Job', $method], ['0123456789ABCDEF', $action]);
     $job->id = 'job 1';
     $response = new Response($job);
     $wirecard = WireCard::createWithResponse($response);
     $xmlString = file_get_contents(__DIR__ . "/data/Response.xml");
     $xmlString = str_replace('FNC_CC_', 'FNC_CC_' . $func, $xmlString);
     $wirecardExpected = $this->serializer->deserialize($xmlString, 'Wirecard\\Element\\WireCard', 'xml');
     $this->assertEquals($wirecardExpected, $wirecard);
 }
Exemplo n.º 2
0
 public function testWireCardHasResponse()
 {
     $response = $this->getMockBuilder('\\Wirecard\\Element\\Response')->disableOriginalConstructor()->getMock();
     $wireCard = WireCard::createWithResponse($response);
     $this->assertInstanceOf('\\Wirecard\\Element\\Response', $wireCard->response);
 }
 /**
  * @depends testPurchaseRequest
  * @large
  * @param string $guWid
  * @return string
  */
 public function testReversalRequest($guWid)
 {
     $transaction = new Transaction();
     $transaction->id = '9457892347623478';
     $transaction->guWid = $guWid;
     $reversal = new Reversal($transaction);
     $job = Job::createReversalJob(self::SIGNATURE, $reversal);
     $request = new Request($job);
     $body = $this->serializer->serialize(WireCard::createWithRequest($request), 'xml');
     $response = $this->client->send($this->createRequest($body));
     /** @var WireCard $wireCard */
     $wireCard = $this->serializer->deserialize($response->getBody(true), 'Wirecard\\Element\\WireCard', 'xml');
     $response = $wireCard->response;
     $this->assertTrue($response->isSuccessful());
     $this->assertNull($response->getMessage());
 }
Exemplo n.º 4
0
 protected function createRequest(Job $job)
 {
     $request = new Request($job);
     /** @var WireCard $wireCard */
     $wireCard = WireCard::createWithRequest($request);
     return $this->getSerializer()->serialize($wireCard, 'xml');
 }