Beispiel #1
0
 /**
  * REST API method card/authenticate implementation
  * @param string $payerResponse payer authentication response. Returned from ACS to a​cs_return_url
  * @param string $merchantData merchant data. Returned from ACS to acs_return_url
  * @return Request card/authenticate request instance
  * @throws ErrorException if there is an API error
  */
 public function cardAuthenticate($payerResponse, $merchantData)
 {
     return $this->getRequest('card/authenticate', ['PaRes' => (string) $payerResponse, 'MD' => (string) $merchantData], function ($string) {
         return AuthenticateResponse::initializeByString($string);
     });
 }
    public function testAuthenticateResponse()
    {
        $Response = AuthenticateResponse::initializeByString('{
"id": 1326123574311498453, "success": true,
"card": {
"lastFour": "4242",
"mask": "************4242",
"type": "visa",
"expirationMonth": "4",
"expirationYear": "2020" },
"permanentToken": "9a083895d07ca58f6e5505bd19ed35ca9a083895d07ca58f6e5505bd19ed35ca",
"recurring": {
"frequency": 1,
"endsAt": "2015-10-22T11:49:23+03:00"
} }');
        $this->assertEquals('1326123574311498453', $Response->getId());
        $this->assertTrue($Response->isSuccess());
        $this->assertEquals('4242', $Response->getCard()->getLastFour());
        $this->assertEquals('************4242', $Response->getCard()->getMask());
        $this->assertEquals(4, $Response->getCard()->getExpirationMonth());
        $this->assertEquals(2020, $Response->getCard()->getExpirationYear());
        $this->assertEquals('9a083895d07ca58f6e5505bd19ed35ca9a083895d07ca58f6e5505bd19ed35ca', $Response->getPermanentToken());
        $this->assertEquals(1, $Response->getRecurring()->getFrequency());
        $this->assertEquals(1445503763, $Response->getRecurring()->getEndsAt());
        $this->assertEquals('authenticate result
    id:             1326123574311498453
    success:        true
    permanentToken: 9a083895d07ca58f6e5505bd19ed35ca9a083895d07ca58f6e5505bd19ed35ca
    card
        four:       4242
        mask:       ************4242
        type:       visa
        exp. month: 4
        exp. year:  2020
    recurring
        frequency:  1
        endsAt:     2015-10-22T08:49:23+0000', (string) $Response);
    }