Exemple #1
0
 /**
  * Returns a new token.
  *
  * @param  TokenRequest $request
  * @return Token
  *
  * @throws RequestException
  */
 public function requestToken(TokenRequest $request)
 {
     $result = $this->request('POST', '/tokens', ['card[number]' => $request->getCardNumber(), 'card[exp_month]' => $request->getExpirationMonth(), 'card[exp_year]' => $request->getExpirationYear(), 'card[cvc]' => $request->getSecurityCode(), 'card[name]' => $request->getHolderName(), 'currency' => $request->getCurrency(), 'email' => $request->getEmail()]);
     return $this->objectConverter->convert($result);
 }
 public function testSetCardNumber()
 {
     $request = new TokenRequest();
     $request->setCardNumber('4444-3333-2222-1111');
     $this->assertEquals('4444333322221111', $request->getCardNumber(), 'dashes is removed');
 }