Exemplo n.º 1
0
 /**
  * @large
  */
 public function testPreauthorizationRequest()
 {
     $creditCard = new CreditCardData();
     $creditCard->creditCardNumber = 4200000000000000;
     $creditCard->setExpirationDate('2019-01');
     $creditCard->cardHolderName = 'John Doe';
     $creditCard->secureCode = 471;
     $address = new BillingAddress('John', 'Doe', '550 South Winchester blvd.', 'P.O. Box 850', 'San Jose', '95128', 'CA', 'US', '+1(202)555-1234', '*****@*****.**');
     $trustCenter = new TrustCenterData($address);
     $transaction = new Transaction();
     $transaction->mode = Transaction::MODE_DEMO;
     $transaction->id = '9457892347623478';
     $transaction->amount = new Amount(500);
     $transaction->currency = 'USD';
     $transaction->countryCode = 'US';
     $transaction->creditCardData = $creditCard;
     $transaction->trustCenterData = $trustCenter;
     $preauthorization = new Preauthorization($transaction);
     $job = Job::createPreauthorizationJob(self::SIGNATURE, $preauthorization);
     $request = new Request($job);
     /** @var WireCard $wireCard */
     $wireCard = WireCard::createWithRequest($request);
     $body = $this->serializer->serialize($wireCard, 'xml');
     $response = $this->client->send($this->createRequest($body));
     $wireCard = $this->serializer->deserialize($response->getBody(true), 'Wirecard\\Element\\WireCard', 'xml');
     $response = $wireCard->response;
     $this->assertTrue($response->isSuccessful());
     $this->assertNull($response->getMessage());
     return $response->getProcessingGuWid();
 }
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  *
  * @return mixed
  */
 protected function buildData()
 {
     $transaction = $this->buildTransaction();
     $preauthorization = new Preauthorization($transaction);
     return Job::createPreauthorizationJob($this->getSignature(), $preauthorization);
 }