示例#1
0
 /**
  * @return TokenRequest
  */
 private function createTokenRequest()
 {
     $request = new TokenRequest();
     $request->setCardNumber('4444333322221111')->setExpirationMonth(12)->setExpirationYear(19)->setHolderName('Taro Spike')->setSecurityCode(123)->setCurrency('JPY')->setEmail('*****@*****.**');
     return $request;
 }
示例#2
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);
 }
示例#3
0
 /**
  * @test
  *
  * @expectedException        \InvalidArgumentException
  * @expectedExceptionMessage The card number must be numerical.
  */
 public function setCardNumber_should_throw_an_InvalidArgumentException_if_non_numerical_string()
 {
     $request = new TokenRequest();
     $request->setCardNumber('0xFF');
 }