/**
  * @dataProvider actionProvider
  */
 public function testSerializeRequest($class, $method, $func)
 {
     $address = new BillingAddress('John', 'Doe', '550 South Winchester blvd.', 'P.O. Box 850', 'San Jose', '95128', 'CA', 'US', '+1(202)555-1234', '*****@*****.**');
     $trust = new TrustCenterData($address);
     $card = new CreditCardData();
     $card->creditCardNumber = '4200000000000000';
     $card->setExpirationDate('2005-01-01');
     $card->cardHolderName = 'John Doe';
     $card->secureCode = '123';
     $contactData = new ContactData('192.168.1.1', 'f-q04u9f');
     $recurringTransaction = new RecurringTransaction(RecurringTransaction::TYPE_INITIAL);
     $transaction = new Transaction();
     $transaction->mode = Transaction::MODE_DEMO;
     $transaction->id = '9457892347623478';
     $transaction->guWid = 'C328668112556109425394';
     $transaction->commerceType = 'MOTO';
     $transaction->referenceId = 'FJQ845GFW4I7FGQ348FQ349Q34';
     $transaction->startTime = new \DateTime('2005-12-12');
     $transaction->endTime = new \DateTime('2005-12-13');
     $transaction->paymentGroupId = '5FW9ERYG';
     $transaction->salesDate = new \DateTime('2005-12-11');
     $transaction->authorizationCode = 92381;
     $transaction->amount = new Amount(5);
     $transaction->currency = 'EUR';
     $transaction->countryCode = 'DE';
     $transaction->usage = 'OrderNo-FT345S71 Thank you';
     $transaction->creditCardData = $card;
     $transaction->trustCenterData = $trust;
     $transaction->contactData = $contactData;
     $transaction->recurringTransaction = $recurringTransaction;
     $action = new $class($transaction);
     $action->id = 'authentication 1';
     $job = call_user_func_array(['\\Wirecard\\Element\\Job', $method], ['0123456789ABCDEF', $action]);
     $job->id = 'job 1';
     $request = new Request($job);
     $request = WireCard::createWithRequest($request);
     $xml = $this->serializer->serialize($request, 'xml');
     $xmlString = file_get_contents(__DIR__ . "/data/Request.xml");
     $xmlString = str_replace('FNC_CC_', 'FNC_CC_' . $func, $xmlString);
     $this->assertXmlStringEqualsXmlString($xmlString, $xml);
 }
Example #2
0
 public function testWireCardHasRequest()
 {
     $request = $this->getMockBuilder('\\Wirecard\\Element\\Request')->disableOriginalConstructor()->getMock();
     $wireCard = WireCard::createWithRequest($request);
     $this->assertInstanceOf('\\Wirecard\\Element\\Request', $wireCard->request);
 }
 /**
  * @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());
 }
 protected function createRequest(Job $job)
 {
     $request = new Request($job);
     /** @var WireCard $wireCard */
     $wireCard = WireCard::createWithRequest($request);
     return $this->getSerializer()->serialize($wireCard, 'xml');
 }