public function testCardGetTokenTest() { $Client = new Client(111, 222); $Request = $Client->cardGetToken('4242424242424242', 7, 2020, 123); $this->assertEquals(['project' => '111', 'number' => '4242424242424242', 'expiration_month' => 7, 'expiration_year' => 2020, 'security_code' => '123', 'signature' => '811eb1e7394ce4c293b8f8bda0aeb5894c9b725db9c8510c7c993d40e568287f'], $this->getRequestParametersProperty($Request)); $Request = $Client->cardGetToken('4242424242424242', 7, 2020, 123, 'workflow'); $this->assertEquals(['project' => '111', 'number' => '4242424242424242', 'expiration_month' => 7, 'expiration_year' => 2020, 'security_code' => '123', 'callback' => 'workflow', 'signature' => '0b1647268bfd6f3d5810c111ff5b09e06e6c54e0d6e2c3bd19489a0506407100'], $this->getRequestParametersProperty($Request)); }
$number = ''; $securityCode = ''; $callback = null; $Command = new CommandPosix(); $Command->appendHelpParameter('show help'); $Command->appendParameter(new Option('callback', 'c', 'callback JSONP function name', Option::TYPE_STRING), function ($name, $value) use(&$callback) { $callback = (string) $value; }); $Command->appendParameter(new Option('month', 'm', 'expiration month', Option::TYPE_STRING, true), function ($name, $value) use(&$expirationMonth) { $expirationMonth = (int) $value; }); $Command->appendParameter(new Option('number', 'n', 'card number', Option::TYPE_STRING, true), function ($name, $value) use(&$number) { $number = (string) $value; }); $Command->appendParameter(new Option('public', 'b', 'project public key', Option::TYPE_STRING, true), function ($name, $value) use(&$publicKey) { $publicKey = (string) $value; }); $Command->appendParameter(new Option('security', 's', 'card security code', Option::TYPE_STRING, true), function ($name, $value) use(&$securityCode) { $securityCode = (string) $value; }); $Command->appendParameter(new Option('year', 'y', 'expiration year', Option::TYPE_STRING, true), function ($name, $value) use(&$expirationYear) { $expirationYear = (int) $value; }); try { $Command->parse(true); $Client = new Client($publicKey); $Response = $Client->cardGetToken($number, $expirationMonth, $expirationYear, $securityCode, $callback)->execute(); printf("%s\n", $Response); } catch (RequiredOptionException $Ex) { $Command->displayHelp(); }