/** * @return null|string */ public function getMessage() { if (!isset($this->error)) { return ''; } if ($this->errorMessages->has($this->g('code'))) { return $this->errorMessages->get($this->g('code')); } if ($this->g('code') === 0 && preg_match('/^token `[_0-9a-zA-Z]+` has already been used\\.$/i', $this->g('message'))) { return "すでにカード情報は使われています"; } if ($this->g('message')) { return $this->g('message'); } return '支払い処理中にエラーが起こりました'; }